Bug fix. The snapshot dispatch add task retry loop was incorrectly deciding that the second and further transaction of an execution was already committed and therefore skipping it, resulting in missing ranges in the snapshot.
This commit is contained in:
parent
afd2603576
commit
2b92815e8c
|
@ -1197,7 +1197,6 @@ namespace fileBackup {
|
||||||
|
|
||||||
shardMap.coalesce(normalKeys);
|
shardMap.coalesce(normalKeys);
|
||||||
|
|
||||||
|
|
||||||
// In this context "all" refers to all of the shards relevant for this particular backup
|
// In this context "all" refers to all of the shards relevant for this particular backup
|
||||||
state int countAllShards = countShardsDone + countShardsNotDone;
|
state int countAllShards = countShardsDone + countShardsNotDone;
|
||||||
|
|
||||||
|
@ -1244,8 +1243,6 @@ namespace fileBackup {
|
||||||
state std::vector<KeyRange> rangesToAdd;
|
state std::vector<KeyRange> rangesToAdd;
|
||||||
int added = 0;
|
int added = 0;
|
||||||
while(countShardsToDispatch > 0 && added < taskBatchSize && shardMap.size() > 0) {
|
while(countShardsToDispatch > 0 && added < taskBatchSize && shardMap.size() > 0) {
|
||||||
|
|
||||||
|
|
||||||
// Get a random range.
|
// Get a random range.
|
||||||
auto it = shardMap.randomRange();
|
auto it = shardMap.randomRange();
|
||||||
// Find a NOT_DONE range and add it to rangesToAdd
|
// Find a NOT_DONE range and add it to rangesToAdd
|
||||||
|
@ -1267,6 +1264,8 @@ namespace fileBackup {
|
||||||
}
|
}
|
||||||
|
|
||||||
state int64_t oldBatchSize = snapshotBatchSize.get();
|
state int64_t oldBatchSize = snapshotBatchSize.get();
|
||||||
|
state int64_t newBatchSize = oldBatchSize + rangesToAdd.size();
|
||||||
|
|
||||||
// Now add the ranges in a single transaction
|
// Now add the ranges in a single transaction
|
||||||
tr->reset();
|
tr->reset();
|
||||||
loop {
|
loop {
|
||||||
|
@ -1286,15 +1285,15 @@ namespace fileBackup {
|
||||||
Void _ = wait(store(config.snapshotBatchSize().getOrThrow(tr), snapshotBatchSize.get())
|
Void _ = wait(store(config.snapshotBatchSize().getOrThrow(tr), snapshotBatchSize.get())
|
||||||
&& waitForAll(beginReads) && waitForAll(endReads) && taskBucket->keepRunning(tr, task));
|
&& waitForAll(beginReads) && waitForAll(endReads) && taskBucket->keepRunning(tr, task));
|
||||||
|
|
||||||
// If the snapshot batch size was already changed to oldBatchSize + rangesToAdd.size() then this transaction
|
// Snapshot batch size should be either oldBatchSize or newBatchSize. If new, this transaction is already done.
|
||||||
// was already committed
|
if(snapshotBatchSize.get() == newBatchSize) {
|
||||||
if(snapshotBatchSize.get() == oldBatchSize) {
|
break;
|
||||||
config.snapshotBatchSize().set(tr, oldBatchSize + rangesToAdd.size());
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ASSERT(snapshotBatchSize.get() == oldBatchSize + rangesToAdd.size());
|
ASSERT(snapshotBatchSize.get() == oldBatchSize);
|
||||||
break;
|
config.snapshotBatchSize().set(tr, newBatchSize);
|
||||||
}
|
snapshotBatchSize = newBatchSize;
|
||||||
|
}
|
||||||
|
|
||||||
// Count the undispatched ranges while checking the boundaries
|
// Count the undispatched ranges while checking the boundaries
|
||||||
int undispatchedRanges = 0;
|
int undispatchedRanges = 0;
|
||||||
|
|
Loading…
Reference in New Issue