diff options
Diffstat (limited to 'src/backend/access/transam/xlog.c')
| -rw-r--r-- | src/backend/access/transam/xlog.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 906292690d6..1612acd1409 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7182,6 +7182,16 @@ CreateCheckPoint(int flags) checkPoint.time = (pg_time_t) time(NULL); /* + * For Hot Standby, derive the oldestActiveXid before we fix the redo pointer. + * This allows us to begin accumulating changes to assemble our starting + * snapshot of locks and transactions. + */ + if (!shutdown && XLogStandbyInfoActive()) + checkPoint.oldestActiveXid = GetOldestActiveTransactionId(); + else + checkPoint.oldestActiveXid = InvalidTransactionId; + + /* * We must hold WALInsertLock while examining insert state to determine * the checkpoint REDO pointer. */ @@ -7367,9 +7377,7 @@ CreateCheckPoint(int flags) * Update checkPoint.nextXid since we have a later value */ if (!shutdown && XLogStandbyInfoActive()) - LogStandbySnapshot(&checkPoint.oldestActiveXid, &checkPoint.nextXid); - else - checkPoint.oldestActiveXid = InvalidTransactionId; + LogStandbySnapshot(&checkPoint.nextXid); START_CRIT_SECTION(); |
