Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Messij2001
oceanbase
提交
52d765e9
O
oceanbase
项目概览
Messij2001
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
2
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,体验更适合开发者的 AI 搜索 >>
提交
52d765e9
编写于
10月 13, 2021
作者:
W
wangzelin.wzl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adjust location cache's thread cnt dynamically
上级
5003ce27
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
66 addition
and
3 deletion
+66
-3
src/observer/ob_partition_location_updater.cpp
src/observer/ob_partition_location_updater.cpp
+20
-0
src/observer/ob_partition_location_updater.h
src/observer/ob_partition_location_updater.h
+2
-0
src/observer/ob_server_reload_config.cpp
src/observer/ob_server_reload_config.cpp
+9
-0
src/observer/ob_service.h
src/observer/ob_service.h
+4
-0
src/observer/ob_uniq_task_queue.h
src/observer/ob_uniq_task_queue.h
+5
-3
src/share/partition_table/ob_partition_location_cache.cpp
src/share/partition_table/ob_partition_location_cache.cpp
+25
-0
src/share/partition_table/ob_partition_location_cache.h
src/share/partition_table/ob_partition_location_cache.h
+1
-0
未找到文件。
src/observer/ob_partition_location_updater.cpp
浏览文件 @
52d765e9
...
...
@@ -97,6 +97,26 @@ void ObPartitionLocationUpdater::destroy()
wait
();
}
int
ObPartitionLocationUpdater
::
set_thread_cnt
(
const
int64_t
thread_cnt
)
{
int
ret
=
OB_SUCCESS
;
if
(
!
inited_
)
{
ret
=
OB_NOT_INIT
;
LOG_WARN
(
"updater is not inited yet"
,
KR
(
ret
),
K
(
thread_cnt
));
}
else
if
(
!
lib
::
is_mini_mode
()
&&
thread_cnt
>
0
&&
thread_cnt
!=
thread_cnt_
)
{
if
(
OB_FAIL
(
sender_
.
set_thread_count
(
thread_cnt
)))
{
LOG_ERROR
(
"fail to set sender's thread cnt"
,
KR
(
ret
),
K
(
thread_cnt
),
K
(
thread_cnt_
));
}
else
if
(
OB_FAIL
(
receiver_
.
set_thread_count
(
thread_cnt
)))
{
LOG_ERROR
(
"fail to set receiver's thread cnt"
,
KR
(
ret
),
K
(
thread_cnt
),
K
(
thread_cnt_
));
}
else
{
LOG_INFO
(
"[LOCATION] location updater change thread cnt"
,
"pre_thread_cnt"
,
thread_cnt_
,
"cur_thread_cnt"
,
thread_cnt
);
thread_cnt_
=
thread_cnt
;
}
}
return
ret
;
}
int
ObPartitionLocationUpdater
::
submit_broadcast_task
(
const
ObPartitionBroadcastTask
&
task
)
{
int
ret
=
OB_SUCCESS
;
...
...
src/observer/ob_partition_location_updater.h
浏览文件 @
52d765e9
...
...
@@ -66,6 +66,8 @@ public:
obrpc
::
ObSrvRpcProxy
*&
srv_rpc_proxy
,
share
::
ObPartitionLocationCache
*&
location_cache
,
share
::
ObIAliveServerTracer
&
server_tracer
);
int
set_thread_cnt
(
const
int64_t
thread_cnt
);
void
stop
();
void
wait
();
void
destroy
();
...
...
src/observer/ob_server_reload_config.cpp
浏览文件 @
52d765e9
...
...
@@ -29,6 +29,7 @@
#include "observer/ob_server.h"
#include "storage/ob_partition_scheduler.h"
#include "storage/ob_partition_migrator.h"
#include "observer/ob_service.h"
using
namespace
oceanbase
::
lib
;
using
namespace
oceanbase
::
common
;
...
...
@@ -338,5 +339,13 @@ int ObServerReloadConfig::operator()()
{
OB_STORE_FILE
.
resize_file
(
GCONF
.
datafile_size
,
GCONF
.
datafile_disk_percentage
);
}
{
const
int64_t
location_thread_cnt
=
GCONF
.
location_refresh_thread_count
;
if
(
OB_NOT_NULL
(
GCTX
.
ob_service_
)
&&
OB_FAIL
(
GCTX
.
ob_service_
->
get_partition_location_updater
().
set_thread_cnt
(
location_thread_cnt
)))
{
real_ret
=
ret
;
LOG_WARN
(
"fail to set location updater's thread cnt"
,
KR
(
ret
),
K
(
location_thread_cnt
));
}
}
return
real_ret
;
}
src/observer/ob_service.h
浏览文件 @
52d765e9
...
...
@@ -286,6 +286,10 @@ public:
int64_t
get_partition_table_updater_user_queue_size
()
const
;
int64_t
get_partition_table_updater_sys_queue_size
()
const
;
int64_t
get_partition_table_updater_core_queue_size
()
const
;
ObPartitionLocationUpdater
&
get_partition_location_updater
()
{
return
partition_location_updater_
;
}
int
get_all_partition_status
(
int64_t
&
inactive_num
,
int64_t
&
total_num
)
const
;
int
get_root_server_status
(
obrpc
::
ObGetRootserverRoleResult
&
get_role_result
);
...
...
src/observer/ob_uniq_task_queue.h
浏览文件 @
52d765e9
...
...
@@ -305,7 +305,7 @@ void ObUniqTaskQueue<Task, Process>::run1()
ret
=
common
::
OB_NOT_INIT
;
SERVER_LOG
(
WARN
,
"not init"
,
K
(
ret
));
}
else
{
while
(
!
has_set_stop
())
{
while
(
!
lib
::
this_thread
::
has_set_stop
())
{
Task
*
t
=
NULL
;
tasks
.
reuse
();
if
(
OB_SUCC
(
tasks
.
reserve
(
batch_exec_cnt
)))
{
...
...
@@ -431,10 +431,11 @@ template <typename Task, typename Process>
int
ObUniqTaskQueue
<
Task
,
Process
>::
process_barrier
(
Task
&
task
)
{
int
ret
=
common
::
OB_SUCCESS
;
bool
stopped
=
lib
::
this_thread
::
has_set_stop
();
if
(
OB_ISNULL
(
updater_
))
{
ret
=
common
::
OB_ERR_UNEXPECTED
;
SERVER_LOG
(
WARN
,
"invalid updater"
,
K
(
ret
),
K
(
updater_
));
}
else
if
(
OB_FAIL
(
updater_
->
process_barrier
(
task
,
has_set_stop
()
)))
{
}
else
if
(
OB_FAIL
(
updater_
->
process_barrier
(
task
,
stopped
)))
{
SERVER_LOG
(
WARN
,
"fail to batch process task"
,
K
(
ret
));
}
return
ret
;
...
...
@@ -444,12 +445,13 @@ template <typename Task, typename Process>
int
ObUniqTaskQueue
<
Task
,
Process
>::
batch_process_tasks
(
common
::
ObIArray
<
Task
>&
tasks
)
{
int
ret
=
common
::
OB_SUCCESS
;
bool
stopped
=
lib
::
this_thread
::
has_set_stop
();
if
(
0
==
tasks
.
count
())
{
// nothing todo
}
else
if
(
OB_ISNULL
(
updater_
))
{
ret
=
common
::
OB_ERR_UNEXPECTED
;
SERVER_LOG
(
WARN
,
"invalid updater"
,
K
(
ret
),
K
(
updater_
));
}
else
if
(
OB_FAIL
(
updater_
->
batch_process_tasks
(
tasks
,
has_set_stop
()
)))
{
}
else
if
(
OB_FAIL
(
updater_
->
batch_process_tasks
(
tasks
,
stopped
)))
{
SERVER_LOG
(
WARN
,
"fail to batch process task"
,
K
(
ret
));
}
return
ret
;
...
...
src/share/partition_table/ob_partition_location_cache.cpp
浏览文件 @
52d765e9
...
...
@@ -2002,6 +2002,24 @@ int ObLocationAsyncUpdateQueueSet::init(ObServerConfig& config)
return
ret
;
}
int
ObLocationAsyncUpdateQueueSet
::
set_thread_count
(
const
int64_t
thread_cnt
)
{
int
ret
=
OB_SUCCESS
;
if
(
!
is_inited_
)
{
ret
=
OB_NOT_INIT
;
LOG_WARN
(
"not init"
,
KR
(
ret
));
}
else
if
(
!
lib
::
is_mini_mode
()
&&
thread_cnt
>
0
)
{
if
(
OB_FAIL
(
tenant_space_update_queue_
.
set_thread_count
(
thread_cnt
)))
{
LOG_ERROR
(
"fail to set thread count"
,
KR
(
ret
),
K
(
thread_cnt
));
}
else
if
(
OB_FAIL
(
user_update_queue_
.
set_thread_count
(
thread_cnt
)))
{
LOG_ERROR
(
"fail to set thread count"
,
KR
(
ret
),
K
(
thread_cnt
));
}
else
{
LOG_INFO
(
"[LOCATION] location queue may change thread cnt"
,
K
(
thread_cnt
));
}
}
return
ret
;
}
int
ObLocationAsyncUpdateQueueSet
::
add_task
(
const
ObLocationAsyncUpdateTask
&
task
)
{
int
ret
=
OB_SUCCESS
;
...
...
@@ -2181,6 +2199,13 @@ int ObPartitionLocationCache::reload_config()
LOG_WARN
(
"not init"
,
K
(
ret
));
}
else
{
sem_
.
set_max_count
(
config_
->
location_fetch_concurrency
);
int64_t
thread_cnt
=
config_
->
location_refresh_thread_count
;
int
tmp_ret
=
OB_SUCCESS
;
if
(
OB_SUCCESS
!=
(
tmp_ret
=
local_async_queue_set_
.
set_thread_count
(
thread_cnt
)))
{
LOG_WARN
(
"fail to set thread count"
,
KR
(
tmp_ret
),
K
(
thread_cnt
));
}
else
if
(
OB_SUCCESS
!=
(
tmp_ret
=
remote_async_queue_set_
.
set_thread_count
(
thread_cnt
)))
{
LOG_WARN
(
"fail to set thread count"
,
KR
(
tmp_ret
),
K
(
thread_cnt
));
}
}
return
ret
;
}
...
...
src/share/partition_table/ob_partition_location_cache.h
浏览文件 @
52d765e9
...
...
@@ -629,6 +629,7 @@ public:
ObLocationAsyncUpdateQueueSet
(
ObIPartitionLocationCache
*
loc_cache_
);
virtual
~
ObLocationAsyncUpdateQueueSet
();
int
init
(
common
::
ObServerConfig
&
config
);
int
set_thread_count
(
const
int64_t
thread_cnt
);
int
add_task
(
const
ObLocationAsyncUpdateTask
&
task
);
void
stop
();
void
wait
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录