mirror of
https://github.com/XTXMarkets/ternfs.git
synced 2026-05-06 20:31:17 -05:00
Do not trust RocksDB upper bound
This commit is contained in:
+13
-5
@@ -1698,14 +1698,22 @@ struct CDCDBImpl {
|
||||
sentinelK().setDirId(dirId);
|
||||
sentinelK().setSentinel();
|
||||
it->Next();
|
||||
bool removeSentinel = true;
|
||||
if (it->Valid()) { // there's something, set the sentinel
|
||||
auto nextK = ExternalValue<DirsToTxnsKey>::FromSlice(it->key());
|
||||
auto sentinelV = CDCTxnIdValue::Static(nextK().txnId());
|
||||
LOG_DEBUG(_env, "selected %s as next in line after finishing %s", nextK().txnId(), txnId);
|
||||
mightBeReady.emplace_back(nextK().txnId());
|
||||
ROCKS_DB_CHECKED(dbTxn.Put(_dirsToTxnsCf, sentinelK.toSlice(), sentinelV.toSlice()));
|
||||
} else { // we were the last ones here, remove sentinel
|
||||
if (nextK().dirId() == dirId) {
|
||||
removeSentinel = false;
|
||||
auto sentinelV = CDCTxnIdValue::Static(nextK().txnId());
|
||||
LOG_DEBUG(_env, "selected %s as next in line after finishing %s", nextK().txnId(), txnId);
|
||||
mightBeReady.emplace_back(nextK().txnId());
|
||||
ROCKS_DB_CHECKED(dbTxn.Put(_dirsToTxnsCf, sentinelK.toSlice(), sentinelV.toSlice()));
|
||||
} else {
|
||||
RAISE_ALERT_APP_TYPE(_env, XmonAppType::DAYTIME, "Unexpectedly stepped from %s to %s, is RocksDB not respecting our upper bound?", dirId, nextK().dirId());
|
||||
}
|
||||
} else {
|
||||
ROCKS_DB_CHECKED(it->status());
|
||||
}
|
||||
if (removeSentinel) { // we were the last ones here, remove sentinel
|
||||
ROCKS_DB_CHECKED(dbTxn.Delete(_dirsToTxnsCf, sentinelK.toSlice()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user