Broadcast before exiting sync safekeepers (#4700)

Recently we started doing sync-safekeepers before exiting compute_ctl,
expecting that it will make next sync faster by skipping recovery. But
recovery is still running in some cases
(https://github.com/neondatabase/neon/pull/4574#issuecomment-1629256166)
because of the lagging truncateLsn. This PR should help with updating
truncateLsn.
This commit is contained in:
Arthur Petukhovsky
2023-07-12 17:48:20 +01:00
committed by GitHub
parent 664d32eb7f
commit 3a1be9b246

View File

@@ -2231,6 +2231,18 @@ HandleSafekeeperResponse(void)
if (n_synced >= quorum)
{
/* All safekeepers synced! */
/*
* Send empty message to broadcast latest truncateLsn to all safekeepers.
* This helps to finish next sync-safekeepers eailier, by skipping recovery
* step.
*
* We don't need to wait for response because it doesn't affect correctness,
* and TCP should be able to deliver the message to safekeepers in case of
* network working properly.
*/
BroadcastAppendRequest();
fprintf(stdout, "%X/%X\n", LSN_FORMAT_ARGS(propEpochStartLsn));
exit(0);
}