diff --git a/cpp/cdc/CDCDB.cpp b/cpp/cdc/CDCDB.cpp index 3e495132..598b388b 100644 --- a/cpp/cdc/CDCDB.cpp +++ b/cpp/cdc/CDCDB.cpp @@ -1730,7 +1730,7 @@ struct CDCDBImpl { { // Additional safety check: the key is what we expect. auto foundKey = ExternalValue::FromSlice(it->key()); - ALWAYS_ASSERT(!foundKey().isSentinel() && foundKey().txnId() == txnId); + ALWAYS_ASSERT(foundKey().dirId() == dirId && !foundKey().isSentinel() && foundKey().txnId() == txnId); } // now that we've done our checks, we can remove the key ROCKS_DB_CHECKED(dbTxn.Delete(_dirsToTxnsCf, k.toSlice())); @@ -1743,23 +1743,13 @@ struct CDCDBImpl { bool removeSentinel = true; if (it->Valid()) { // there's something, set the sentinel auto nextK = ExternalValue::FromSlice(it->key()); - // This should never happen, since we specify the upper bound. - // However the RocksDB that we use is buggy, see - // . - // To be removed on upgrade. - 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 { + ALWAYS_ASSERT(nextK().dirId() == dirId); // must be true given the upper bound + 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 ROCKS_DB_CHECKED(it->status()); - } - if (removeSentinel) { // we were the last ones here, remove sentinel ROCKS_DB_CHECKED(dbTxn.Delete(_dirsToTxnsCf, sentinelK.toSlice())); } } diff --git a/cpp/tests/tests.cpp b/cpp/tests/tests.cpp index 44b2863d..9395e3b6 100644 --- a/cpp/tests/tests.cpp +++ b/cpp/tests/tests.cpp @@ -413,6 +413,9 @@ struct TempShardDB { } ~TempShardDB() { + db.reset(); + blockServicesCacheDB.reset(); + sharedDB.reset(); std::error_code err; if (std::filesystem::remove_all(std::filesystem::path(dbDir), err) < 0) { std::cerr << "Could not remove " << dbDir << ": " << err << std::endl; diff --git a/cpp/tests/utils/TempBlockServicesCacheDB.hpp b/cpp/tests/utils/TempBlockServicesCacheDB.hpp index 801ea2d4..760676f0 100644 --- a/cpp/tests/utils/TempBlockServicesCacheDB.hpp +++ b/cpp/tests/utils/TempBlockServicesCacheDB.hpp @@ -27,6 +27,7 @@ struct TempBlockServicesCacheDB { } ~TempBlockServicesCacheDB() { + sharedDB.reset(); std::error_code err; std::filesystem::remove_all(std::filesystem::path(dbDir), err); } diff --git a/cpp/tests/utils/TempLogsDB.hpp b/cpp/tests/utils/TempLogsDB.hpp index 2151e575..8c596159 100644 --- a/cpp/tests/utils/TempLogsDB.hpp +++ b/cpp/tests/utils/TempLogsDB.hpp @@ -52,6 +52,9 @@ struct TempLogsDB { } ~TempLogsDB() { + db.reset(); + sharedDB.reset(); + std::error_code err; if (std::filesystem::remove_all(std::filesystem::path(dbDir), err) < 0) { std::cerr << "Could not remove " << dbDir << ": " << err << std::endl; diff --git a/cpp/tests/utils/TempRegistryDB.hpp b/cpp/tests/utils/TempRegistryDB.hpp index ed69afd7..15efde57 100644 --- a/cpp/tests/utils/TempRegistryDB.hpp +++ b/cpp/tests/utils/TempRegistryDB.hpp @@ -50,6 +50,8 @@ struct TempRegistryDB { } ~TempRegistryDB() { + db.reset(); + sharedDB.reset(); std::error_code err; if (std::filesystem::remove_all(std::filesystem::path(dbDir), err) < 0) { std::cerr << "Could not remove " << dbDir << ": " << err << std::endl; diff --git a/cpp/thirdparty.cmake b/cpp/thirdparty.cmake index f5a7562d..468c28f6 100644 --- a/cpp/thirdparty.cmake +++ b/cpp/thirdparty.cmake @@ -115,8 +115,8 @@ separate_arguments( ) ExternalProject_Add(make_rocksdb DOWNLOAD_DIR ${THIRDPARTY_DOWNLOAD_DIR} - URL https://github.com/facebook/rocksdb/archive/refs/tags/v7.9.2.tar.gz - URL_HASH SHA256=886378093098a1b2521b824782db7f7dd86224c232cf9652fcaf88222420b292 + URL https://github.com/facebook/rocksdb/archive/refs/tags/v10.10.1.tar.gz + URL_HASH SHA256=df2ff348f3fac8578fd4b727eee7267aaf90cd403c99b55e898d1db63fa8cff5 DOWNLOAD_NAME rocksdb.tar.gz PREFIX thirdparty/rocksdb UPDATE_COMMAND ""