summaryrefslogtreecommitdiff
path: root/src/backend/replication/syncrep.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/replication/syncrep.c')
-rw-r--r--src/backend/replication/syncrep.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/backend/replication/syncrep.c b/src/backend/replication/syncrep.c
index 8713b9700dc..6463420cd85 100644
--- a/src/backend/replication/syncrep.c
+++ b/src/backend/replication/syncrep.c
@@ -111,9 +111,6 @@ SyncRepWaitForLSN(XLogRecPtr XactCommitLSN)
Assert(SHMQueueIsDetached(&(MyProc->syncRepLinks)));
Assert(WalSndCtl != NULL);
- /* Reset the latch before adding ourselves to the queue. */
- ResetLatch(&MyProc->waitLatch);
-
LWLockAcquire(SyncRepLock, LW_EXCLUSIVE);
Assert(MyProc->syncRepState == SYNC_REP_NOT_WAITING);
@@ -167,7 +164,7 @@ SyncRepWaitForLSN(XLogRecPtr XactCommitLSN)
int syncRepState;
/* Must reset the latch before testing state. */
- ResetLatch(&MyProc->waitLatch);
+ ResetLatch(&MyProc->procLatch);
/*
* Try checking the state without the lock first. There's no
@@ -247,11 +244,11 @@ SyncRepWaitForLSN(XLogRecPtr XactCommitLSN)
}
/*
- * Wait on latch for up to 60 seconds. This allows us to check for
+ * Wait on latch for up to 10 seconds. This allows us to check for
* cancel/die signal or postmaster death regularly while waiting. Note
* that timeout here does not necessarily release from loop.
*/
- WaitLatch(&MyProc->waitLatch, 60000L);
+ WaitLatch(&MyProc->procLatch, 10000L);
}
/*
@@ -322,7 +319,7 @@ SyncRepCancelWait(void)
}
void
-SyncRepCleanupAtProcExit(int code, Datum arg)
+SyncRepCleanupAtProcExit(void)
{
if (!SHMQueueIsDetached(&(MyProc->syncRepLinks)))
{
@@ -330,8 +327,6 @@ SyncRepCleanupAtProcExit(int code, Datum arg)
SHMQueueDelete(&(MyProc->syncRepLinks));
LWLockRelease(SyncRepLock);
}
-
- DisownLatch(&MyProc->waitLatch);
}
/*
@@ -560,9 +555,7 @@ SyncRepWakeQueue(bool all)
/*
* Wake only when we have set state and removed from queue.
*/
- Assert(SHMQueueIsDetached(&(thisproc->syncRepLinks)));
- Assert(thisproc->syncRepState == SYNC_REP_WAIT_COMPLETE);
- SetLatch(&(thisproc->waitLatch));
+ SetLatch(&(thisproc->procLatch));
numprocs++;
}