Extend Transaction Window during Restore in Simulation (#8729)
* fix bug * fix formatting
This commit is contained in:
parent
705ad9cb91
commit
8bd5f362a5
|
@ -5924,6 +5924,7 @@ public:
|
|||
printf("Restoring backup to version: %lld\n", (long long)targetVersion);
|
||||
}
|
||||
|
||||
state int retryCount = 0;
|
||||
state Reference<ReadYourWritesTransaction> tr(new ReadYourWritesTransaction(cx));
|
||||
loop {
|
||||
try {
|
||||
|
@ -5947,9 +5948,17 @@ public:
|
|||
wait(tr->commit());
|
||||
break;
|
||||
} catch (Error& e) {
|
||||
if (e.code() == error_code_transaction_too_old) {
|
||||
retryCount++;
|
||||
}
|
||||
if (e.code() == error_code_restore_duplicate_tag) {
|
||||
throw;
|
||||
}
|
||||
if (g_network->isSimulated() && retryCount > 50) {
|
||||
CODE_PROBE(true, "submitRestore simulation speedup");
|
||||
// try to make the read window back to normal size (5 * version_per_sec)
|
||||
g_simulator->speedUpSimulation = true;
|
||||
}
|
||||
wait(tr->onError(e));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -289,7 +289,11 @@ ACTOR Future<Void> resolveBatch(Reference<Resolver> self,
|
|||
// Detect conflicts
|
||||
double expire = now() + SERVER_KNOBS->SAMPLE_EXPIRATION_TIME;
|
||||
ConflictBatch conflictBatch(self->conflictSet, &reply.conflictingKeyRangeMap, &reply.arena);
|
||||
const Version newOldestVersion = req.version - SERVER_KNOBS->MAX_WRITE_TRANSACTION_LIFE_VERSIONS;
|
||||
Version newOldestVersion = req.version - SERVER_KNOBS->MAX_WRITE_TRANSACTION_LIFE_VERSIONS;
|
||||
if (g_network->isSimulated() && g_simulator->speedUpSimulation) {
|
||||
newOldestVersion = req.version - std::max(5 * SERVER_KNOBS->VERSIONS_PER_SECOND,
|
||||
SERVER_KNOBS->MAX_WRITE_TRANSACTION_LIFE_VERSIONS);
|
||||
}
|
||||
for (int t = 0; t < req.transactions.size(); t++) {
|
||||
conflictBatch.addTransaction(req.transactions[t], newOldestVersion);
|
||||
self->resolvedReadConflictRanges += req.transactions[t].read_conflict_ranges.size();
|
||||
|
|
Loading…
Reference in New Issue