syncrep_check_max_wal_senders_v1.patch
application/octet-stream
Filename: syncrep_check_max_wal_senders_v1.patch
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: context
Series: patch v1
| File | + | − |
|---|---|---|
| src/backend/access/transam/twophase.c | 6 | 0 |
| src/backend/access/transam/xact.c | 2 | 0 |
| src/backend/replication/syncrep.c | 1 | 0 |
*** a/src/backend/access/transam/twophase.c --- b/src/backend/access/transam/twophase.c *************** *** 1078,1084 **** EndPrepare(GlobalTransaction gxact) * Note that at this stage we have marked the prepare, but still show as * running in the procarray (twice!) and continue to hold locks. */ ! SyncRepWaitForLSN(gxact->prepare_lsn); records.tail = records.head = NULL; } --- 1078,1085 ---- * Note that at this stage we have marked the prepare, but still show as * running in the procarray (twice!) and continue to hold locks. */ ! if (max_wal_senders > 0) ! SyncRepWaitForLSN(gxact->prepare_lsn); records.tail = records.head = NULL; } *************** *** 2046,2052 **** RecordTransactionCommitPrepared(TransactionId xid, * Note that at this stage we have marked clog, but still show as * running in the procarray and continue to hold locks. */ ! SyncRepWaitForLSN(recptr); } /* --- 2047,2054 ---- * Note that at this stage we have marked clog, but still show as * running in the procarray and continue to hold locks. */ ! if (max_wal_senders > 0) ! SyncRepWaitForLSN(recptr); } /* *************** *** 2133,2137 **** RecordTransactionAbortPrepared(TransactionId xid, * Note that at this stage we have marked clog, but still show as * running in the procarray and continue to hold locks. */ ! SyncRepWaitForLSN(recptr); } --- 2135,2140 ---- * Note that at this stage we have marked clog, but still show as * running in the procarray and continue to hold locks. */ ! if (max_wal_senders > 0) ! SyncRepWaitForLSN(recptr); } *** a/src/backend/access/transam/xact.c --- b/src/backend/access/transam/xact.c *************** *** 1132,1138 **** RecordTransactionCommit(void) * Note that at this stage we have marked clog, but still show as * running in the procarray and continue to hold locks. */ ! SyncRepWaitForLSN(XactLastRecEnd); /* Reset XactLastRecEnd until the next transaction writes something */ XactLastRecEnd.xrecoff = 0; --- 1132,1139 ---- * Note that at this stage we have marked clog, but still show as * running in the procarray and continue to hold locks. */ ! if (max_wal_senders > 0) ! SyncRepWaitForLSN(XactLastRecEnd); /* Reset XactLastRecEnd until the next transaction writes something */ XactLastRecEnd.xrecoff = 0; *** a/src/backend/replication/syncrep.c --- b/src/backend/replication/syncrep.c *************** *** 96,101 **** SyncRepWaitForLSN(XLogRecPtr XactCommitLSN) --- 96,102 ---- if (!SyncRepRequested() || !sync_standbys_defined) return; + Assert(max_wal_senders > 0); Assert(SHMQueueIsDetached(&(MyProc->syncRepLinks))); /*