Fix open granule races

This commit is contained in:
Josh Slocum 2022-01-21 13:12:16 -06:00
parent 269dfb79cf
commit 558779d782
2 changed files with 3 additions and 10 deletions

View File

@ -30,17 +30,8 @@
// Gets the latest granule history node for range that was persisted
ACTOR Future<Optional<GranuleHistory>> getLatestGranuleHistory(Transaction* tr, KeyRange range) {
state KeyRange historyRange = blobGranuleHistoryKeyRangeFor(range);
state RangeResult result;
state RangeResult result = wait(tr->getRange(historyRange, 1, Snapshot::False, Reverse::True));
loop {
try {
RangeResult _result = wait(tr->getRange(historyRange, 1, Snapshot::False, Reverse::True));
result = _result;
break;
} catch (Error& e) {
wait(tr->onError(e));
}
}
ASSERT(result.size() <= 1);
Optional<GranuleHistory> history;

View File

@ -119,6 +119,8 @@ struct GranuleRangeMetadata {
activeMetadata->cancelled.send(Void());
}
activeMetadata.clear();
assignFuture.cancel();
historyLoaderFuture.cancel();
}
GranuleRangeMetadata() : lastEpoch(0), lastSeqno(0) {}