diff --git a/tests/cppunit/compact_test.cc b/tests/cppunit/compact_test.cc index 5efa41de661..42ae3907909 100644 --- a/tests/cppunit/compact_test.cc +++ b/tests/cppunit/compact_test.cc @@ -48,12 +48,14 @@ TEST(Compact, Filter) { usleep(10000); hash->Set(live_hash_key, "f1", "v1", &ret); hash->Set(live_hash_key, "f2", "v2", &ret); + + auto status = storage->Compact(nullptr, nullptr); + assert(status.ok()); // Compact twice to workaround issue fixed by: https://github.com/facebook/rocksdb/pull/11468 // before rocksdb/speedb 8.1.1. This line can be removed after speedb upgraded above 8.1.1. status = storage->Compact(nullptr, nullptr); assert(status.ok()); - auto status = storage->Compact(nullptr, nullptr); - assert(status.ok()); + rocksdb::DB* db = storage->GetDB(); rocksdb::ReadOptions read_options; read_options.snapshot = db->GetSnapshot();