Skip to content

Commit 40b0bc2

Browse files
committed
Delete iterator in replication_test
1 parent 68c758a commit 40b0bc2

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

cloud/replication_test.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1315,13 +1315,15 @@ TEST_F(ReplicationTest, SuperSnapshot) {
13151315
ASSERT_OK(follower->Get(ro, "k1", &val));
13161316
EXPECT_EQ(val, "v1");
13171317

1318-
auto iter = follower->NewIterator(ro, follower->DefaultColumnFamily());
1318+
auto iter = std::unique_ptr<rocksdb::Iterator>(
1319+
follower->NewIterator(ro, follower->DefaultColumnFamily()));
13191320
iter->SeekToFirst();
13201321
EXPECT_TRUE(iter->Valid());
13211322
EXPECT_EQ(iter->key(), "k1");
13221323
EXPECT_EQ(iter->value(), "v1");
13231324
iter->Next();
13241325
EXPECT_FALSE(iter->Valid());
1326+
iter.reset();
13251327

13261328
ro.snapshot = nullptr;
13271329
ASSERT_OK(follower->Get(ro, followerCF("cf1"), "cf1k1", &val));

db/db_impl/db_impl.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4077,6 +4077,8 @@ Status DBImpl::GetSuperSnapshots(
40774077
return Status::InvalidArgument(
40784078
"GetSuperSnapshots only supported in RocksDB compiled with USE_RTTI=1");
40794079
#endif
4080+
InstrumentedMutexLock l(&mutex_);
4081+
40804082
if (!is_snapshot_supported_) {
40814083
return Status::InvalidArgument("Snapshot not supported");
40824084
}
@@ -4092,7 +4094,8 @@ Status DBImpl::GetSuperSnapshots(
40924094
for (auto& cf : column_families) {
40934095
auto cfh = static_cast_with_check<ColumnFamilyHandleImpl>(cf);
40944096
auto cfd = cfh->cfd();
4095-
auto sv = cfd->GetReferencedSuperVersion(this);
4097+
auto sv = cfd->GetSuperVersion();
4098+
sv->Ref();
40964099
auto ss = new SuperSnapshotImpl(cfd, sv);
40974100
snapshots_.New(ss, snapshot_seq, unix_time,
40984101
/*is_write_conflict_boundary=*/false);

0 commit comments

Comments
 (0)