mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-15 01:12:56 +00:00
Fix bug in walproposer voting
This commit is contained in:
@@ -1455,6 +1455,7 @@ static void
|
||||
DetermineEpochStartLsn(void)
|
||||
{
|
||||
TermHistory *dth;
|
||||
int n_ready = 0;
|
||||
|
||||
propEpochStartLsn = InvalidXLogRecPtr;
|
||||
donorEpoch = 0;
|
||||
@@ -1465,6 +1466,8 @@ DetermineEpochStartLsn(void)
|
||||
{
|
||||
if (safekeeper[i].state == SS_IDLE)
|
||||
{
|
||||
n_ready++;
|
||||
|
||||
if (GetEpoch(&safekeeper[i]) > donorEpoch ||
|
||||
(GetEpoch(&safekeeper[i]) == donorEpoch &&
|
||||
safekeeper[i].voteResponse.flushLsn > propEpochStartLsn))
|
||||
@@ -1491,6 +1494,9 @@ DetermineEpochStartLsn(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (n_ready < quorum)
|
||||
walprop_log(FATAL, "missing majority of votes, expected %d, got %d", n_votes, n_ready);
|
||||
|
||||
/*
|
||||
* If propEpochStartLsn is 0 everywhere, we are bootstrapping -- nothing
|
||||
* was committed yet. Start streaming then from the basebackup LSN.
|
||||
|
||||
Reference in New Issue
Block a user