Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
oceanbase
oceanbase
提交
39c3a048
O
oceanbase
项目概览
oceanbase
/
oceanbase
8 个月 前同步成功
通知
260
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,体验更适合开发者的 AI 搜索 >>
提交
39c3a048
编写于
10月 27, 2022
作者:
L
LINxiansheng
提交者:
wangzelin.wzl
10月 27, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CP] fixed not hit plan cache due to equal constraint
上级
b4bfa011
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
56 addition
and
1 deletion
+56
-1
src/sql/plan_cache/ob_plan_cache_util.h
src/sql/plan_cache/ob_plan_cache_util.h
+18
-0
src/sql/plan_cache/ob_plan_set.cpp
src/sql/plan_cache/ob_plan_set.cpp
+36
-0
src/sql/plan_cache/ob_plan_set.h
src/sql/plan_cache/ob_plan_set.h
+2
-1
未找到文件。
src/sql/plan_cache/ob_plan_cache_util.h
浏览文件 @
39c3a048
...
...
@@ -376,12 +376,30 @@ struct ObPCConstParamInfo {
common
::
ObSEArray
<
int64_t
,
4
>
const_idx_
;
common
::
ObSEArray
<
common
::
ObObj
,
4
>
const_params_
;
TO_STRING_KV
(
K_
(
const_idx
),
K_
(
const_params
));
bool
operator
==
(
const
ObPCConstParamInfo
&
other
)
const
{
bool
cmp_ret
=
true
;
for
(
int
i
=
0
;
cmp_ret
&&
i
<
const_idx_
.
count
();
i
++
)
{
cmp_ret
=
const_idx_
.
at
(
i
)
==
other
.
const_idx_
.
at
(
i
);
}
for
(
int
i
=
0
;
cmp_ret
&&
i
<
const_params_
.
count
();
i
++
)
{
cmp_ret
=
const_params_
.
at
(
i
)
==
other
.
const_params_
.
at
(
i
);
}
return
cmp_ret
;
}
};
struct
ObPCParamEqualInfo
{
int64_t
first_param_idx_
;
int64_t
second_param_idx_
;
TO_STRING_KV
(
K_
(
first_param_idx
),
K_
(
second_param_idx
));
inline
bool
operator
==
(
const
ObPCParamEqualInfo
&
other
)
const
{
bool
cmp_ret
=
first_param_idx_
==
other
.
first_param_idx_
&&
second_param_idx_
==
other
.
second_param_idx_
;
return
cmp_ret
;
}
};
struct
ObFastParserResult
{
...
...
src/sql/plan_cache/ob_plan_set.cpp
浏览文件 @
39c3a048
...
...
@@ -386,6 +386,7 @@ int ObPlanSet::match_params_info(
if
(
OB_SUCC
(
ret
))
{
const
ParamStore
&
params
=
pc_ctx
.
exec_ctx_
.
get_physical_plan_ctx
()
->
get_param_store
();
OC
((
match_constraint
)(
params
,
is_same
));
OC
(
(
match_cons
)(
pc_ctx
,
is_same
));
}
}
}
...
...
@@ -624,6 +625,41 @@ int ObPlanSet::set_equal_param_constraint(common::ObIArray<ObPCParamEqualInfo>&
return
ret
;
}
// match actually constraint
int
ObPlanSet
::
match_cons
(
const
ObPlanCacheCtx
&
pc_ctx
,
bool
&
is_matched
)
{
int
ret
=
OB_SUCCESS
;
ObIArray
<
ObPCConstParamInfo
>
*
param_cons
=
pc_ctx
.
sql_ctx_
.
all_plan_const_param_constraints_
;
ObIArray
<
ObPCConstParamInfo
>
*
possible_param_cons
=
pc_ctx
.
sql_ctx_
.
all_possible_const_param_constraints_
;
ObIArray
<
ObPCParamEqualInfo
>
*
equal_cons
=
pc_ctx
.
sql_ctx_
.
all_equal_param_constraints_
;
is_matched
=
true
;
if
(
OB_ISNULL
(
param_cons
)
||
OB_ISNULL
(
possible_param_cons
)
||
OB_ISNULL
(
equal_cons
))
{
is_matched
=
false
;
ret
=
OB_INVALID_ARGUMENT
;
LOG_WARN
(
"invalid arugment"
,
K
(
param_cons
),
K
(
possible_param_cons
),
K
(
equal_cons
));
}
else
if
(
param_cons
->
count
()
!=
all_plan_const_param_constraints_
.
count
()
||
possible_param_cons
->
count
()
!=
all_possible_const_param_constraints_
.
count
()
||
equal_cons
->
count
()
!=
all_equal_param_constraints_
.
count
())
{
is_matched
=
false
;
}
else
{
for
(
int64_t
i
=
0
;
is_matched
&&
i
<
all_plan_const_param_constraints_
.
count
();
i
++
)
{
is_matched
=
(
all_plan_const_param_constraints_
.
at
(
i
)
==
param_cons
->
at
(
i
));
}
for
(
int64_t
i
=
0
;
is_matched
&&
i
<
all_possible_const_param_constraints_
.
count
();
i
++
)
{
is_matched
=
(
all_possible_const_param_constraints_
.
at
(
i
)
==
possible_param_cons
->
at
(
i
));
}
for
(
int64_t
i
=
0
;
is_matched
&&
i
<
all_equal_param_constraints_
.
count
();
i
++
)
{
is_matched
=
(
all_equal_param_constraints_
.
at
(
i
)
==
equal_cons
->
at
(
i
));
}
}
return
ret
;
}
int
ObPlanSet
::
match_constraint
(
const
ParamStore
&
params
,
bool
&
is_matched
)
{
int
ret
=
OB_SUCCESS
;
...
...
src/sql/plan_cache/ob_plan_set.h
浏览文件 @
39c3a048
...
...
@@ -174,7 +174,8 @@ private:
common
::
ObIArray
<
ObPCConstParamInfo
>&
const_param_constraint
,
const
bool
is_all_constraint
);
int
set_equal_param_constraint
(
common
::
ObIArray
<
ObPCParamEqualInfo
>&
equal_param_constraint
);
int
match_cons
(
const
ObPlanCacheCtx
&
pc_ctx
,
bool
&
is_matched
);
/**
* @brief Match const param constraint.
* If all_plan_const_param_constraints_ is not empty, check wether the constraints is mached and return the result.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录