fix: use the number of present logServers rather than the total size of the vector

This commit is contained in:
Evan Tschannen 2017-09-22 16:19:16 -07:00
parent 7081136f74
commit 180438d41e
1 changed files with 5 additions and 3 deletions

View File

@ -331,17 +331,19 @@ struct TagPartitionedLogSystem : ILogSystem, ReferenceCounted<TagPartitionedLogS
ACTOR static Future<Void> confirmEpochLive_internal(TagPartitionedLogSystem* self, Optional<UID> debugID) { ACTOR static Future<Void> confirmEpochLive_internal(TagPartitionedLogSystem* self, Optional<UID> debugID) {
state vector<Future<Void>> alive; state vector<Future<Void>> alive;
int numPresent = 0;
for(auto& t : self->logServers) { for(auto& t : self->logServers) {
if( t->get().present() ) { if( t->get().present() ) {
alive.push_back( brokenPromiseToNever( alive.push_back( brokenPromiseToNever(
t->get().interf().confirmRunning.getReply( TLogConfirmRunningRequest(debugID), t->get().interf().confirmRunning.getReply( TLogConfirmRunningRequest(debugID),
TaskTLogConfirmRunningReply ) ) ); TaskTLogConfirmRunningReply ) ) );
numPresent++;
} else { } else {
alive.push_back( Never() ); alive.push_back( Never() );
} }
} }
Void _ = wait( quorum( alive, std::min(self->tLogReplicationFactor, (int)alive.size() - self->tLogWriteAntiQuorum) ) ); Void _ = wait( quorum( alive, std::min(self->tLogReplicationFactor, numPresent - self->tLogWriteAntiQuorum) ) );
loop { loop {
LocalityGroup locked; LocalityGroup locked;
@ -965,7 +967,7 @@ struct TagPartitionedLogSystem : ILogSystem, ReferenceCounted<TagPartitionedLogS
} }
} }
bool valid = filter_true.validate(prevState.tLogPolicy); bool valid = filter_true.validate(prevState.tLogPolicy);
if (!valid && prevState.tLogWriteAntiQuorum > 0 && false /* TODO(alexmiller) */ ) { if (!valid && prevState.tLogWriteAntiQuorum > 0 ) {
valid = !validateAllCombinations(unused, filter_true, prevState.tLogPolicy, filter_false, prevState.tLogWriteAntiQuorum, false); valid = !validateAllCombinations(unused, filter_true, prevState.tLogPolicy, filter_false, prevState.tLogWriteAntiQuorum, false);
} }
return valid; return valid;
@ -1046,7 +1048,7 @@ struct TagPartitionedLogSystem : ILogSystem, ReferenceCounted<TagPartitionedLogS
} }
} }
if (prevState.tLogReplicationFactor /* - prevState.tLogWriteAntiQuorum*/ == 1) { if (prevState.tLogReplicationFactor - prevState.tLogWriteAntiQuorum == 1) {
ASSERT(can_omit == 0); ASSERT(can_omit == 0);
} }
// Our previous check of making sure there aren't too many failed logs should have prevented this. // Our previous check of making sure there aren't too many failed logs should have prevented this.