diff --git a/src/backend/replication/syncrep.c b/src/backend/replication/syncrep.c index 3d4a750..284c86d 100644 --- a/src/backend/replication/syncrep.c +++ b/src/backend/replication/syncrep.c @@ -179,6 +179,14 @@ SyncRepWaitForLSN(XLogRecPtr XactCommitLSN) * lock. We could get rid of this dance if SetLatch/ResetLatch * contained memory barriers. */ + + /* + * syncrep.c assertion test: + * + * Sleep so that walsender gets a chance to catch up before we wait + */ + pg_usleep(2 * 1000000L); + syncRepState = MyProc->syncRepState; if (syncRepState == SYNC_REP_WAITING) { @@ -568,6 +576,14 @@ SyncRepWakeQueue(bool all, int mode) thisproc->syncRepState = SYNC_REP_WAIT_COMPLETE; /* + * syncrep.c assertion test: + * + * Sleep so that the backend gets chance to examine the syncRepLinks, + * triggering an assertion failure. + */ + pg_usleep(5 * 1000000L); + + /* * Remove thisproc from queue. */ SHMQueueDelete(&(thisproc->syncRepLinks));