fix: Calculate fault tolerance when keys are not fully replicated

Whem the database is not fully replicated to remote, fault tolerance
can be calculated by couting total number of tLogs replicas in primary
and satellite - 1, as we can lose all but one of those, but we were
subtracting 2 instead of 1.
This commit is contained in:
Vishesh Yadav 2020-12-22 16:26:19 -08:00
parent a1809f7d86
commit 6957e64886
1 changed files with 2 additions and 1 deletions

View File

@ -174,7 +174,8 @@ struct DatabaseConfiguration {
return 1 + std::min(std::max(tLogReplicationFactor - 1 - tLogWriteAntiQuorum, worstSatellite - 1),
storageTeamSize - 1);
} else if (worstSatellite > 0) {
return std::min(tLogReplicationFactor + worstSatellite - 2 - tLogWriteAntiQuorum, storageTeamSize - 1);
// Primary and Satellite tLogs are synchronously replicated, hence we can lose all but 1.
return std::min(tLogReplicationFactor + worstSatellite - 1 - tLogWriteAntiQuorum, storageTeamSize - 1);
}
return std::min(tLogReplicationFactor - 1 - tLogWriteAntiQuorum, storageTeamSize - 1);
}