!635 fix xlog could not cleanup with cascade standby

Merge pull request !635 from LiHeng/master
This commit is contained in:
opengauss-bot
2021-01-20 11:29:48 +08:00
committed by Gitee

View File

@ -4194,30 +4194,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;
}
/*