提交 09aab726 编写于 作者: J Jimmy Yih 提交者: Xin Zhang

Revert "Bump up max_wal_senders, to fix src/test/walrep/ tests."

This reverts commit f38f024d7d314ae8ac100d862307a228b212c70e.
上级 081e7176
......@@ -1142,12 +1142,8 @@ PostmasterMain(int argc, char *argv[])
/*
* This value of max_wal_senders will be inherited by all the child processes
* through fork(). This value is used by XLogIsNeeded().
*
* In a normal setup, each node only has one replica. But have some headroom,
* for other tools that want to use a replication connection, and for hung
* connections, etc.
*/
max_wal_senders = 5;
max_wal_senders = 1;
if ( GpIdentity.numsegments < 0 )
{
......
......@@ -26,12 +26,8 @@
* Check the WalSndCtl to obtain if mirror is up or down, if the wal sender is
* in streaming, and if synchronous replication is enabled or not.
*/
void
GetMirrorStatus(FtsResponse *response)
void GetMirrorStatus(FtsResponse *response)
{
int i;
pg_time_t most_recent_marked_pid_zero_at_time;
response->IsMirrorUp = false;
response->IsInSync = false;
response->RequestRetry = false;
......@@ -40,23 +36,31 @@ GetMirrorStatus(FtsResponse *response)
* Greenplum currently supports only ONE mirror per primary.
* If there are more mirrors, this logic in this function need to be revised.
*/
Assert(max_wal_senders >= 1);
Assert(max_wal_senders == 1);
LWLockAcquire(SyncRepLock, LW_SHARED);
most_recent_marked_pid_zero_at_time = 0;
for (i = 0; i < max_wal_senders; i++)
for (int i = 0; i < max_wal_senders; i++)
{
/* use volatile pointer to prevent code rearrangement */
volatile WalSnd *walsnd = &WalSndCtl->walsnds[i];
if (walsnd->pid == 0)
{
pg_time_t marked_pid_zero_at_time = walsnd->marked_pid_zero_at_time;
Assert(marked_pid_zero_at_time);
if (most_recent_marked_pid_zero_at_time > marked_pid_zero_at_time)
most_recent_marked_pid_zero_at_time = marked_pid_zero_at_time;
Assert(walsnd->marked_pid_zero_at_time);
pg_time_t delta = ((pg_time_t) time(NULL)) - walsnd->marked_pid_zero_at_time;
/*
* Report mirror as down, only if it didn't connect for below
* grace period to primary. This helps to avoid marking mirror
* down unnecessarily when restarting primary or due to small n/w
* glitch. During this period, request FTS to probe again.
*/
if (delta < FTS_MARKING_MIRROR_DOWN_GRACE_PERIOD)
{
elog(LOG,
"requesting fts retry as mirror didn't connect yet but in grace period " INT64_FORMAT, delta);
response->RequestRetry = true;
}
}
else
{
......@@ -70,24 +74,6 @@ GetMirrorStatus(FtsResponse *response)
}
}
if (i == max_wal_senders)
{
pg_time_t delta = ((pg_time_t) time(NULL)) - most_recent_marked_pid_zero_at_time;
/*
* Report mirror as down, only if it didn't connect for below
* grace period to primary. This helps to avoid marking mirror
* down unnecessarily when restarting primary or due to small n/w
* glitch. During this period, request FTS to probe again.
*/
if (delta < FTS_MARKING_MIRROR_DOWN_GRACE_PERIOD)
{
elog(LOG,
"requesting fts retry as mirror didn't connect yet but in grace period " INT64_FORMAT, delta);
response->RequestRetry = true;
}
}
response->IsSyncRepEnabled = WalSndCtl->sync_standbys_defined;
LWLockRelease(SyncRepLock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册