Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
oceanbase
oceanbase
提交
bac35408
O
oceanbase
项目概览
oceanbase
/
oceanbase
2 年多 前同步成功
通知
262
Star
6084
Fork
1301
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
bac35408
编写于
11月 12, 2025
作者:
L
LiefB
提交者:
ob-robot
11月 12, 2025
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CP] fix macro cache gc about transfer out
上级
33d4fae5
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
43 addition
and
17 deletion
+43
-17
mittest/shared_storage/simple_server/test_inc_shared_storage_gc.cpp
...ared_storage/simple_server/test_inc_shared_storage_gc.cpp
+10
-4
mittest/shared_storage/simple_server/test_macro_cache_multi_version_gc.cpp
...orage/simple_server/test_macro_cache_multi_version_gc.cpp
+7
-4
mittest/shared_storage/simple_server/test_shared_storage_ls_gc.cpp
...hared_storage/simple_server/test_shared_storage_ls_gc.cpp
+10
-3
src/storage/meta_mem/ob_tenant_meta_mem_mgr.cpp
src/storage/meta_mem/ob_tenant_meta_mem_mgr.cpp
+10
-3
src/storage/meta_mem/ob_tenant_meta_mem_mgr.h
src/storage/meta_mem/ob_tenant_meta_mem_mgr.h
+2
-1
unittest/storage/test_block_gc_handler.cpp
unittest/storage/test_block_gc_handler.cpp
+4
-2
未找到文件。
mittest/shared_storage/simple_server/test_inc_shared_storage_gc.cpp
浏览文件 @
bac35408
...
...
@@ -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
);
...
...
mittest/shared_storage/simple_server/test_macro_cache_multi_version_gc.cpp
浏览文件 @
bac35408
...
...
@@ -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
));
}
...
...
mittest/shared_storage/simple_server/test_shared_storage_ls_gc.cpp
浏览文件 @
bac35408
...
...
@@ -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
;
...
...
src/storage/meta_mem/ob_tenant_meta_mem_mgr.cpp
浏览文件 @
bac35408
...
...
@@ -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
)
);
}
}
}
...
...
src/storage/meta_mem/ob_tenant_meta_mem_mgr.h
浏览文件 @
bac35408
...
...
@@ -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
,
...
...
unittest/storage/test_block_gc_handler.cpp
浏览文件 @
bac35408
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录