add sys log for macro ref diagnosis

This commit is contained in:
obdev 2024-02-07 21:10:12 +00:00 committed by ob-robot
parent 8f9deca4f3
commit 848c4c4fd2
2 changed files with 54 additions and 0 deletions

View File

@ -2360,6 +2360,8 @@ int ObTablet::inc_ref_with_macro_iter(ObMacroInfoIterator &macro_iter, bool &inc
int inc_other_ref_cnt = 0;
ObTabletBlockInfo block_info;
inc_success = false;
ObSArray<MacroBlockId> print_arr;
print_arr.set_attr(ObMemAttr(MTL_ID(), "PrintId", ObCtxIds::DEFAULT_CTX_ID));
while (OB_SUCC(ret)) {
block_info.reset();
if (OB_FAIL(macro_iter.get_next(block_info))) {
@ -2373,7 +2375,24 @@ int ObTablet::inc_ref_with_macro_iter(ObMacroInfoIterator &macro_iter, bool &inc
&& OB_FAIL(MTL(ObSharedMacroBlockMgr*)->add_block(block_info.macro_id_, block_info.occupy_size_))) {
LOG_WARN("fail to add block", K(ret), K(block_info));
}
#ifndef OB_BUILD_RPM
int tmp_ret = OB_SUCCESS;
if (OB_FAIL(ret)) {
// do nothing
} else if (OB_TMP_FAIL(print_arr.push_back(block_info.macro_id_))) {
LOG_WARN("fail to push macro id into print array", K(tmp_ret));
} else if (MAX_PRINT_COUNT == print_arr.size()) {
FLOG_INFO("increase tablet's macro ref", K(ret), K(print_arr));
print_arr.reuse();
}
#endif
}
#ifndef OB_BUILD_RPM
if (0 != print_arr.count()) {
FLOG_INFO("increase tablet's macro ref", K(ret), K(print_arr));
print_arr.reuse();
}
#endif
if (OB_LIKELY(OB_ITER_END == ret) || OB_SUCC(ret)) {
inc_success = true;
@ -2393,7 +2412,23 @@ int ObTablet::inc_ref_with_macro_iter(ObMacroInfoIterator &macro_iter, bool &inc
&& OB_TMP_FAIL(MTL(ObSharedMacroBlockMgr*)->free_block(block_info.macro_id_, block_info.occupy_size_))) {
LOG_WARN("fail to free block", K(ret), K(block_info));
}
#ifndef OB_BUILD_RPM
if (OB_FAIL(tmp_ret)) {
// do nothing
} else if (OB_TMP_FAIL(print_arr.push_back(block_info.macro_id_))) {
LOG_WARN("fail to push macro id into print array", K(tmp_ret));
} else if (MAX_PRINT_COUNT == print_arr.size()) {
FLOG_INFO("decrease tablet's macro ref", K(ret), K(print_arr));
print_arr.reuse();
}
#endif
}
#ifndef OB_BUILD_RPM
if (0 != print_arr.count()) {
FLOG_INFO("decrease tablet's macro ref", K(ret), K(print_arr));
print_arr.reuse();
}
#endif
}
}
@ -2572,6 +2607,8 @@ void ObTablet::dec_ref_with_macro_iter(ObMacroInfoIterator &macro_iter) const
{
int ret = OB_SUCCESS;
ObTabletBlockInfo block_info;
ObSArray<MacroBlockId> print_arr;
print_arr.set_attr(ObMemAttr(MTL_ID(), "PrintId", ObCtxIds::DEFAULT_CTX_ID));
while (OB_SUCC(ret)) {
block_info.reset();
if (OB_FAIL(macro_iter.get_next(block_info))) {
@ -2585,12 +2622,28 @@ void ObTablet::dec_ref_with_macro_iter(ObMacroInfoIterator &macro_iter) const
&& OB_FAIL(MTL(ObSharedMacroBlockMgr*)->free_block(block_info.macro_id_, block_info.occupy_size_))) {
LOG_WARN("fail to add block", K(ret), K(block_info));
}
int tmp_ret = OB_SUCCESS;
if (OB_FAIL(ret)) {
ret = OB_SUCCESS;
// ignore ret, continue
} else {
#ifndef OB_BUILD_RPM
if (OB_TMP_FAIL(print_arr.push_back(block_info.macro_id_))) {
LOG_WARN("fail to push macro id into print array", K(tmp_ret));
} else if (MAX_PRINT_COUNT == print_arr.size()) {
FLOG_INFO("decrease tablet's macro ref", K(ret), K(print_arr));
print_arr.reuse();
}
#endif
}
}
}
#ifndef OB_BUILD_RPM
if (0 != print_arr.size()) {
FLOG_INFO("decrease tablet's macro ref", K(ret), K(print_arr));
print_arr.reuse();
}
#endif
}
int ObTablet::inc_table_store_ref_cnt(bool &inc_success)

View File

@ -827,6 +827,7 @@ private:
static const int64_t DDL_KV_ARRAY_SIZE = 64;
static const int64_t ON_DEMAND_LOAD_SIZE = 4096; //4k
static const int64_t SHARED_MACRO_BUCKET_CNT = 100;
static const int64_t MAX_PRINT_COUNT = 100;
private:
int32_t version_;
int32_t length_;