diff options
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index ec55d68d272..1651e15e898 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -42,6 +42,7 @@ #include "catalog/pg_database.h" #include "commands/progress.h" #include "commands/tablespace.h" +#include "commands/wait.h" #include "common/controldata_utils.h" #include "executor/instrument.h" #include "miscadmin.h" @@ -7154,6 +7155,7 @@ StartupXLOG(void) do { bool switchedTLI = false; + XLogRecPtr minWaitedLSN; #ifdef WAL_DEBUG if (XLOG_DEBUG || @@ -7357,6 +7359,17 @@ StartupXLOG(void) break; } + /* + * If we replayed an LSN that someone was waiting for, set + * latches in shared memory array to notify the waiter. + */ + minWaitedLSN = WaitLSNGetMin(); + if (!XLogRecPtrIsInvalid(minWaitedLSN) && + minWaitedLSN <= XLogCtl->lastReplayedEndRecPtr) + { + WaitLSNSetLatch(XLogCtl->lastReplayedEndRecPtr); + } + /* Else, try to fetch the next WAL record */ record = ReadRecord(xlogreader, LOG, false); } while (record != NULL); |