Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9414e41

Browse files
committed
Fix logical replication launcher wake up and reset
After the logical replication launcher was told to wake up at commit (for example, by a CREATE SUBSCRIPTION command), the flag to wake up was not reset, so it would be woken up at every following commit as well. So fix that by resetting the flag. Also, we don't need to wake up anything if the transaction was rolled back. Just reset the flag in that case. Author: Masahiko Sawada <sawada.mshk@gmail.com> Reported-by: Fujii Masao <masao.fujii@gmail.com>
1 parent e180c8a commit 9414e41

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/backend/access/transam/xact.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -2138,7 +2138,7 @@ CommitTransaction(void)
21382138
AtEOXact_HashTables(true);
21392139
AtEOXact_PgStat(true);
21402140
AtEOXact_Snapshot(true, false);
2141-
AtCommit_ApplyLauncher();
2141+
AtEOXact_ApplyLauncher(true);
21422142
pgstat_report_xact_timestamp(0);
21432143

21442144
CurrentResourceOwner = NULL;
@@ -2612,6 +2612,7 @@ AbortTransaction(void)
26122612
AtEOXact_ComboCid();
26132613
AtEOXact_HashTables(false);
26142614
AtEOXact_PgStat(false);
2615+
AtEOXact_ApplyLauncher(false);
26152616
pgstat_report_xact_timestamp(0);
26162617
}
26172618

src/backend/replication/logical/launcher.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -748,10 +748,12 @@ ApplyLauncherShmemInit(void)
748748
* Wakeup the launcher on commit if requested.
749749
*/
750750
void
751-
AtCommit_ApplyLauncher(void)
751+
AtEOXact_ApplyLauncher(bool isCommit)
752752
{
753-
if (on_commit_launcher_wakeup)
753+
if (isCommit && on_commit_launcher_wakeup)
754754
ApplyLauncherWakeup();
755+
756+
on_commit_launcher_wakeup = false;
755757
}
756758

757759
/*

src/include/replication/logicallauncher.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ extern Size ApplyLauncherShmemSize(void);
2222
extern void ApplyLauncherShmemInit(void);
2323

2424
extern void ApplyLauncherWakeupAtCommit(void);
25-
extern void AtCommit_ApplyLauncher(void);
25+
extern void AtEOXact_ApplyLauncher(bool isCommit);
2626

2727
#endif /* LOGICALLAUNCHER_H */

0 commit comments

Comments
 (0)