Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
1f694d6b
O
oceanbase
项目概览
Metz
/
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,发现更多精彩内容 >>
提交
1f694d6b
编写于
3月 01, 2022
作者:
S
st0
提交者:
LINGuanRen
3月 01, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix connection resource cleanup task bug
上级
32f29105
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
15 addition
and
8 deletion
+15
-8
src/sql/session/ob_user_resource_mgr.cpp
src/sql/session/ob_user_resource_mgr.cpp
+14
-7
src/sql/session/ob_user_resource_mgr.h
src/sql/session/ob_user_resource_mgr.h
+1
-1
未找到文件。
src/sql/session/ob_user_resource_mgr.cpp
浏览文件 @
1f694d6b
...
...
@@ -70,7 +70,7 @@ int ObConnectResourceMgr::init(ObMultiVersionSchemaService& schema_service)
}
else
{
schema_service_
=
&
schema_service
;
inited_
=
true
;
const
int64_t
delay
=
3600000000
;
const
int64_t
delay
=
ConnResourceCleanUpTask
::
SLEEP_USECONDS
;
const
bool
repeat
=
false
;
if
(
OB_FAIL
(
TG_SCHEDULE
(
lib
::
TGDefIDs
::
ServerGTimer
,
cleanup_task_
,
delay
,
repeat
)))
{
LOG_WARN
(
"schedual connect resource mgr failed"
,
K
(
ret
));
...
...
@@ -240,7 +240,7 @@ int ObConnectResourceMgr::increase_user_connections_count(const uint64_t max_use
return
ret
;
}
// max_connections
:
max connections per hour.
// max_connections
:
max connections per hour.
// max_user_connections: max concurrent connections.
// 0 means no limit.
int
ObConnectResourceMgr
::
on_user_connect
(
const
uint64_t
tenant_id
,
const
uint64_t
user_id
,
const
ObPrivSet
&
priv
,
...
...
@@ -339,7 +339,12 @@ bool ObConnectResourceMgr::CleanUpConnResourceFunc::operator()(ObTenantUserKey k
}
else
if
(
is_user_
)
{
const
ObUserInfo
*
user_info
=
NULL
;
if
(
OB_FAIL
(
schema_guard_
.
get_user_info
(
key
.
id_
,
user_info
)))
{
LOG_ERROR
(
"get user info failed"
,
K
(
ret
),
K
(
key
.
id_
));
if
(
OB_TENANT_NOT_EXIST
!=
ret
)
{
LOG_ERROR
(
"get user info failed"
,
K
(
ret
),
K
(
key
.
id_
));
}
else
{
ret
=
OB_SUCCESS
;
conn_res_map_
.
del
(
key
);
}
}
else
if
(
OB_ISNULL
(
user_info
))
{
conn_res_map_
.
del
(
key
);
}
...
...
@@ -358,15 +363,17 @@ bool ObConnectResourceMgr::CleanUpConnResourceFunc::operator()(ObTenantUserKey k
void
ObConnectResourceMgr
::
ConnResourceCleanUpTask
::
runTimerTask
()
{
int
ret
=
OB_SUCCESS
;
ObSchemaGetterGuard
s
ys_s
chema_guard
;
ObSchemaGetterGuard
schema_guard
;
if
(
OB_ISNULL
(
conn_res_mgr_
.
schema_service_
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_ERROR
(
"schema service is null"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
conn_res_mgr_
.
schema_service_
->
get_
tenant_schema_guard
(
OB_SYS_TENANT_ID
,
sys_
schema_guard
)))
{
}
else
if
(
OB_FAIL
(
conn_res_mgr_
.
schema_service_
->
get_
schema_guard
(
schema_guard
)))
{
LOG_WARN
(
"get sys tenant schema guard failed"
,
K
(
ret
));
}
else
{
CleanUpConnResourceFunc
user_func
(
sys_schema_guard
,
conn_res_mgr_
.
user_res_map_
,
true
);
CleanUpConnResourceFunc
tenant_func
(
sys_schema_guard
,
conn_res_mgr_
.
user_res_map_
,
false
);
LOG_INFO
(
"clean up connection resource"
,
K
(
schema_guard
.
get_tenant_id
()),
K
(
conn_res_mgr_
.
user_res_map_
.
size
()),
K
(
conn_res_mgr_
.
tenant_res_map_
.
size
()));
CleanUpConnResourceFunc
user_func
(
schema_guard
,
conn_res_mgr_
.
user_res_map_
,
true
);
CleanUpConnResourceFunc
tenant_func
(
schema_guard
,
conn_res_mgr_
.
tenant_res_map_
,
false
);
if
(
OB_FAIL
(
conn_res_mgr_
.
user_res_map_
.
for_each
(
user_func
)))
{
LOG_WARN
(
"cleanup dropped user failed"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
conn_res_mgr_
.
tenant_res_map_
.
for_each
(
tenant_func
)))
{
...
...
src/sql/session/ob_user_resource_mgr.h
浏览文件 @
1f694d6b
...
...
@@ -134,7 +134,7 @@ private:
void
runTimerTask
(
void
)
override
;
ObConnectResourceMgr
&
conn_res_mgr_
;
const
uint64_t
SLEEP_USECONDS
=
3600000000
;
// one hour
static
const
uint64_t
SLEEP_USECONDS
=
3600000000
;
// one hour
};
friend
class
ConnResourceCleanUpTask
;
friend
class
CleanUpUserResourceFunc
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录