Skip to content

Commit 74eaf66

Browse files
committed
Call WaitLSNCleanup() in AbortTransaction()
Even though waiting for replay LSN happens without explicit transaction, AbortTransaction() is responsible for the cleanup of the shared memory if the error is thrown in a stored procedure. So, we need to do WaitLSNCleanup() there to clean up after some unexpected error happened while waiting for replay LSN. Discussion: https://postgr.es/m/202404051815.eri4u5q6oj26%40alvherre.pgsql Author: Alvaro Herrera
1 parent ee79928 commit 74eaf66

File tree

1 file changed

+6
-0
lines changed
  • src/backend/access/transam

1 file changed

+6
-0
lines changed

src/backend/access/transam/xact.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "commands/async.h"
3939
#include "commands/tablecmds.h"
4040
#include "commands/trigger.h"
41+
#include "commands/waitlsn.h"
4142
#include "common/pg_prng.h"
4243
#include "executor/spi.h"
4344
#include "libpq/be-fsstubs.h"
@@ -2771,6 +2772,11 @@ AbortTransaction(void)
27712772
*/
27722773
LWLockReleaseAll();
27732774

2775+
/*
2776+
* Cleanup waiting for LSN if any.
2777+
*/
2778+
WaitLSNCleanup();
2779+
27742780
/* Clear wait information and command progress indicator */
27752781
pgstat_report_wait_end();
27762782
pgstat_progress_end_command();

0 commit comments

Comments
 (0)