From 0bf47a91eb05d32d4446dd40d73c9501e6c03790 Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Fri, 20 Oct 2023 10:09:47 +0000 Subject: [PATCH] Delete iterator in replication_test --- cloud/replication_test.cc | 4 +++- db/db_impl/db_impl.cc | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cloud/replication_test.cc b/cloud/replication_test.cc index 740054735b61..0adb9af20e84 100644 --- a/cloud/replication_test.cc +++ b/cloud/replication_test.cc @@ -1315,13 +1315,15 @@ TEST_F(ReplicationTest, SuperSnapshot) { ASSERT_OK(follower->Get(ro, "k1", &val)); EXPECT_EQ(val, "v1"); - auto iter = follower->NewIterator(ro, follower->DefaultColumnFamily()); + auto iter = std::unique_ptr( + follower->NewIterator(ro, follower->DefaultColumnFamily())); iter->SeekToFirst(); EXPECT_TRUE(iter->Valid()); EXPECT_EQ(iter->key(), "k1"); EXPECT_EQ(iter->value(), "v1"); iter->Next(); EXPECT_FALSE(iter->Valid()); + iter.reset(); ro.snapshot = nullptr; ASSERT_OK(follower->Get(ro, followerCF("cf1"), "cf1k1", &val)); diff --git a/db/db_impl/db_impl.cc b/db/db_impl/db_impl.cc index 2af3fcf42bed..f8e4267252e2 100644 --- a/db/db_impl/db_impl.cc +++ b/db/db_impl/db_impl.cc @@ -4077,6 +4077,8 @@ Status DBImpl::GetSuperSnapshots( return Status::InvalidArgument( "GetSuperSnapshots only supported in RocksDB compiled with USE_RTTI=1"); #endif + InstrumentedMutexLock l(&mutex_); + if (!is_snapshot_supported_) { return Status::InvalidArgument("Snapshot not supported"); }