[MDS] avoid hold mds_unit's lock when lock_for_read

This commit is contained in:
fengdeyiji
2023-09-21 04:10:19 +00:00
committed by ob-robot
parent cf0ffafe1b
commit d23c31fd93
9 changed files with 526 additions and 242 deletions

View File

@ -627,6 +627,20 @@ TEST_F(TestMdsTable, test_rw_lock_wwlock) {
t2.join();
}
TEST_F(TestMdsTable, test_rvalue_set) {
ExampleUserData2 data;
ASSERT_EQ(OB_SUCCESS, data.assign(MdsAllocator::get_instance(), "123"));
MdsCtx ctx(mds::MdsWriter(ObTransID(100)));
ObString str = data.data_;
ASSERT_EQ(OB_SUCCESS, mds_table_.set(std::move(data), ctx, 0));
bool is_committed = false;
ASSERT_EQ(OB_SUCCESS, mds_table_.get_latest<ExampleUserData2>([&data, str](const ExampleUserData2 &read_data) -> int {
MDS_ASSERT(data.data_ == nullptr);
MDS_ASSERT(str.ptr() == read_data.data_.ptr());
return OB_SUCCESS;
}, is_committed));
}
}
}