wake up other walsenders to release workers when walsender exits.

This commit is contained in:
chenxiaobin19
2021-09-08 17:50:54 +08:00
parent 8ee7aee7be
commit 61bd40155c

View File

@ -3492,6 +3492,9 @@ static int WalSndLoop(WalSndSendDataCallback send_data)
WaitLatchOrSocket(&t_thrd.walsender_cxt.MyWalSnd->latch, wakeEvents, u_sess->proc_cxt.MyProcPort->sock,
sleeptime);
if (!AM_WAL_STANDBY_SENDER) {
SyncRepReleaseWaiters();
}
t_thrd.int_cxt.ImmediateInterruptOK = false;
}
@ -3833,6 +3836,13 @@ static void WalSndKill(int code, Datum arg)
t_thrd.walsender_cxt.sendFile = -1;
}
/*
* Try to wake up walsenders which are in WaitLatchOrSocket of WalSndLoop.
* Or they would be woken up only by walwriter, which may cause that workers
* are not woken up in time.
*/
WalSndWakeup();
t_thrd.walsender_cxt.wsXLogJustSendRegion->start_ptr = InvalidXLogRecPtr;
t_thrd.walsender_cxt.wsXLogJustSendRegion->end_ptr = InvalidXLogRecPtr;