make sure all meta released when the observer exits

This commit is contained in:
windye
2023-07-18 08:42:18 +00:00
committed by ob-robot
parent 928f831487
commit 9b0e6cd960
11 changed files with 183 additions and 164 deletions

View File

@ -177,12 +177,6 @@ void TestCompactionPolicy::SetUp()
{
ASSERT_TRUE(MockTenantModuleEnv::get_instance().is_inited());
int ret = OB_SUCCESS;
ObTenantMetaMemMgr *t3m = MTL(ObTenantMetaMemMgr*);
t3m->stop();
t3m->wait();
t3m->destroy();
ret = t3m->init();
ASSERT_EQ(OB_SUCCESS, ret);
share::schema::ObTableSchema table_schema;
prepare_schema(table_schema);
@ -202,9 +196,8 @@ void TestCompactionPolicy::TearDown()
memtables_.reset();
ObTenantMetaMemMgr *t3m = MTL(ObTenantMetaMemMgr*);
t3m->stop();
t3m->wait();
t3m->destroy();
bool all_released = false;
t3m->check_all_meta_mem_released(all_released, "TestCompactionPolicy");
ObTenantFreezeInfoMgr *freeze_info_mgr = MTL(ObTenantFreezeInfoMgr *);
ASSERT_TRUE(nullptr != freeze_info_mgr);
@ -229,21 +222,21 @@ void TestCompactionPolicy::SetUpTestCase()
if (OB_SUCCESS != ret) {
LOG_ERROR("[FATAL ERROR] failed to create ls", K(ret));
}
ASSERT_EQ(OB_SUCCESS, ret);
}
void TestCompactionPolicy::TearDownTestCase()
{
int ret = OB_SUCCESS;
ObTenantMetaMemMgr *t3m = MTL(ObTenantMetaMemMgr*);
t3m->stop();
t3m->wait();
t3m->destroy();
ret = t3m->init();
ASSERT_EQ(OB_SUCCESS, ret);
ret = MTL(ObLSService*)->remove_ls(ObLSID(TEST_LS_ID), false);
ASSERT_EQ(OB_SUCCESS, ret);
ObTenantMetaMemMgr *t3m = MTL(ObTenantMetaMemMgr*);
ASSERT_EQ(OB_SUCCESS, ret);
ObLSID ls_id = ObLSID(TEST_LS_ID);
ObTabletID tablet_id = ObTabletID(TEST_TABLET_ID);
ObTabletMapKey key(ls_id, tablet_id);
ASSERT_EQ(OB_SUCCESS, t3m->del_tablet(key));
MockTenantModuleEnv::get_instance().destroy();
}

View File

@ -141,12 +141,15 @@ protected:
virtual void TearDown() override
{
ctx_mt_mgr_->reset();
t3m_.destroy();
ls_tx_ctx_mgr_.reset();
delete mt_mgr_;
mt_mgr_ = NULL;
ctx_mt_mgr_ = NULL;
bool all_table_cleaned = false; // no use
ASSERT_EQ(OB_SUCCESS, t3m_.gc_tables_in_queue(all_table_cleaned));
t3m_.destroy();
ASSERT_EQ(0, ref_count_);
tenant_base_.destroy();