提交 bac35408 编写于 作者: L LiefB 提交者: ob-robot

[CP] fix macro cache gc about transfer out

上级 33d4fae5
......@@ -437,13 +437,15 @@ void ObSharedStorageTest::check_block_for_private_dir(
int64_t last_gc_version = -1;
uintptr_t tablet_fingerprint = 0;
bool is_old_version_empty = false;
bool is_transfer_out_deleted = false;
ASSERT_EQ(OB_SUCCESS, MTL(ObTenantMetaMemMgr*)->get_current_version_for_tablet(RunCtx.ls_id_,
RunCtx.tablet_id_,
current_tablet_version,
last_gc_version,
current_tablet_transfer_seq,
tablet_fingerprint,
is_old_version_empty));
is_old_version_empty,
is_transfer_out_deleted));
ASSERT_NE(-1, current_tablet_version);
ASSERT_GE(last_gc_version, -1);
ASSERT_LT(last_gc_version, current_tablet_version);
......@@ -453,7 +455,8 @@ void ObSharedStorageTest::check_block_for_private_dir(
tablet_version,
last_gc_version,
current_tablet_transfer_seq,
tablet_fingerprint);
tablet_fingerprint,
is_transfer_out_deleted);
ObArray<blocksstable::MacroBlockId> block_ids_in_tablet;
ObArray<blocksstable::MacroBlockId> unuse_block_ids;
ObArray<blocksstable::MacroBlockId> block_ids_in_dir;
......@@ -525,6 +528,7 @@ void ObSharedStorageTest::get_tablet_version(
int64_t current_tablet_transfer_seq = -1;
int64_t last_gc_version = -1;
uintptr_t tablet_fingerprint = 0;
bool is_transfer_out_deleted = false;
do {
ASSERT_EQ(OB_SUCCESS, MTL(ObTenantMetaMemMgr*)->get_current_version_for_tablet(RunCtx.ls_id_,
RunCtx.tablet_id_,
......@@ -532,7 +536,8 @@ void ObSharedStorageTest::get_tablet_version(
last_gc_version,
current_tablet_transfer_seq,
tablet_fingerprint,
is_old_version_empty));
is_old_version_empty,
is_transfer_out_deleted));
ASSERT_NE(-1, current_tablet_version);
ASSERT_GE(last_gc_version, -1);
ASSERT_LT(last_gc_version, current_tablet_version);
......@@ -544,7 +549,8 @@ void ObSharedStorageTest::get_tablet_version(
current_tablet_version,
last_gc_version,
current_tablet_transfer_seq,
tablet_fingerprint);
tablet_fingerprint,
is_transfer_out_deleted);
LOG_INFO("wait old tablet version delete", K(current_tablet_version), K(is_old_version_empty), K(RunCtx.ls_id_), K(RunCtx.ls_epoch_), K(handler));
ASSERT_EQ(OB_SUCCESS, handler.list_tablet_meta_version(tablet_versions));
usleep(100 * 1000);
......
......@@ -195,10 +195,11 @@ void ObMacroCacheMultiVersionGCTest::get_tablet_version(int64_t &tablet_version)
int64_t current_tablet_trans_seq = -1;
int64_t last_gc_version = -1;
uintptr_t tablet_fingerprint = 0;
bool is_transfer_out_deleted = false;
do {
ASSERT_EQ(OB_SUCCESS, MTL(ObTenantMetaMemMgr*)->get_current_version_for_tablet(run_ctx_.ls_id_,
run_ctx_.tablet_id_, current_tablet_version, last_gc_version, current_tablet_trans_seq,
tablet_fingerprint, is_old_version_empty));
tablet_fingerprint, is_old_version_empty, is_transfer_out_deleted));
ASSERT_NE(-1, current_tablet_version);
ASSERT_GE(last_gc_version, -1);
ASSERT_LT(last_gc_version, current_tablet_version);
......@@ -206,7 +207,8 @@ void ObMacroCacheMultiVersionGCTest::get_tablet_version(int64_t &tablet_version)
ObPrivateBlockGCHandler handler(run_ctx_.ls_id_, run_ctx_.ls_epoch_, run_ctx_.tablet_id_,
current_tablet_version, last_gc_version,
current_tablet_trans_seq, tablet_fingerprint);
current_tablet_trans_seq, tablet_fingerprint,
is_transfer_out_deleted);
LOG_INFO("wait old tablet version delete", K(current_tablet_version), K(is_old_version_empty),
K(run_ctx_.ls_id_), K(run_ctx_.ls_epoch_), K(handler));
ASSERT_EQ(OB_SUCCESS, handler.list_tablet_meta_version(tablet_versions));
......@@ -223,9 +225,10 @@ void ObMacroCacheMultiVersionGCTest::get_shared_blocks_for_tablet(
int64_t current_tablet_trans_seq = -1;
int64_t last_gc_version = -1;
uintptr_t tablet_fingerprint = 0;
bool is_transfer_out_deleted = false;
ASSERT_EQ(OB_SUCCESS, MTL(ObTenantMetaMemMgr*)->get_current_version_for_tablet(run_ctx_.ls_id_,
run_ctx_.tablet_id_, current_tablet_version, last_gc_version, current_tablet_trans_seq,
tablet_fingerprint, is_old_version_empty));
tablet_fingerprint, is_old_version_empty, is_transfer_out_deleted));
ASSERT_NE(-1, current_tablet_version);
ASSERT_TRUE(is_old_version_empty);
ASSERT_GE(last_gc_version, -1);
......@@ -233,7 +236,7 @@ void ObMacroCacheMultiVersionGCTest::get_shared_blocks_for_tablet(
ObPrivateBlockGCHandler handler(run_ctx_.ls_id_, run_ctx_.ls_epoch_, run_ctx_.tablet_id_,
current_tablet_version, last_gc_version, current_tablet_trans_seq,
tablet_fingerprint);
tablet_fingerprint, is_transfer_out_deleted);
ASSERT_EQ(OB_SUCCESS, handler.get_blocks_for_tablet(current_tablet_version, true/*is_shared*/, block_ids));
LOG_INFO("get shared blocks for tablet", K(block_ids));
}
......
......@@ -430,14 +430,19 @@ void ObSharedStorageTest::get_tablet_version(
int64_t current_tablet_version = -1;
int64_t current_tablet_trans_seq = -1;
uintptr_t tablet_fingerprint = 0;
bool is_transfer_out_deleted = false;
do {
ASSERT_EQ(OB_SUCCESS, MTL(ObTenantMetaMemMgr*)->get_current_version_for_tablet(RunCtx.ls_id_, RunCtx.tablet_id_, current_tablet_version, last_gc_version, current_tablet_trans_seq, tablet_fingerprint, is_old_version_empty));
ASSERT_EQ(OB_SUCCESS, MTL(ObTenantMetaMemMgr*)->get_current_version_for_tablet(RunCtx.ls_id_,
RunCtx.tablet_id_, current_tablet_version, last_gc_version, current_tablet_trans_seq,
tablet_fingerprint, is_old_version_empty, is_transfer_out_deleted));
ASSERT_NE(-1, current_tablet_version);
ASSERT_GE(last_gc_version, -1);
ASSERT_LT(last_gc_version, current_tablet_version);
if (!is_old_version_empty) continue;
ObPrivateBlockGCHandler handler(RunCtx.ls_id_, RunCtx.ls_epoch_, RunCtx.tablet_id_, current_tablet_version, last_gc_version, current_tablet_trans_seq, tablet_fingerprint);
ObPrivateBlockGCHandler handler(RunCtx.ls_id_, RunCtx.ls_epoch_, RunCtx.tablet_id_,
current_tablet_version, last_gc_version, current_tablet_trans_seq,
tablet_fingerprint, is_transfer_out_deleted);
LOG_INFO("wait old tablet version delete", K(current_tablet_version), K(last_gc_version), K(is_old_version_empty), K(RunCtx.ls_id_), K(RunCtx.ls_epoch_), K(handler));
ASSERT_EQ(OB_SUCCESS, handler.list_tablet_meta_version(tablet_versions));
usleep(100 * 1000);
......@@ -470,7 +475,9 @@ void ObSharedStorageTest::check_block_for_private_dir(
const int64_t tablet_version)
{
ObPrivateBlockGCHandler handler(RunCtx.ls_id_, RunCtx.ls_epoch_, RunCtx.tablet_id_, tablet_version, -1/*last_gc_version*/, 0 /*transfer_seq*/, 0/*tablet_fingerprint*/);
ObPrivateBlockGCHandler handler(RunCtx.ls_id_, RunCtx.ls_epoch_, RunCtx.tablet_id_, tablet_version,
-1/*last_gc_version*/, 0 /*transfer_seq*/, 0/*tablet_fingerprint*/,
false/*is_transfer_out_deleted*/);
ObArray<blocksstable::MacroBlockId> block_ids_in_tablet;
ObArray<blocksstable::MacroBlockId> unuse_block_ids;
ObArray<blocksstable::MacroBlockId> block_ids_in_dir;
......
......@@ -1884,6 +1884,7 @@ int ObTenantMetaMemMgr::get_current_version_for_tablet(
int64_t unused_arg1 = 0;
uintptr_t unused_arg2 = 0;
bool unused_arg3 = false;
bool unused_arg4 = false;
tablet_version = 0;
return get_current_version_for_tablet(ls_id,
tablet_id,
......@@ -1891,7 +1892,8 @@ int ObTenantMetaMemMgr::get_current_version_for_tablet(
unused_arg0,
unused_arg1,
unused_arg2,
unused_arg3);
unused_arg3,
unused_arg4);
}
int ObTenantMetaMemMgr::get_current_version_for_tablet(
......@@ -1901,7 +1903,8 @@ int ObTenantMetaMemMgr::get_current_version_for_tablet(
int64_t &last_gc_version,
int64_t &tablet_private_transfer_epoch,
uintptr_t &tablet_fingerprint,
bool &allow_tablet_version_gc)
bool &allow_tablet_version_gc,
bool &is_transfer_out_deleted)
{
int ret = OB_SUCCESS;
const ObTabletMapKey key(ls_id, tablet_id);
......@@ -1946,8 +1949,12 @@ int ObTenantMetaMemMgr::get_current_version_for_tablet(
tablet_private_transfer_epoch = tablet_ptr->get_addr().block_id().meta_private_transfer_epoch();
allow_tablet_version_gc = tablet_ptr->is_old_version_chain_empty() && !exist_in_external;
OB_ASSERT(tablet_private_transfer_epoch == private_transfer_epoch);
const ObTabletStatus tablet_status = tablet_handle.get_obj()->get_tablet_meta().last_persisted_committed_tablet_status_.get_tablet_status();
if (tablet_handle.get_obj()->is_empty_shell() && (ObTabletStatus::TRANSFER_OUT_DELETED == tablet_status)) {
is_transfer_out_deleted = true;
}
FLOG_INFO("PRINT TABLET ADDRESS", K(ret), K(tablet_ptr->get_addr()), K(tablet_handle.get_obj()->get_tablet_addr()),
K(tablet_version), K(last_gc_version), K(tablet_fingerprint));
K(tablet_version), K(last_gc_version), K(tablet_fingerprint), K(is_transfer_out_deleted));
}
}
}
......
......@@ -291,7 +291,8 @@ public:
int64_t &last_gc_version,
int64_t &tablet_private_transfer_epoch,
uintptr_t &tablet_fingerprint,
bool &allow_tablet_version_gc);
bool &allow_tablet_version_gc,
bool &is_transfer_out_deleted);
int get_last_gc_version_for_tablet(
const share::ObLSID &ls_id,
const ObTabletID &tablet_id,
......
......@@ -117,7 +117,9 @@ TEST_F(TestBlockGCHandler, test_block_gc)
for (int i = 0; i < 3; i++) {
ASSERT_EQ(OB_SUCCESS, tablet_versions.push_back(i));
}
ASSERT_EQ(OB_SUCCESS, gc_tablet_meta_versions(tablet_versions, 2));
ASSERT_EQ(OB_SUCCESS, gc_tablet_meta_versions(tablet_versions,
2/*min_retain_tablet_meta_version*/,
false/*is_transfer_out_deleted*/));
ASSERT_EQ(gc_blocks_.count(), 3);
for (int i = 0; i < gc_blocks_.count(); i++) {
if (1 == gc_blocks_.at(i).second_id_
......@@ -129,7 +131,7 @@ TEST_F(TestBlockGCHandler, test_block_gc)
reset();
macro_block_ids_ = test_array;
ASSERT_EQ(OB_SUCCESS, gc_tablet(tablet_versions));
ASSERT_EQ(OB_SUCCESS, gc_tablet(tablet_versions, GCTabletType::DropTablet));
ASSERT_EQ(gc_blocks_.count(), 6);
for (int i = 0; i < gc_blocks_.count(); i++) {
if (1 == gc_blocks_.at(i).second_id_
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册