Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
oceanbase
oceanbase
提交
36fdaab9
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,发现更多精彩内容 >>
提交
36fdaab9
编写于
4月 19, 2024
作者:
Hanr110
提交者:
ob-robot
4月 19, 2024
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CP] to issue<56141233>:add sys_var influencing cache to pl cache key & fix case when issue
上级
1f14c6e8
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
42 addition
and
12 deletion
+42
-12
src/observer/virtual_table/ob_gv_sql.cpp
src/observer/virtual_table/ob_gv_sql.cpp
+9
-3
src/pl/ob_pl_resolver.cpp
src/pl/ob_pl_resolver.cpp
+3
-0
src/pl/pl_cache/ob_pl_cache.cpp
src/pl/pl_cache/ob_pl_cache.cpp
+9
-1
src/pl/pl_cache/ob_pl_cache.h
src/pl/pl_cache/ob_pl_cache.h
+5
-2
src/pl/pl_cache/ob_pl_cache_mgr.cpp
src/pl/pl_cache/ob_pl_cache_mgr.cpp
+6
-4
src/pl/pl_cache/ob_pl_cache_object.cpp
src/pl/pl_cache/ob_pl_cache_object.cpp
+4
-0
src/pl/pl_cache/ob_pl_cache_object.h
src/pl/pl_cache/ob_pl_cache_object.h
+6
-2
未找到文件。
src/observer/virtual_table/ob_gv_sql.cpp
浏览文件 @
36fdaab9
...
...
@@ -408,10 +408,16 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
case
share
::
ALL_VIRTUAL_PLAN_STAT_CDE
::
SYS_VARS
:
{
if
(
!
cache_stat_updated
)
{
cells
[
i
].
set_null
();
}
else
if
(
cache_obj
->
is_sql_crsr
())
{
ObString
sys_vars_str
;
}
else
if
(
cache_obj
->
is_sql_crsr
()
||
NULL
!=
pl_object
)
{
ObString
sys_vars_str
,
origin_str
;
if
(
cache_obj
->
is_sql_crsr
())
{
origin_str
=
plan
->
stat_
.
sys_vars_str_
;
}
else
{
origin_str
=
pl_object
->
get_stat
().
sys_vars_str_
;
}
if
(
OB_FAIL
(
ob_write_string
(
*
allocator_
,
plan
->
stat_
.
sys_vars_str_
,
origin_str
,
sys_vars_str
)))
{
SERVER_LOG
(
ERROR
,
"copy sys_vars_str failed"
,
K
(
ret
));
}
else
{
...
...
src/pl/ob_pl_resolver.cpp
浏览文件 @
36fdaab9
...
...
@@ -4268,6 +4268,9 @@ int ObPLResolver::resolve_when(const ObStmtNodeTree *parse_tree, ObRawExpr *case
OZ (func.add_expr(expr));
OZ (expr->formalize(&resolve_ctx_.session_info_));
if (!is_bool_stmt && lib::is_mysql_mode()) {
OZ (set_cm_warn_on_fail(expr));
}
OZ (stmt->add_when_clause(func.get_expr_count() - 1, body));
}
}
...
...
src/pl/pl_cache/ob_pl_cache.cpp
浏览文件 @
36fdaab9
...
...
@@ -255,6 +255,7 @@ void ObPLObjectKey::reset()
sessid_
=
0
;
name_
.
reset
();
namespace_
=
ObLibCacheNameSpace
::
NS_INVALID
;
sys_vars_str_
.
reset
();
}
int
ObPLObjectKey
::
deep_copy
(
ObIAllocator
&
allocator
,
const
ObILibCacheKey
&
other
)
...
...
@@ -263,6 +264,8 @@ int ObPLObjectKey::deep_copy(ObIAllocator &allocator, const ObILibCacheKey &othe
const
ObPLObjectKey
&
key
=
static_cast
<
const
ObPLObjectKey
&>
(
other
);
if
(
OB_FAIL
(
common
::
ob_write_string
(
allocator
,
key
.
name_
,
name_
)))
{
LOG_WARN
(
"failed to deep copy name"
,
K
(
ret
),
K
(
name_
));
}
else
if
(
OB_FAIL
(
common
::
ob_write_string
(
allocator
,
key
.
sys_vars_str_
,
sys_vars_str_
)))
{
LOG_WARN
(
"failed to deep copy name"
,
K
(
ret
),
K
(
name_
));
}
else
{
db_id_
=
key
.
db_id_
;
key_id_
=
key
.
key_id_
;
...
...
@@ -277,6 +280,9 @@ void ObPLObjectKey::destory(common::ObIAllocator &allocator)
if
(
nullptr
!=
name_
.
ptr
())
{
allocator
.
free
(
const_cast
<
char
*>
(
name_
.
ptr
()));
}
if
(
nullptr
!=
sys_vars_str_
.
ptr
())
{
allocator
.
free
(
const_cast
<
char
*>
(
sys_vars_str_
.
ptr
()));
}
}
uint64_t
ObPLObjectKey
::
hash
()
const
...
...
@@ -286,6 +292,7 @@ uint64_t ObPLObjectKey::hash() const
hash_ret
=
murmurhash
(
&
sessid_
,
sizeof
(
uint32_t
),
hash_ret
);
hash_ret
=
name_
.
hash
(
hash_ret
);
hash_ret
=
murmurhash
(
&
namespace_
,
sizeof
(
ObLibCacheNameSpace
),
hash_ret
);
hash_ret
=
sys_vars_str_
.
hash
(
hash_ret
);
return
hash_ret
;
}
...
...
@@ -296,7 +303,8 @@ bool ObPLObjectKey::is_equal(const ObILibCacheKey &other) const
key_id_
==
key
.
key_id_
&&
sessid_
==
key
.
sessid_
&&
name_
==
key
.
name_
&&
namespace_
==
key
.
namespace_
;
namespace_
==
key
.
namespace_
&&
sys_vars_str_
==
key
.
sys_vars_str_
;
return
cmp_ret
;
}
...
...
src/pl/pl_cache/ob_pl_cache.h
浏览文件 @
36fdaab9
...
...
@@ -206,13 +206,15 @@ struct ObPLObjectKey : public ObILibCacheKey
db_id_
(
common
::
OB_INVALID_ID
),
key_id_
(
common
::
OB_INVALID_ID
),
sessid_
(
0
),
name_
()
{}
name_
(),
sys_vars_str_
()
{}
ObPLObjectKey
(
uint64_t
db_id
,
uint64_t
key_id
)
:
ObILibCacheKey
(
ObLibCacheNameSpace
::
NS_INVALID
),
db_id_
(
db_id
),
key_id_
(
key_id
),
sessid_
(
0
),
name_
()
{}
name_
(),
sys_vars_str_
()
{}
void
reset
();
virtual
int
deep_copy
(
common
::
ObIAllocator
&
allocator
,
const
ObILibCacheKey
&
other
)
override
;
...
...
@@ -229,6 +231,7 @@ struct ObPLObjectKey : public ObILibCacheKey
uint64_t
key_id_
;
// routine id or package id
uint32_t
sessid_
;
common
::
ObString
name_
;
common
::
ObString
sys_vars_str_
;
};
...
...
src/pl/pl_cache/ob_pl_cache_mgr.cpp
浏览文件 @
36fdaab9
...
...
@@ -27,13 +27,14 @@ int ObPLCacheMgr::get_pl_object(ObPlanCache *lib_cache, ObILibCacheCtx &ctx, ObC
{
int
ret
=
OB_SUCCESS
;
FLTSpanGuard
(
pc_get_pl_object
);
ObPLCacheCtx
&
pc_ctx
=
static_cast
<
ObPLCacheCtx
&>
(
ctx
);
//guard.get_cache_obj() = NULL;
ObGlobalReqTimeService
::
check_req_timeinfo
();
if
(
OB_ISNULL
(
lib_cache
))
{
if
(
OB_ISNULL
(
lib_cache
)
||
OB_ISNULL
(
pc_ctx
.
session_info_
)
)
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"lib cache is null"
);
}
else
{
ObPLCacheCtx
&
pc_ctx
=
static_cast
<
ObPLCacheCtx
&>
(
ctx
);
pc_ctx
.
key_
.
sys_vars_str_
=
pc_ctx
.
session_info_
->
get_sys_var_in_pc_str
(
);
if
(
OB_FAIL
(
lib_cache
->
get_cache_obj
(
ctx
,
&
pc_ctx
.
key_
,
guard
)))
{
PL_CACHE_LOG
(
DEBUG
,
"failed to get plan"
,
K
(
ret
));
// if schema expired, update pl cache;
...
...
@@ -106,14 +107,15 @@ int ObPLCacheMgr::add_pl_object(ObPlanCache *lib_cache,
ObILibCacheObject
*
cache_obj
)
{
int
ret
=
OB_SUCCESS
;
ObPLCacheCtx
&
pc_ctx
=
static_cast
<
ObPLCacheCtx
&>
(
ctx
);
if
(
OB_ISNULL
(
cache_obj
))
{
ret
=
OB_INVALID_ARGUMENT
;
PL_CACHE_LOG
(
WARN
,
"invalid cache obj"
,
K
(
ret
));
}
else
if
(
OB_ISNULL
(
lib_cache
))
{
}
else
if
(
OB_ISNULL
(
lib_cache
)
||
OB_ISNULL
(
pc_ctx
.
session_info_
)
)
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"lib cache is null"
);
}
else
{
ObPLCacheCtx
&
pc_ctx
=
static_cast
<
ObPLCacheCtx
&>
(
ctx
);
pc_ctx
.
key_
.
sys_vars_str_
=
pc_ctx
.
session_info_
->
get_sys_var_in_pc_str
(
);
do
{
if
(
OB_FAIL
(
lib_cache
->
add_cache_obj
(
ctx
,
&
pc_ctx
.
key_
,
cache_obj
))
&&
OB_OLD_SCHEMA_VERSION
==
ret
)
{
PL_CACHE_LOG
(
INFO
,
"schema in pl cache value is old, start to remove pl object"
,
K
(
ret
),
K
(
pc_ctx
.
key_
));
...
...
src/pl/pl_cache/ob_pl_cache_object.cpp
浏览文件 @
36fdaab9
...
...
@@ -134,6 +134,10 @@ int ObPLCacheObject::update_cache_obj_stat(sql::ObILibCacheCtx &ctx)
trunc_name_sql
.
string
(),
stat
.
name_
)))
{
LOG_WARN
(
"failed to write sql"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
ob_write_string
(
get_allocator
(),
pc_ctx
.
key_
.
sys_vars_str_
,
stat_
.
sys_vars_str_
)))
{
LOG_WARN
(
"failed to write sql"
,
K
(
ret
));
}
else
{
stat
.
sql_cs_type_
=
pc_ctx
.
session_info_
->
get_local_collation_connection
();
}
...
...
src/pl/pl_cache/ob_pl_cache_object.h
浏览文件 @
36fdaab9
...
...
@@ -88,6 +88,7 @@ struct PLCacheObjStat
uint64_t
slowest_exec_usec_
;
// execution slowest usec
int64_t
schema_version_
;
int64_t
ps_stmt_id_
;
//prepare stmt id
common
::
ObString
sys_vars_str_
;
PLCacheObjStat
()
:
pl_schema_id_
(
OB_INVALID_ID
),
...
...
@@ -104,7 +105,8 @@ struct PLCacheObjStat
slowest_exec_time_
(
0
),
slowest_exec_usec_
(
0
),
schema_version_
(
OB_INVALID_ID
),
ps_stmt_id_
(
OB_INVALID_ID
)
ps_stmt_id_
(
OB_INVALID_ID
),
sys_vars_str_
()
{
sql_id_
[
0
]
=
'\0'
;
}
...
...
@@ -131,6 +133,7 @@ struct PLCacheObjStat
slowest_exec_usec_
=
0
;
schema_version_
=
OB_INVALID_ID
;
ps_stmt_id_
=
OB_INVALID_ID
;
sys_vars_str_
.
reset
();
}
TO_STRING_KV
(
K_
(
pl_schema_id
),
...
...
@@ -141,7 +144,8 @@ struct PLCacheObjStat
K_
(
name
),
K_
(
compile_time
),
K_
(
type
),
K_
(
schema_version
));
K_
(
schema_version
),
K_
(
sys_vars_str
));
};
class
ObPLCacheObject
:
public
sql
::
ObILibCacheObject
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录