Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
大炮V587
oceanbase
提交
1c24d38f
O
oceanbase
项目概览
大炮V587
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
0
Fork
0
代码
文件
提交
分支
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1c24d38f
编写于
2月 06, 2023
作者:
O
obdev
提交者:
ob-robot
2月 06, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
optimize the performance of reporting tablet stat
上级
2c298301
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
41 addition
and
26 deletion
+41
-26
src/storage/compaction/ob_partition_merge_policy.cpp
src/storage/compaction/ob_partition_merge_policy.cpp
+4
-1
src/storage/compaction/ob_tablet_merge_task.cpp
src/storage/compaction/ob_tablet_merge_task.cpp
+2
-1
src/storage/ob_tenant_tablet_stat_mgr.cpp
src/storage/ob_tenant_tablet_stat_mgr.cpp
+29
-23
src/storage/ob_tenant_tablet_stat_mgr.h
src/storage/ob_tenant_tablet_stat_mgr.h
+5
-1
unittest/storage/test_tenant_tablet_stat_mgr.cpp
unittest/storage/test_tenant_tablet_stat_mgr.cpp
+1
-0
未找到文件。
src/storage/compaction/ob_partition_merge_policy.cpp
浏览文件 @
1c24d38f
...
...
@@ -1432,7 +1432,10 @@ int ObAdaptiveMergePolicy::get_adaptive_merge_reason(
if
(
AdaptiveMergeReason
::
NONE
==
reason
&&
OB_TMP_FAIL
(
check_ineffecient_read
(
tablet_stat
,
tablet
,
reason
)))
{
LOG_WARN
(
"failed to check ineffecient read"
,
K
(
tmp_ret
),
K
(
ls_id
),
K
(
tablet_id
));
}
LOG_INFO
(
"DanLing Check tablet adaptive merge reason"
,
K
(
reason
),
K
(
tablet_stat
));
// TODO tmp log, remove later
if
(
REACH_TENANT_TIME_INTERVAL
(
10
*
1000
*
1000
/*10s*/
))
{
LOG_INFO
(
"Check tablet adaptive merge reason"
,
K
(
reason
),
K
(
tablet_stat
));
// TODO tmp log, remove later
}
}
return
ret
;
}
...
...
src/storage/compaction/ob_tablet_merge_task.cpp
浏览文件 @
1c24d38f
...
...
@@ -1195,7 +1195,8 @@ int ObTabletMergeFinishTask::try_report_tablet_stat_after_mini(ObTabletMergeCtx
}
else
if
(
OB_FAIL
(
ObTableEstimator
::
estimate_row_count_for_scan
(
base_input
,
ranges
,
part_estimate
,
records
)))
{
LOG_WARN
(
"failed to estimate row counts"
,
K
(
ret
),
K
(
part_estimate
),
K
(
records
));
}
else
if
(
0
==
part_estimate
.
logical_row_count_
&&
0
==
part_estimate
.
physical_row_count_
)
{
}
else
if
(
0
==
part_estimate
.
logical_row_count_
&&
ObTabletStat
::
MERGE_REPORT_MIN_ROW_CNT
>=
part_estimate
.
physical_row_count_
)
{
}
else
{
ObTabletStat
report_stat
;
report_stat
.
ls_id_
=
ctx
.
param_
.
ls_id_
.
id
(),
...
...
src/storage/ob_tenant_tablet_stat_mgr.cpp
浏览文件 @
1c24d38f
...
...
@@ -77,11 +77,20 @@ bool ObTabletStat::is_valid() const
return
ls_id_
>
0
&&
tablet_id_
>
0
;
}
bool
ObTabletStat
::
is_empty_query
()
const
bool
ObTabletStat
::
check_need_report
()
const
{
bool
bret
=
false
;
if
(
0
==
scan_physical_row_cnt_
&&
0
==
scan_micro_block_cnt_
)
{
bret
=
true
;
if
(
0
!=
query_cnt_
)
{
// report by query
if
(
QUERY_REPORT_MIN_ROW_CNT
<=
scan_physical_row_cnt_
||
QUERY_REPORT_MIN_MICRO_BLOCK_CNT
<=
scan_micro_block_cnt_
||
QUERY_REPORT_MIN_SCAN_TABLE_CNT
<=
exist_row_total_table_cnt_
)
{
bret
=
true
;
}
}
else
if
(
0
!=
merge_cnt_
)
{
// report by compaction
bret
=
MERGE_REPORT_MIN_ROW_CNT
<=
merge_physical_row_cnt_
;
}
else
{
// invalid tablet stat
bret
=
false
;
}
return
bret
;
}
...
...
@@ -512,26 +521,20 @@ int ObTenantTabletStatMgr::report_stat(const ObTabletStat &stat)
}
else
if
(
!
stat
.
is_valid
())
{
ret
=
OB_INVALID_ARGUMENT
;
LOG_WARN
(
"get invalid arguments"
,
K
(
ret
),
K
(
stat
));
}
else
if
(
!
stat
.
check_need_report
())
{
}
else
{
int64_t
retry_cnt
=
0
;
while
(
retry_cnt
<
MAX_REPORT_RETRY_CNT
)
{
uint64_t
pending_cur
=
ATOMIC_LOAD
(
&
pending_cursor_
);
uint64_t
report_cur
=
ATOMIC_LOAD
(
&
report_cursor_
);
if
(
pending_cur
-
report_cur
+
1
==
DEFAULT_MAX_PENDING_CNT
)
{
// full queue
uint64_t
pending_cur
=
pending_cursor_
;
if
(
pending_cur
-
report_cursor_
>=
DEFAULT_MAX_PENDING_CNT
)
{
// first check full queue with dirty read
if
(
REACH_TENANT_TIME_INTERVAL
(
10
*
1000L
*
1000L
/*10s*/
))
{
LOG_INFO
(
"report_queue is full, wait to process"
,
K
(
report_cursor_
),
K
(
pending_cur
),
K
(
stat
));
}
}
else
if
(
FALSE_IT
(
pending_cur
=
ATOMIC_FAA
(
&
pending_cursor_
,
1
)))
{
}
else
if
(
pending_cur
-
report_cursor_
>=
DEFAULT_MAX_PENDING_CNT
)
{
// double check
if
(
REACH_TENANT_TIME_INTERVAL
(
10
*
1000L
*
1000L
/*10s*/
))
{
LOG_INFO
(
"report_queue is full, wait to process"
,
K
(
report_cur
),
K
(
pending_cur
),
K
(
stat
));
}
break
;
}
else
if
(
pending_cur
!=
ATOMIC_CAS
(
&
pending_cursor_
,
pending_cur
,
pending_cur
+
1
))
{
++
retry_cnt
;
}
else
{
report_queue_
[
pending_cur
%
DEFAULT_MAX_PENDING_CNT
]
=
stat
;
// allow dirty write
break
;
LOG_INFO
(
"report_queue is full, wait to process"
,
K
(
report_cursor_
),
K
(
pending_cur
),
K
(
stat
));
}
}
if
(
retry_cnt
==
MAX_REPORT_RETRY_CNT
)
{
// pending cursor has been moved in other thread, ignore this tablet_stat
LOG_INFO
(
"pending cursor has beed moved in other thread, ignore current stat"
,
K
(
stat
));
}
else
{
report_queue_
[
pending_cur
%
DEFAULT_MAX_PENDING_CNT
]
=
stat
;
}
}
return
ret
;
...
...
@@ -687,8 +690,11 @@ void ObTenantTabletStatMgr::dump_tablet_stat_status()
void
ObTenantTabletStatMgr
::
process_stats
()
{
int
tmp_ret
=
OB_SUCCESS
;
uint64_t
start_idx
=
ATOMIC_LOAD
(
&
report_cursor_
);
const
uint64_t
end_idx
=
ATOMIC_LOAD
(
&
pending_cursor_
);
const
uint64_t
start_idx
=
report_cursor_
;
const
uint64_t
pending_cur
=
ATOMIC_LOAD
(
&
pending_cursor_
);
uint64_t
end_idx
=
(
pending_cur
>
start_idx
+
DEFAULT_MAX_PENDING_CNT
)
?
start_idx
+
DEFAULT_MAX_PENDING_CNT
:
pending_cur
;
if
(
start_idx
==
end_idx
)
{
// empty queue
}
else
{
...
...
@@ -700,7 +706,7 @@ void ObTenantTabletStatMgr::process_stats()
LOG_WARN
(
"failed to update tablet stat"
,
K
(
tmp_ret
),
K
(
cur_stat
));
}
}
ATOMIC_STORE
(
&
report_cursor_
,
end_idx
);
report_cursor_
=
pending_cur
;
// only TabletStatUpdater update this value.
}
}
...
...
src/storage/ob_tenant_tablet_stat_mgr.h
浏览文件 @
1c24d38f
...
...
@@ -49,7 +49,7 @@ public:
~
ObTabletStat
()
=
default
;
void
reset
()
{
MEMSET
(
this
,
0
,
sizeof
(
ObTabletStat
));
}
bool
is_valid
()
const
;
bool
is_empty_query
()
const
;
bool
check_need_report
()
const
;
ObTabletStat
&
operator
=
(
const
ObTabletStat
&
other
);
ObTabletStat
&
operator
+=
(
const
ObTabletStat
&
other
);
ObTabletStat
&
archive
(
int64_t
factor
);
...
...
@@ -74,6 +74,10 @@ public:
static
constexpr
int64_t
BASIC_TABLE_CNT_THRESHOLD
=
5
;
static
constexpr
int64_t
BASIC_MICRO_BLOCK_CNT_THRESHOLD
=
16
;
static
constexpr
int64_t
BASIC_ROW_CNT_THRESHOLD
=
10000
;
// TODO(@Danling) make it a comfiguration item
static
constexpr
int64_t
QUERY_REPORT_MIN_ROW_CNT
=
100
;
static
constexpr
int64_t
QUERY_REPORT_MIN_MICRO_BLOCK_CNT
=
10
;
static
constexpr
int64_t
QUERY_REPORT_MIN_SCAN_TABLE_CNT
=
2
;
static
constexpr
int64_t
MERGE_REPORT_MIN_ROW_CNT
=
100
;
public:
int64_t
ls_id_
;
uint64_t
tablet_id_
;
...
...
unittest/storage/test_tenant_tablet_stat_mgr.cpp
浏览文件 @
1c24d38f
...
...
@@ -113,6 +113,7 @@ void TestTenantTabletStatMgr::batch_report_stat(int64_t report_num)
curr_stat
.
ls_id_
=
1
;
curr_stat
.
tablet_id_
=
10001
+
i
;
curr_stat
.
query_cnt_
=
100
*
(
i
+
1
);
curr_stat
.
scan_physical_row_cnt_
=
10000
+
i
;
std
::
thread
sub_report_thread
(
report
,
stat_mgr_
,
curr_stat
);
if
(
sub_report_thread
.
joinable
())
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录