Merge pull request #3441 from yliucode/fix-joshua-real

Re-enable asking read version from master
This commit is contained in:
Jingyu Zhou 2020-07-06 13:35:35 -07:00 committed by GitHub
commit cd75cce8fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 14 deletions

View File

@ -358,7 +358,7 @@ void ServerKnobs::initialize(bool randomize, ClientKnobs* clientKnobs, bool isSi
init( PROXY_COMPUTE_BUCKETS, 20000 );
init( PROXY_COMPUTE_GROWTH_RATE, 0.01 );
init( TXN_STATE_SEND_AMOUNT, 2 );
init( ASK_READ_VERSION_FROM_MASTER, false ); // Please do not flip this flag.
init( ASK_READ_VERSION_FROM_MASTER, true );
// Master Server
// masterCommitter() in the master server will allow lower priority tasks (e.g. DataDistibution)

View File

@ -1248,6 +1248,7 @@ ACTOR Future<Void> commitBatch(
}
throw;
}
self->lastCommitLatency = now()-commitStartTime;
self->lastCommitTime = std::max(self->lastCommitTime.get(), commitStartTime);
wait(yield(TaskPriority::ProxyCommitYield2));
@ -1276,20 +1277,18 @@ ACTOR Future<Void> commitBatch(
ASSERT(p.second.isReady());
}
// After logging finishes, we report the commit version to master so that every other proxy can get the most
// up-to-date live committed version. We also maintain the invariant that master's committed version >= self->committedVersion
// by reporting commit version first before updating self->committedVersion. Otherwise, a client may get a commit
// version that the master is not aware of, and next GRV request may get a version less than self->committedVersion.
TEST(self->committedVersion.get() > commitVersion); // A later version was reported committed first
if (SERVER_KNOBS->ASK_READ_VERSION_FROM_MASTER && commitVersion > self->committedVersion.get()) {
wait(self->master.reportLiveCommittedVersion.getReply(ReportRawCommittedVersionRequest(commitVersion, lockedAfter, metadataVersionAfter), TaskPriority::ProxyMasterVersionReply));
}
if( commitVersion > self->committedVersion.get() ) {
if (SERVER_KNOBS->ASK_READ_VERSION_FROM_MASTER) {
// Let master know this commit version so that every other proxy can know.
wait(self->master.reportLiveCommittedVersion.getReply(ReportRawCommittedVersionRequest(commitVersion, lockedAfter, metadataVersionAfter), TaskPriority::ProxyMasterVersionReply));
}
// After we report the commit version above, other batch commitBatch executions may have updated 'self->committedVersion'
// to be a larger commitVersion.
if (commitVersion > self->committedVersion.get()) {
self->committedVersion.set(commitVersion);
self->locked = lockedAfter;
self->metadataVersion = metadataVersionAfter;
}
self->locked = lockedAfter;
self->metadataVersion = metadataVersionAfter;
self->committedVersion.set(commitVersion);
}
if (forceRecovery) {

View File

@ -63,6 +63,7 @@ enum class TaskPriority {
TLogPeek = 8590,
TLogCommitReply = 8580,
TLogCommit = 8570,
ReportLiveCommittedVersion = 8567,
ProxyGetRawCommittedVersion = 8565,
ProxyMasterVersionReply = 8560,
ProxyCommitYield2 = 8557,
@ -71,7 +72,6 @@ enum class TaskPriority {
ProxyResolverReply = 8547,
ProxyCommit = 8545,
ProxyCommitBatcher = 8540,
ReportLiveCommittedVersion = 8535,
TLogConfirmRunningReply = 8530,
TLogConfirmRunning = 8520,
ProxyGRVTimer = 8510,