Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
oceanbase
oceanbase
提交
0a8815a6
O
oceanbase
项目概览
oceanbase
/
oceanbase
大约 1 年 前同步成功
通知
261
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0a8815a6
编写于
4月 17, 2023
作者:
O
obdev
提交者:
ob-robot
4月 17, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CP] Sql audit desige changed about mem_limit, queue_size and etc.
上级
4736d1b2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
20 deletion
+31
-20
src/observer/mysql/ob_eliminate_task.cpp
src/observer/mysql/ob_eliminate_task.cpp
+26
-18
src/observer/mysql/ob_mysql_request_manager.cpp
src/observer/mysql/ob_mysql_request_manager.cpp
+4
-1
src/sql/ob_sql_utils.cpp
src/sql/ob_sql_utils.cpp
+1
-1
未找到文件。
src/observer/mysql/ob_eliminate_task.cpp
浏览文件 @
0a8815a6
...
...
@@ -44,36 +44,32 @@ int ObEliminateTask::init(const ObMySQLRequestManager* request_manager)
int
ObEliminateTask
::
check_config_mem_limit
(
bool
&
is_change
)
{
const
int64_t
MINIMUM_LIMIT
=
64
*
1024
*
1024
;
// at lease 64M
const
int64_t
MAXIMUM_LIMIT
=
1024
*
1024
*
1024
;
// 1G maximum
int
ret
=
OB_SUCCESS
;
is_change
=
false
;
int64_t
mem_limit
=
config_mem_limit_
;
int64_t
tenant_id
=
OB_INVALID_TENANT_ID
;
if
(
OB_ISNULL
(
request_manager_
))
{
ret
=
OB_INVALID_ARGUMENT
;
LOG_WARN
(
"invalid argument"
,
K
(
request_manager_
),
K
(
ret
));
}
else
if
(
request_manager_
->
get_tenant_id
()
>
OB_SYS_TENANT_ID
&&
request_manager_
->
get_tenant_id
()
<=
OB_MAX_RESERVED_TENANT_ID
)
{
}
else
if
(
FALSE_IT
(
tenant_id
=
request_manager_
->
get_tenant_id
()))
{
}
else
if
(
tenant_id
>
OB_SYS_TENANT_ID
&&
tenant_id
<=
OB_MAX_RESERVED_TENANT_ID
)
{
// If the 50x tenant dosn't have a corresponding tenant schema,
// the query configuration must fail
}
else
if
(
OB_FAIL
(
ObMySQLRequestManager
::
get_mem_limit
(
request_manager_
->
get_tenant_id
(),
mem_limit
)))
{
LOG_WARN
(
"failed to get mem limit"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
ObMySQLRequestManager
::
get_mem_limit
(
tenant_id
,
mem_limit
)))
{
// if memory limit is not retrivable
// overwrite error code,
set mem config to default value
// so that total memory use of sql audit can be limited
// overwrite error code,
not change the size of config_mem_limit_
LOG_WARN
(
"failed to get mem limit"
,
K
(
ret
),
K
(
tenant_id
),
K
(
mem_limit
),
K
(
config_mem_limit_
));
ret
=
OB_SUCCESS
;
mem_limit
=
MAXIMUM_LIMIT
;
}
else
{
// do nothing
}
if
(
config_mem_limit_
!=
mem_limit
)
{
LOG_INFO
(
"before change config mem"
,
K
(
config_mem_limit_
));
config_mem_limit_
=
mem_limit
;
if
(
mem_limit
<
MINIMUM_LIMIT
&&
!
lib
::
is_mini_mode
())
{
config_mem_limit_
=
MINIMUM_LIMIT
;
if
(
config_mem_limit_
!=
mem_limit
)
{
LOG_INFO
(
"change config mem limit"
,
K
(
config_mem_limit_
),
K
(
mem_limit
),
K
(
tenant_id
));
bool
use_mini_mem
=
lib
::
is_mini_mode
();
config_mem_limit_
=
mem_limit
;
if
(
mem_limit
<
MINIMUM_LIMIT
&&
!
use_mini_mem
)
{
config_mem_limit_
=
MINIMUM_LIMIT
;
}
is_change
=
true
;
}
is_change
=
true
;
LOG_INFO
(
"after change config mem"
,
K
(
config_mem_limit_
));
}
return
ret
;
}
...
...
@@ -147,7 +143,19 @@ void ObEliminateTask::runTimerTask()
ret
=
OB_NOT_INIT
;
LOG_WARN
(
"fail to get sql audit evict memory level"
,
K
(
ret
));
}
if
(
OB_SUCC
(
ret
)
&&
REACH_TIME_INTERVAL
(
30
*
1000
*
1000
))
{
// 30s delay
LOG_INFO
(
"Eliminate task evict sql audit"
,
K
(
request_manager_
->
get_tenant_id
()),
K
(
queue_size
),
K
(
request_manager_
->
get_size_used
()),
K
(
evict_high_size_level
),
K
(
evict_low_size_level
),
K
(
allocator
->
allocated
()),
K
(
evict_high_mem_level
),
K
(
evict_low_mem_level
));
}
}
if
(
OB_SUCC
(
ret
))
{
int64_t
start_time
=
obsys
::
ObSysTimeUtil
::
getTime
();
int64_t
evict_batch_count
=
0
;
...
...
src/observer/mysql/ob_mysql_request_manager.cpp
浏览文件 @
0a8815a6
...
...
@@ -257,12 +257,15 @@ int ObMySQLRequestManager::mtl_init(ObMySQLRequestManager*& req_mgr)
}
else
{
uint64_t
tenant_id
=
lib
::
current_resource_owner_id
();
int64_t
mem_limit
=
lib
::
get_tenant_memory_limit
(
tenant_id
);
int64_t
queue_size
=
lib
::
is_mini_mode
()
?
MINI_MODE_MAX_QUEUE_SIZE
:
MAX_QUEUE_SIZE
;
mem_limit
=
static_cast
<
int64_t
>
(
static_cast
<
double
>
(
mem_limit
)
*
SQL_AUDIT_MEM_FACTOR
);
bool
use_mini_queue
=
lib
::
is_mini_mode
();
int64_t
queue_size
=
use_mini_queue
?
MINI_MODE_MAX_QUEUE_SIZE
:
MAX_QUEUE_SIZE
;
if
(
OB_FAIL
(
req_mgr
->
init
(
tenant_id
,
mem_limit
,
queue_size
)))
{
LOG_WARN
(
"failed to init request manager"
,
K
(
ret
));
}
else
{
// do nothing
}
LOG_INFO
(
"mtl init finish"
,
K
(
tenant_id
),
K
(
mem_limit
),
K
(
queue_size
),
K
(
ret
));
}
if
(
OB_FAIL
(
ret
)
&&
req_mgr
!=
nullptr
)
{
// cleanup
...
...
src/sql/ob_sql_utils.cpp
浏览文件 @
0a8815a6
...
...
@@ -3813,7 +3813,7 @@ int ObSQLUtils::handle_audit_record(
/*do nothing*/
}
else
if
(
GCONF
.
enable_sql_audit
)
{
if
(
session
.
get_local_ob_enable_sql_audit
())
{
FETCH_ENTITY
(
TENANT_SPACE
,
session
.
get_
priv
_tenant_id
())
FETCH_ENTITY
(
TENANT_SPACE
,
session
.
get_
effective
_tenant_id
())
{
ObMySQLRequestManager
*
req_manager
=
MTL_GET
(
ObMySQLRequestManager
*
);
if
(
nullptr
==
req_manager
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录