forked from huawei/openGauss-server
!636 fix xlog could not cleanup with cascade standby
Merge pull request !636 from LiHeng/1.1.0
This commit is contained in:
commit
381b8434e8
|
|
@ -4186,30 +4186,20 @@ bool WalSndQuorumInProgress(int type)
|
|||
bool WalSndAllInProgress(int type)
|
||||
{
|
||||
int i;
|
||||
int num = 0;
|
||||
int all_num = 0;
|
||||
|
||||
for (i = 1; i < MAX_REPLNODE_NUM; i++) {
|
||||
if (t_thrd.postmaster_cxt.ReplConnArray[i] != NULL)
|
||||
all_num++;
|
||||
}
|
||||
|
||||
for (i = 0; i < g_instance.attr.attr_storage.max_wal_senders; i++) {
|
||||
/* use volatile pointer to prevent code rearrangement */
|
||||
volatile WalSnd *walsnd = &t_thrd.walsender_cxt.WalSndCtl->walsnds[i];
|
||||
SpinLockAcquire(&walsnd->mutex);
|
||||
if (walsnd->pid != 0 && walsnd->pid != t_thrd.proc_cxt.MyProcPid &&
|
||||
((walsnd->sendRole & type) == walsnd->sendRole) &&
|
||||
if (walsnd->pid == 0 && ((walsnd->sendRole & type) == walsnd->sendRole) &&
|
||||
walsnd->sentPtr > 0) {
|
||||
num++;
|
||||
SpinLockRelease(&walsnd->mutex);
|
||||
return false;
|
||||
}
|
||||
SpinLockRelease(&walsnd->mutex);
|
||||
}
|
||||
if (num >= all_num) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue