diff options
author | Amit Kapila <akapila@postgresql.org> | 2024-08-21 09:22:32 +0530 |
---|---|---|
committer | Amit Kapila <akapila@postgresql.org> | 2024-08-21 09:22:32 +0530 |
commit | 3f28b2fcac33fb352d261fac298cfe68c3899d32 (patch) | |
tree | 9c0bf70251848546b145cb070a701b01fed0a02f /src/backend/utils/error/elog.c | |
parent | a95ff1fe2eb4926b13e0940ad1f37d048704bdb0 (diff) | |
download | postgresql-3f28b2fcac33fb352d261fac298cfe68c3899d32.tar.gz postgresql-3f28b2fcac33fb352d261fac298cfe68c3899d32.zip |
Don't advance origin during apply failure.
We advance origin progress during abort on successful streaming and
application of ROLLBACK in parallel streaming mode. But the origin
shouldn't be advanced during an error or unsuccessful apply due to
shutdown. Otherwise, it will result in a transaction loss as such a
transaction won't be sent again by the server.
Reported-by: Hou Zhijie
Author: Hayato Kuroda and Shveta Malik
Reviewed-by: Amit Kapila
Backpatch-through: 16
Discussion: https://postgr.es/m/TYAPR01MB5692FAC23BE40C69DA8ED4AFF5B92@TYAPR01MB5692.jpnprd01.prod.outlook.com
Diffstat (limited to 'src/backend/utils/error/elog.c')
-rw-r--r-- | src/backend/utils/error/elog.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 943d8588f3d..5cbb5b54168 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -1569,6 +1569,23 @@ geterrcode(void) } /* + * geterrlevel --- return the currently set error level + * + * This is only intended for use in error callback subroutines, since there + * is no other place outside elog.c where the concept is meaningful. + */ +int +geterrlevel(void) +{ + ErrorData *edata = &errordata[errordata_stack_depth]; + + /* we don't bother incrementing recursion_depth */ + CHECK_STACK_DEPTH(); + + return edata->elevel; +} + +/* * geterrposition --- return the currently set error position (0 if none) * * This is only intended for use in error callback subroutines, since there |