Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
4640a92c
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看板
提交
4640a92c
编写于
7月 29, 2021
作者:
S
sl0
提交者:
wangzelin.wzl
7月 29, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Bugfixs patched from 3.1.x to 3.1_opensource_release
上级
9bbbb315
变更
26
隐藏空白更改
内联
并排
Showing
26 changed file
with
218 addition
and
136 deletion
+218
-136
src/observer/mysql/ob_async_plan_driver.cpp
src/observer/mysql/ob_async_plan_driver.cpp
+1
-1
src/observer/mysql/ob_sync_plan_driver.cpp
src/observer/mysql/ob_sync_plan_driver.cpp
+2
-2
src/observer/mysql/obmp_query.cpp
src/observer/mysql/obmp_query.cpp
+7
-3
src/observer/mysql/obmp_stmt_execute.cpp
src/observer/mysql/obmp_stmt_execute.cpp
+7
-3
src/observer/mysql/obmp_stmt_prepare.cpp
src/observer/mysql/obmp_stmt_prepare.cpp
+5
-1
src/sql/engine/expr/ob_expr_trim.cpp
src/sql/engine/expr/ob_expr_trim.cpp
+11
-4
src/sql/engine/join/ob_basic_nested_loop_join.cpp
src/sql/engine/join/ob_basic_nested_loop_join.cpp
+23
-15
src/sql/engine/join/ob_nested_loop_join.cpp
src/sql/engine/join/ob_nested_loop_join.cpp
+32
-13
src/sql/engine/join/ob_nested_loop_join.h
src/sql/engine/join/ob_nested_loop_join.h
+3
-1
src/sql/engine/join/ob_nested_loop_join_op.cpp
src/sql/engine/join/ob_nested_loop_join_op.cpp
+24
-4
src/sql/engine/join/ob_nested_loop_join_op.h
src/sql/engine/join/ob_nested_loop_join_op.h
+1
-0
src/sql/engine/subquery/ob_subplan_filter.cpp
src/sql/engine/subquery/ob_subplan_filter.cpp
+30
-14
src/sql/engine/subquery/ob_subplan_filter.h
src/sql/engine/subquery/ob_subplan_filter.h
+1
-0
src/sql/engine/subquery/ob_subplan_filter_op.cpp
src/sql/engine/subquery/ob_subplan_filter_op.cpp
+7
-0
src/sql/plan_cache/ob_plan_cache_util.h
src/sql/plan_cache/ob_plan_cache_util.h
+1
-1
src/sql/plan_cache/ob_prepare_stmt_struct.cpp
src/sql/plan_cache/ob_prepare_stmt_struct.cpp
+3
-0
src/sql/plan_cache/ob_prepare_stmt_struct.h
src/sql/plan_cache/ob_prepare_stmt_struct.h
+5
-8
src/sql/plan_cache/ob_ps_cache.cpp
src/sql/plan_cache/ob_ps_cache.cpp
+4
-13
src/sql/plan_cache/ob_ps_cache_callback.h
src/sql/plan_cache/ob_ps_cache_callback.h
+8
-2
src/sql/resolver/dml/ob_column_namespace_checker.cpp
src/sql/resolver/dml/ob_column_namespace_checker.cpp
+1
-5
src/sql/resolver/dml/ob_dml_resolver.cpp
src/sql/resolver/dml/ob_dml_resolver.cpp
+1
-0
src/sql/resolver/expr/ob_raw_expr.h
src/sql/resolver/expr/ob_raw_expr.h
+7
-0
src/sql/resolver/expr/ob_raw_expr_printer.cpp
src/sql/resolver/expr/ob_raw_expr_printer.cpp
+3
-0
src/sql/session/ob_basic_session_info.h
src/sql/session/ob_basic_session_info.h
+25
-42
src/sql/session/ob_sql_session_info.cpp
src/sql/session/ob_sql_session_info.cpp
+3
-1
unittest/sql/rewrite/result/test_transformer_stmt_after_together.result
...ewrite/result/test_transformer_stmt_after_together.result
+3
-3
未找到文件。
src/observer/mysql/ob_async_plan_driver.cpp
浏览文件 @
4640a92c
...
...
@@ -93,7 +93,7 @@ int ObAsyncPlanDriver::response_result(ObMySQLResultSet& result)
if
(
!
OB_SUCC
(
ret
)
&&
!
async_resp_used
&&
!
retry_ctrl_
.
need_retry
())
{
int
sret
=
OB_SUCCESS
;
bool
is_partition_hit
=
session_
.
partition_hit
().
get_bool
(
);
bool
is_partition_hit
=
session_
.
get_err_final_partition_hit
(
ret
);
if
(
OB_SUCCESS
!=
(
sret
=
sender_
.
send_error_packet
(
ret
,
NULL
,
is_partition_hit
)))
{
LOG_WARN
(
"send error packet fail"
,
K
(
sret
),
K
(
ret
));
}
...
...
src/observer/mysql/ob_sync_plan_driver.cpp
浏览文件 @
4640a92c
...
...
@@ -191,7 +191,7 @@ int ObSyncPlanDriver::response_result(ObMySQLResultSet& result)
OB_BATCHED_MULTI_STMT_ROLLBACK
!=
ret
)
{
// if OB_BATCHED_MULTI_STMT_ROLLBACK is err ret of batch stmt rollback,not return to client, retry
int
sret
=
OB_SUCCESS
;
bool
is_partition_hit
=
session_
.
partition_hit
().
get_bool
(
);
bool
is_partition_hit
=
session_
.
get_err_final_partition_hit
(
ret
);
if
(
OB_SUCCESS
!=
(
sret
=
sender_
.
send_error_packet
(
ret
,
NULL
,
is_partition_hit
)))
{
LOG_WARN
(
"send error packet fail"
,
K
(
sret
),
K
(
ret
));
}
...
...
@@ -433,7 +433,7 @@ int ObRemotePlanDriver::response_result(ObMySQLResultSet& result)
if
(
!
retry_ctrl_
.
need_retry
())
{
if
(
OB_FAIL
(
ret
)
&&
!
process_ok
)
{
int
sret
=
OB_SUCCESS
;
bool
is_partition_hit
=
session_
.
partition_hit
().
get_bool
(
);
bool
is_partition_hit
=
session_
.
get_err_final_partition_hit
(
ret
);
if
(
OB_SUCCESS
!=
(
sret
=
sender_
.
send_error_packet
(
ret
,
NULL
,
is_partition_hit
)))
{
LOG_WARN
(
"send error packet fail"
,
K
(
sret
),
K
(
ret
));
}
...
...
src/observer/mysql/obmp_query.cpp
浏览文件 @
4640a92c
...
...
@@ -739,9 +739,13 @@ OB_INLINE int ObMPQuery::do_process(
}
else
{
LOG_WARN
(
"query failed"
,
K
(
ret
),
K
(
retry_ctrl_
.
need_retry
()));
}
bool
is_partition_hit
=
session
.
partition_hit
().
get_bool
();
int
err
=
send_error_packet
(
ret
,
NULL
,
is_partition_hit
,
(
void
*
)
&
ctx_
.
reroute_info_
);
if
(
OB_SUCCESS
!=
err
)
{
// 当need_retry=false时,可能给客户端回过包了,可能还没有回过任何包。
// 不过,可以确定:这个请求出错了,还没处理完。如果不是已经交给异步EndTrans收尾,
// 则需要在下面回复一个error_packet作为收尾。否则后面没人帮忙发错误包给客户端了,
// 可能会导致客户端挂起等回包。
bool
is_partition_hit
=
session
.
get_err_final_partition_hit
(
ret
);
int
err
=
send_error_packet
(
ret
,
NULL
,
is_partition_hit
,
(
void
*
)
&
ctx_
.
reroute_info_
);
if
(
OB_SUCCESS
!=
err
)
{
// 发送error包
LOG_WARN
(
"send error packet failed"
,
K
(
ret
),
K
(
err
));
}
}
...
...
src/observer/mysql/obmp_stmt_execute.cpp
浏览文件 @
4640a92c
...
...
@@ -716,9 +716,13 @@ int ObMPStmtExecute::do_process(
&&
!
THIS_WORKER
.
need_retry
()
&&
!
retry_ctrl_
.
need_retry
())
{
LOG_WARN
(
"query failed"
,
K
(
ret
),
K
(
retry_ctrl_
.
need_retry
()),
K_
(
stmt_id
));
bool
is_partition_hit
=
session
.
partition_hit
().
get_bool
();
int
err
=
send_error_packet
(
ret
,
NULL
,
is_partition_hit
,
(
void
*
)(
&
ctx_
.
reroute_info_
));
if
(
OB_SUCCESS
!=
err
)
{
// 当need_retry=false时,可能给客户端回过包了,可能还没有回过任何包。
// 不过,可以确定:这个请求出错了,还没处理完。如果不是已经交给异步EndTrans收尾,
// 则需要在下面回复一个error_packet作为收尾。否则后面没人帮忙发错误包给客户端了,
// 可能会导致客户端挂起等回包。
bool
is_partition_hit
=
session
.
get_err_final_partition_hit
(
ret
);
int
err
=
send_error_packet
(
ret
,
NULL
,
is_partition_hit
,
(
void
*
)(
&
ctx_
.
reroute_info_
));
if
(
OB_SUCCESS
!=
err
)
{
// 发送error包
LOG_WARN
(
"send error packet failed"
,
K
(
ret
),
K
(
err
));
}
}
...
...
src/observer/mysql/obmp_stmt_prepare.cpp
浏览文件 @
4640a92c
...
...
@@ -445,7 +445,11 @@ int ObMPStmtPrepare::do_process(
if
(
!
OB_SUCC
(
ret
)
&&
!
async_resp_used
&&
need_response_error
&&
conn_valid_
&&
!
THIS_WORKER
.
need_retry
())
{
LOG_WARN
(
"query failed"
,
K
(
ret
),
K
(
retry_ctrl_
.
need_retry
()),
K_
(
sql
));
bool
is_partition_hit
=
session
.
partition_hit
().
get_bool
();
// 当need_retry=false时,可能给客户端回过包了,可能还没有回过任何包。
// 不过,可以确定:这个请求出错了,还没处理完。如果不是已经交给异步EndTrans收尾,
// 则需要在下面回复一个error_packet作为收尾。否则后面没人帮忙发错误包给客户端了,
// 可能会导致客户端挂起等回包。
bool
is_partition_hit
=
session
.
get_err_final_partition_hit
(
ret
);
int
err
=
send_error_packet
(
ret
,
NULL
,
is_partition_hit
);
if
(
OB_SUCCESS
!=
err
)
{
LOG_WARN
(
"send error packet failed"
,
K
(
ret
),
K
(
err
));
...
...
src/sql/engine/expr/ob_expr_trim.cpp
浏览文件 @
4640a92c
...
...
@@ -370,10 +370,15 @@ inline int ObExprTrim::deduce_result_type(
if
(
lib
::
is_oracle_mode
()
&&
type_ctx
.
get_session
()
->
use_static_typing_engine
())
{
auto
str_params
=
make_const_carray
(
str_type
);
LOG_DEBUG
(
"str_type is"
,
K
(
str_type
));
OZ
(
aggregate_string_type_and_charset_oracle
(
*
type_ctx
.
get_session
(),
str_params
,
type
,
true
));
// prefer varchar
OZ
(
deduce_string_param_calc_type_and_charset
(
*
type_ctx
.
get_session
(),
type
,
str_params
));
if
(
NULL
!=
pattern_type
)
{
pattern_type
->
set_calc_meta
(
type
);
if
(
str_type
->
is_null
())
{
type
.
set_meta
(
*
str_type
);
}
else
{
OZ
(
aggregate_string_type_and_charset_oracle
(
*
type_ctx
.
get_session
(),
str_params
,
type
,
true
));
// prefer varchar
OZ
(
deduce_string_param_calc_type_and_charset
(
*
type_ctx
.
get_session
(),
type
,
str_params
));
if
(
OB_SUCC
(
ret
)
&&
NULL
!=
pattern_type
)
{
pattern_type
->
set_calc_meta
(
type
);
}
}
}
else
{
if
(
str_type
->
is_lob
())
{
...
...
@@ -389,6 +394,8 @@ inline int ObExprTrim::deduce_result_type(
if
(
NULL
!=
pattern_type
)
{
pattern_type
->
set_calc_type
(
ObVarcharType
);
}
}
else
if
(
str_type
->
is_null
())
{
type
.
set_meta
(
*
str_type
);
}
else
{
const
common
::
ObLengthSemantics
default_length_semantics
=
(
OB_NOT_NULL
(
type_ctx
.
get_session
())
?
type_ctx
.
get_session
()
->
get_actual_nls_length_semantics
()
...
...
src/sql/engine/join/ob_basic_nested_loop_join.cpp
浏览文件 @
4640a92c
...
...
@@ -51,33 +51,41 @@ int ObBasicNestedLoopJoin::prepare_rescan_params(ObBasicNestedLoopJoinCtx& join_
{
int
ret
=
OB_SUCCESS
;
ObObjParam
res_obj
;
ObPhysicalPlanCtx
*
plan_ctx
=
join_ctx
.
exec_ctx_
.
get_physical_plan_ctx
();
if
(
OB_ISNULL
(
plan_ctx
)
||
OB_ISNULL
(
join_ctx
.
left_row_
))
{
ObPhysicalPlanCtx
*
plan_ctx
=
join_ctx
.
exec_ctx_
.
get_physical_plan_ctx
();
ObPhyOperator
*
left_child
=
get_child
(
FIRST_CHILD
);
ObPhyOperatorCtx
*
left_child_ctx
=
NULL
;
if
(
OB_ISNULL
(
plan_ctx
)
||
OB_ISNULL
(
join_ctx
.
left_row_
)
||
OB_ISNULL
(
left_child
))
{
ret
=
OB_BAD_NULL_ERROR
;
LOG_WARN
(
"plan ctx or left row is null"
,
K
(
ret
));
}
else
if
(
NULL
==
(
left_child_ctx
=
static_cast
<
ObPhyOperatorCtx
*>
(
join_ctx
.
exec_ctx_
.
get_phy_op_ctx
(
left_child
->
get_id
()))))
{
LOG_WARN
(
"fail to get phy operator ctx"
,
K
(
ret
));
}
else
{
int64_t
param_cnt
=
rescan_params_
.
count
();
const
ObSqlExpression
*
expr
=
NULL
;
const
ObSqlExpression
*
expr
=
NULL
;
// rescan param need deep copy, because memory of expr result from calc_buf
// in ObPhyOperator, when get next row next time, will free memory in
// calc_buf; here we use left child calc_buf, because when left child need
// get next row, rescan param will not used;
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
param_cnt
;
++
i
)
{
int64_t
idx
=
rescan_params_
.
at
(
i
).
param_idx_
;
if
(
OB_ISNULL
(
expr
=
rescan_params_
.
at
(
i
).
expr_
))
{
ret
=
OB_BAD_NULL_ERROR
;
LOG_WARN
(
"rescan param expr is null"
,
K
(
ret
),
K
(
i
));
}
else
if
(
OB_FAIL
(
expr
->
calc
(
join_ctx
.
expr_ctx_
,
*
join_ctx
.
left_row_
,
res_obj
)))
{
LOG_WARN
(
"failed to calc expr for rescan param"
,
K
(
ret
),
K
(
i
));
}
else
{
int64_t
idx
=
rescan_params_
.
at
(
i
).
param_idx_
;
res_obj
.
set_param_meta
();
plan_ctx
->
get_param_store_for_update
().
at
(
idx
)
=
res_obj
;
LOG_DEBUG
(
"prepare_rescan_params"
,
K
(
ret
),
K
(
i
),
K
(
res_obj
),
K
(
idx
),
K
(
expr
),
K
(
plan_ctx
),
K
(
*
join_ctx
.
left_row_
),
K
(
*
expr
),
K
(
join_ctx
.
expr_ctx_
.
phy_plan_ctx_
));
if
(
OB_FAIL
(
deep_copy_obj
(
left_child_ctx
->
get_calc_buf
(),
res_obj
,
plan_ctx
->
get_param_store_for_update
().
at
(
idx
))))
{
LOG_WARN
(
"fail to deep copy "
,
K
(
ret
));
}
LOG_DEBUG
(
"prepare_rescan_params"
,
K
(
ret
),
K
(
i
),
K
(
res_obj
),
K
(
idx
),
K
(
expr
),
K
(
plan_ctx
),
K
(
*
join_ctx
.
left_row_
),
K
(
*
expr
),
K
(
join_ctx
.
expr_ctx_
.
phy_plan_ctx_
));
}
}
}
...
...
src/sql/engine/join/ob_nested_loop_join.cpp
浏览文件 @
4640a92c
...
...
@@ -122,23 +122,35 @@ int ObNestedLoopJoin::switch_iterator(ObExecContext& ctx) const
return
ret
;
}
int
ObNestedLoopJoin
::
rescan
(
ObExecContext
&
exec_ctx
)
const
{
int
ObNestedLoopJoin
::
reset_rescan_params
(
ObExecContext
&
ctx
)
const
{
int
ret
=
OB_SUCCESS
;
ObNestedLoopJoinCtx
*
join_ctx
=
GET_PHY_OPERATOR_CTX
(
ObNestedLoopJoinCtx
,
exec_ctx
,
get_id
());
ObPhysicalPlanCtx
*
plan_ctx
=
exec_ctx
.
get_physical_plan_ctx
();
if
(
OB_ISNULL
(
join_ctx
)
||
OB_ISNULL
(
plan_ctx
))
{
ret
=
OB_BAD_NULL_ERROR
;
LOG_WARN
(
"join ctx is null"
,
K
(
ret
));
ObPhysicalPlanCtx
*
plan_ctx
=
NULL
;
if
(
OB_ISNULL
(
plan_ctx
=
GET_PHY_PLAN_CTX
(
ctx
)))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"physical plan context is null"
,
K
(
ret
));
}
else
{
join_ctx
->
reset
();
int64_t
param_cnt
=
rescan_params_
.
count
();
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
param_cnt
;
++
i
)
{
for
(
int64_t
i
=
0
;
i
<
rescan_params_
.
count
();
++
i
)
{
int64_t
idx
=
rescan_params_
.
at
(
i
).
param_idx_
;
plan_ctx
->
get_param_store_for_update
().
at
(
idx
).
set_null
();
LOG_
DEBUG
(
"prepare_rescan_params"
,
K
(
ret
),
K
(
i
),
K
(
idx
));
LOG_
TRACE
(
"prepare_rescan_params"
,
K
(
ret
),
K
(
i
),
K
(
idx
));
}
if
(
OB_FAIL
(
ObBasicNestedLoopJoin
::
rescan
(
exec_ctx
)))
{
}
return
ret
;
}
int
ObNestedLoopJoin
::
rescan
(
ObExecContext
&
exec_ctx
)
const
{
int
ret
=
OB_SUCCESS
;
ObNestedLoopJoinCtx
*
join_ctx
=
GET_PHY_OPERATOR_CTX
(
ObNestedLoopJoinCtx
,
exec_ctx
,
get_id
());
if
(
OB_ISNULL
(
join_ctx
))
{
ret
=
OB_BAD_NULL_ERROR
;
LOG_WARN
(
"join ctx is null"
,
K
(
ret
));
}
else
{
join_ctx
->
reset
();
if
(
OB_FAIL
(
reset_rescan_params
(
exec_ctx
)))
{
LOG_WARN
(
"fail to reset rescan params"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
ObBasicNestedLoopJoin
::
rescan
(
exec_ctx
)))
{
LOG_WARN
(
"failed to rescan"
,
K
(
ret
));
}
}
...
...
@@ -204,9 +216,16 @@ int ObNestedLoopJoin::inner_get_next_row(ObExecContext& exec_ctx, const ObNewRow
LOG_WARN
(
"copy current row failed"
,
K
(
ret
));
}
}
if
(
OB_ITER_END
==
ret
)
{
if
(
OB_FAIL
(
reset_rescan_params
(
exec_ctx
)))
{
LOG_WARN
(
"fail to reset rescan params"
,
K
(
ret
));
}
else
{
ret
=
OB_ITER_END
;
}
}
if
(
OB_SUCC
(
ret
))
{
LOG_
DEBUG
(
"get next row from nested loop join"
,
K
(
*
row
));
LOG_
TRACE
(
"get next row from nested loop join"
,
K
(
*
row
));
}
return
ret
;
}
...
...
src/sql/engine/join/ob_nested_loop_join.h
浏览文件 @
4640a92c
...
...
@@ -124,7 +124,9 @@ private:
state_operation_func_type
state_operation_func_
[
JS_STATE_COUNT
];
state_function_func_type
state_function_func_
[
JS_STATE_COUNT
][
FT_TYPE_COUNT
];
// nested loop join with index seek, batch
int
batch_index_join_get_next
(
ObExecContext
&
exec_ctx
,
const
common
::
ObNewRow
*&
row
)
const
;
int
batch_index_join_get_next
(
ObExecContext
&
exec_ctx
,
const
common
::
ObNewRow
*&
row
)
const
;
int
reset_rescan_params
(
ObExecContext
&
ctx
)
const
;
private:
int
bij_fill_left_rows
(
ObExecContext
&
exec_ctx
)
const
;
...
...
src/sql/engine/join/ob_nested_loop_join_op.cpp
浏览文件 @
4640a92c
...
...
@@ -73,12 +73,25 @@ int ObNestedLoopJoinOp::switch_iterator()
return
ret
;
}
int
ObNestedLoopJoinOp
::
rescan
()
{
int
ObNestedLoopJoinOp
::
set_param_null
()
{
int
ret
=
OB_SUCCESS
;
ObDatum
null_datum
;
null_datum
.
set_null
();
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
MY_SPEC
.
rescan_params_
.
count
();
++
i
)
{
OZ
(
MY_SPEC
.
rescan_params_
.
at
(
i
).
update_dynamic_param
(
eval_ctx_
,
null_datum
));
LOG_DEBUG
(
"prepare_rescan_params"
,
K
(
ret
),
K
(
i
));
}
return
ret
;
}
int
ObNestedLoopJoinOp
::
rescan
()
{
int
ret
=
OB_SUCCESS
;
reset_buf_state
();
ObPhysicalPlanCtx
*
plan_ctx
=
GET_PHY_PLAN_CTX
(
ctx_
);
if
(
OB_FAIL
(
ObBasicNestedLoopJoinOp
::
rescan
()))
{
ObPhysicalPlanCtx
*
plan_ctx
=
GET_PHY_PLAN_CTX
(
ctx_
);
if
(
OB_FAIL
(
set_param_null
()))
{
LOG_WARN
(
"failed to set param null"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
ObBasicNestedLoopJoinOp
::
rescan
()))
{
LOG_WARN
(
"failed to rescan"
,
K
(
ret
));
}
...
...
@@ -117,6 +130,13 @@ int ObNestedLoopJoinOp::inner_get_next_row()
}
}
// while end
}
if
(
OB_ITER_END
==
ret
)
{
if
(
OB_FAIL
(
set_param_null
()))
{
LOG_WARN
(
"failed to set param null"
,
K
(
ret
));
}
else
{
ret
=
OB_ITER_END
;
}
}
return
ret
;
}
...
...
src/sql/engine/join/ob_nested_loop_join_op.h
浏览文件 @
4640a92c
...
...
@@ -93,6 +93,7 @@ private:
bool
is_full
()
const
;
// used for rescan and switch iter
virtual
void
reset_buf_state
();
int
set_param_null
();
public:
ObJoinState
state_
;
...
...
src/sql/engine/subquery/ob_subplan_filter.cpp
浏览文件 @
4640a92c
...
...
@@ -204,25 +204,34 @@ void ObSubPlanFilter::reuse()
ObMultiChildrenPhyOperator
::
reuse
();
}
int
ObSubPlanFilter
::
rescan
(
ObExecContext
&
ctx
)
const
{
int
ObSubPlanFilter
::
reset_rescan_params
(
ObExecContext
&
ctx
)
const
{
int
ret
=
OB_SUCCESS
;
ObPhyOperator
*
child_op
=
NULL
;
ObSubPlanFilterCtx
*
subplan_ctx
=
NULL
;
ObPhysicalPlanCtx
*
plan_ctx
=
NULL
;
if
(
OB_ISNULL
(
subplan_ctx
=
GET_PHY_OPERATOR_CTX
(
ObSubPlanFilterCtx
,
ctx
,
get_id
()))
||
OB_ISNULL
(
plan_ctx
=
ctx
.
get_physical_plan_ctx
()))
{
ObPhysicalPlanCtx
*
plan_ctx
=
NULL
;
if
(
OB_ISNULL
(
plan_ctx
=
GET_PHY_PLAN_CTX
(
ctx
)))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"get physical operator context failed"
,
K
(
ret
));
}
else
{
/*do nothing*/
LOG_WARN
(
"physical plan context is null"
,
K
(
ret
));
}
else
{
for
(
int64_t
i
=
0
;
i
<
rescan_params_
.
count
();
++
i
)
{
int64_t
idx
=
rescan_params_
.
at
(
i
).
second
;
plan_ctx
->
get_param_store_for_update
().
at
(
idx
).
set_null
();
LOG_TRACE
(
"prepare_rescan_params"
,
K
(
ret
),
K
(
i
),
K
(
idx
));
}
}
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
rescan_params_
.
count
();
++
i
)
{
int64_t
idx
=
rescan_params_
.
at
(
i
).
second
;
plan_ctx
->
get_param_store_for_update
().
at
(
idx
).
set_null
();
LOG_DEBUG
(
"prepare_rescan_params"
,
K
(
ret
),
K
(
i
),
K
(
idx
));
}
return
ret
;
}
int
ObSubPlanFilter
::
rescan
(
ObExecContext
&
ctx
)
const
{
int
ret
=
OB_SUCCESS
;
ObPhyOperator
*
child_op
=
NULL
;
ObSubPlanFilterCtx
*
subplan_ctx
=
NULL
;
if
(
OB_ISNULL
(
subplan_ctx
=
GET_PHY_OPERATOR_CTX
(
ObSubPlanFilterCtx
,
ctx
,
get_id
())))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"get physical operator context failed"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
reset_rescan_params
(
ctx
)))
{
LOG_WARN
(
"fail to reset rescan params"
,
K
(
ret
));
}
for
(
int32_t
i
=
1
;
OB_SUCC
(
ret
)
&&
i
<
get_child_num
();
++
i
)
{
if
(
OB_ISNULL
(
child_op
=
get_child
(
i
)))
{
ret
=
OB_ERR_UNEXPECTED
;
...
...
@@ -620,6 +629,13 @@ int ObSubPlanFilter::inner_get_next_row(ObExecContext& ctx, const ObNewRow*& row
OZ
(
copy_cur_row
(
*
subplan_ctx
,
row
));
}
}
if
(
OB_ITER_END
==
ret
)
{
if
(
OB_FAIL
(
reset_rescan_params
(
ctx
)))
{
LOG_WARN
(
"fail to reset rescan params"
,
K
(
ret
));
}
else
{
ret
=
OB_ITER_END
;
}
}
return
ret
;
}
...
...
src/sql/engine/subquery/ob_subplan_filter.h
浏览文件 @
4640a92c
...
...
@@ -104,6 +104,7 @@ private:
virtual
int64_t
to_string_kv
(
char
*
buf
,
const
int64_t
buf_len
)
const
;
int
handle_update_set
(
ObSubPlanFilterCtx
*
subplan_ctx
,
const
common
::
ObNewRow
*&
row
)
const
;
int
construct_array_params
(
ObExecContext
&
ctx
)
const
;
int
reset_rescan_params
(
ObExecContext
&
ctx
)
const
;
private:
DISALLOW_COPY_AND_ASSIGN
(
ObSubPlanFilter
);
...
...
src/sql/engine/subquery/ob_subplan_filter_op.cpp
浏览文件 @
4640a92c
...
...
@@ -325,6 +325,13 @@ int ObSubPlanFilterOp::inner_get_next_row()
OZ
(
handle_update_set
());
}
}
if
(
OB_ITER_END
==
ret
)
{
if
(
OB_FAIL
(
set_param_null
()))
{
LOG_WARN
(
"failed to set param null"
,
K
(
ret
));
}
else
{
ret
=
OB_ITER_END
;
}
}
return
ret
;
}
...
...
src/sql/plan_cache/ob_plan_cache_util.h
浏览文件 @
4640a92c
...
...
@@ -470,7 +470,7 @@ struct ObPlanCacheCtx {
must_be_positive_index_
(),
multi_stmt_fp_results_
(
allocator
),
handle_id_
(
MAX_HANDLE
),
is_remote_executor_
(
false
)
is_remote_executor_
(
false
)
{
bl_key_
.
tenant_id_
=
tenant_id
;
fp_result_
.
pc_key_
.
is_ps_mode_
=
is_ps_mode_
;
...
...
src/sql/plan_cache/ob_prepare_stmt_struct.cpp
浏览文件 @
4640a92c
...
...
@@ -264,6 +264,7 @@ ObPsStmtInfo::ObPsStmtInfo(ObIAllocator* inner_allocator)
dep_objs_
(
NULL
),
dep_objs_cnt_
(
0
),
ps_item_
(
NULL
),
is_expired_evicted_
(
false
),
allocator_
(
inner_allocator
),
external_allocator_
(
NULL
)
...
...
@@ -286,6 +287,7 @@ ObPsStmtInfo::ObPsStmtInfo(ObIAllocator* inner_allocator, ObIAllocator* external
ps_item_
(
NULL
),
tenant_version_
(
OB_INVALID_VERSION
),
is_expired_
(
false
),
is_expired_evicted_
(
false
),
allocator_
(
inner_allocator
),
external_allocator_
(
external_allocator
)
{}
...
...
@@ -312,6 +314,7 @@ int ObPsStmtInfo::deep_copy(const ObPsStmtInfo& other)
ps_item_
=
other
.
ps_item_
;
tenant_version_
=
other
.
tenant_version_
;
is_expired_
=
other
.
is_expired_
;
is_expired_evicted_
=
other
.
is_expired_evicted_
;
if
(
other
.
get_dep_objs_cnt
()
>
0
)
{
dep_objs_cnt_
=
other
.
get_dep_objs_cnt
();
if
(
NULL
==
(
dep_objs_
=
reinterpret_cast
<
ObSchemaObjVersion
*>
(
...
...
src/sql/plan_cache/ob_prepare_stmt_struct.h
浏览文件 @
4640a92c
...
...
@@ -321,14 +321,9 @@ public:
{
tenant_version_
=
tenant_version
;
}
void
set_is_expired
()
{
ATOMIC_STORE
(
&
is_expired_
,
true
);
}
int64_t
is_expired
()
{
return
ATOMIC_LOAD
(
&
is_expired_
);
}
void
set_is_expired
()
{
ATOMIC_STORE
(
&
is_expired_
,
true
);
}
bool
is_expired
()
{
return
ATOMIC_LOAD
(
&
is_expired_
);
}
bool
*
get_is_expired_evicted_ptr
()
{
return
&
is_expired_evicted_
;
}
DECLARE_VIRTUAL_TO_STRING
;
...
...
@@ -351,6 +346,8 @@ private:
ObPsStmtItem
*
ps_item_
;
int64_t
tenant_version_
;
bool
is_expired_
;
// check whether has dec ref count for ps info expired
bool
is_expired_evicted_
;
// ObDataBuffer is used to use the internal memory of ObPsStmtItem,
// The memory essentially comes from inner_allocator_ in ObPsPlancache
...
...
src/sql/plan_cache/ob_ps_cache.cpp
浏览文件 @
4640a92c
...
...
@@ -46,19 +46,10 @@ ObPsCache::ObPsCache()
ObPsCache
::~
ObPsCache
()
{
int
ret
=
OB_SUCCESS
;
ObSEArray
<
ObPsStmtId
,
512
>
all_stmt_id
;
ObGetAllStmtIdOp
op
(
&
all_stmt_id
);
if
(
OB_FAIL
(
stmt_info_map_
.
foreach_refactored
(
op
)))
{
LOG_WARN
(
"traverse stmt_info_map_ failed"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
op
.
get_callback_ret
()))
{
LOG_WARN
(
"traverse stmt_info_map_ failed"
,
K
(
ret
));
}
else
{
for
(
int64_t
i
=
0
;
i
<
all_stmt_id
.
count
();
++
i
)
{
// ignore ret
if
(
OB_FAIL
(
deref_ps_stmt
(
all_stmt_id
.
at
(
i
),
true
/*erase_info*/
)))
{
LOG_WARN
(
"deref_ps_stmt faield when destroy ObPsCache"
,
K
(
ret
),
K
(
all_stmt_id
.
at
(
i
)),
K
(
all_stmt_id
.
count
()));
}
}
}
// ps_stmt_id和ps_stmt_info创建时,会给其增加引用计数
// 现在PsCache要析构了,对所有内部对象减去1,如果引用计数到0,会显式free内存
cache_evict_all_ps
();
if
(
NULL
!=
mem_context_
)
{
DESTROY_CONTEXT
(
mem_context_
);
mem_context_
=
NULL
;
...
...
src/sql/plan_cache/ob_ps_cache_callback.h
浏览文件 @
4640a92c
...
...
@@ -43,8 +43,14 @@ public:
id_time
.
first
=
entry
.
first
;
id_time
.
second
=
entry
.
second
->
get_last_closed_timestamp
();
if
(
entry
.
second
->
is_expired
())
{
if
(
OB_SUCCESS
!=
(
callback_ret_
=
expired_ps_
->
push_back
(
id_time
)))
{
SQL_PC_LOG
(
WARN
,
"fail to push back key"
,
K_
(
callback_ret
));
// for expired ps info, only evicted once;
// use cas, because auto cache evict and flush ps cache may concurrent
// processing
if
(
ATOMIC_BCAS
(
entry
.
second
->
get_is_expired_evicted_ptr
(),
false
,
true
))
{
if
(
OB_SUCCESS
!=
(
callback_ret_
=
expired_ps_
->
push_back
(
id_time
)))
{
SQL_PC_LOG
(
WARN
,
"fail to push back key"
,
K_
(
callback_ret
));
}
}
}
else
{
if
(
OB_SUCCESS
!=
(
callback_ret_
=
closed_ps_
->
push_back
(
id_time
)))
{
...
...
src/sql/resolver/dml/ob_column_namespace_checker.cpp
浏览文件 @
4640a92c
...
...
@@ -295,6 +295,7 @@ int ObColumnNamespaceChecker::find_column_in_single_table(
// if databasename or table name is not specified,
// we must check the uniqueness of column in the table with the same name
bool
is_match
=
true
;
LOG_TRACE
(
"column info"
,
K
(
q_name
),
K
(
table_item
));
if
(
!
q_name
.
database_name_
.
empty
())
{
if
(
OB_FAIL
(
ObResolverUtils
::
name_case_cmp
(
params_
.
session_info_
,
q_name
.
database_name_
,
table_item
.
database_name_
,
OB_TABLE_NAME_CLASS
,
is_match
)))
{
...
...
@@ -314,11 +315,6 @@ int ObColumnNamespaceChecker::find_column_in_single_table(
params_
.
session_info_
,
q_name
.
tbl_name_
,
table_item
.
get_object_name
(),
OB_TABLE_NAME_CLASS
,
is_match
)))
{
LOG_WARN
(
"database name case compare failed"
,
K
(
ret
));
}
if
(
OB_SUCC
(
ret
)
&&
!
is_match
&&
!
table_item
.
synonym_name_
.
empty
()
&&
OB_FAIL
(
ObResolverUtils
::
name_case_cmp
(
params_
.
session_info_
,
q_name
.
tbl_name_
,
table_item
.
synonym_name_
,
OB_TABLE_NAME_CLASS
,
is_match
)))
{
LOG_WARN
(
"database name case compare failed"
,
K
(
ret
));
}
}
if
(
OB_SUCC
(
ret
)
&&
is_match
)
{
if
(
OB_FAIL
(
check_column_exists
(
table_item
,
q_name
.
col_name_
,
is_match
)))
{
...
...
src/sql/resolver/dml/ob_dml_resolver.cpp
浏览文件 @
4640a92c
...
...
@@ -567,6 +567,7 @@ int ObDMLResolver::resolve_basic_column_item(const TableItem& table_item, const
col_expr
->
set_synonym_db_name
(
table_item
.
synonym_db_name_
);
col_expr
->
set_synonym_name
(
table_item
.
synonym_name_
);
col_expr
->
set_column_attr
(
table_item
.
get_table_name
(),
col_schema
->
get_column_name_str
());
col_expr
->
set_from_alias_table
(
!
table_item
.
alias_name_
.
empty
());
col_expr
->
set_database_name
(
table_item
.
database_name_
);
// column maybe from alias table, so must reset ref id by table id from table_item
col_expr
->
set_ref_id
(
table_item
.
table_id_
,
col_schema
->
get_column_id
());
...
...
src/sql/resolver/expr/ob_raw_expr.h
浏览文件 @
4640a92c
...
...
@@ -1989,6 +1989,7 @@ public:
is_lob_column_
(
false
),
is_unpivot_mocked_column_
(
false
),
is_hidden_
(
false
),
from_alias_table_
(
false
),
real_expr_
(
nullptr
)
{
set_expr_class
(
ObExpr
::
EXPR_COLUMN_REF
);
...
...
@@ -2010,6 +2011,7 @@ public:
is_lob_column_
(
false
),
is_unpivot_mocked_column_
(
false
),
is_hidden_
(
false
),
from_alias_table_
(
false
),
real_expr_
(
nullptr
)
{
set_expr_class
(
ObExpr
::
EXPR_COLUMN_REF
);
...
...
@@ -2031,6 +2033,7 @@ public:
is_lob_column_
(
false
),
is_unpivot_mocked_column_
(
false
),
is_hidden_
(
false
),
from_alias_table_
(
false
),
real_expr_
(
nullptr
)
{
set_expr_class
(
ObExpr
::
EXPR_COLUMN_REF
);
...
...
@@ -2119,6 +2122,9 @@ public:
virtual
int
do_visit
(
ObRawExprVisitor
&
visitor
)
override
;
virtual
uint64_t
hash_internal
(
uint64_t
seed
)
const
;
bool
is_from_alias_table
()
const
{
return
from_alias_table_
;
}
void
set_from_alias_table
(
bool
value
)
{
from_alias_table_
=
value
;
}
inline
bool
is_generated_column
()
const
{
return
share
::
schema
::
ObSchemaUtils
::
is_generated_column
(
column_flags_
);
...
...
@@ -2226,6 +2232,7 @@ private:
bool
is_lob_column_
;
// TODO add lob column
bool
is_unpivot_mocked_column_
;
// used for unpivot
bool
is_hidden_
;
// used for print hidden column
bool
from_alias_table_
;
ObRawExpr
*
real_expr_
;
// for oracle virtual table that is mapping a real table
};
...
...
src/sql/resolver/expr/ob_raw_expr_printer.cpp
浏览文件 @
4640a92c
...
...
@@ -280,6 +280,9 @@ int ObRawExprPrinter::print(ObColumnRefRawExpr* expr)
is_oracle_mode
?
"
\"
%.*s
\"
.
\"
%.*s
\"
"
:
"`%.*s`.`%.*s`"
,
LEN_AND_PTR
(
table_name
),
LEN_AND_PTR
(
col_name
));
}
else
if
(
OB_UNLIKELY
(
only_column_namespace_
))
{
DATA_PRINTF
(
is_oracle_mode
?
"
\"
%.*s
\"
"
:
"`%.*s`"
,
LEN_AND_PTR
(
col_name
));
}
else
if
(
expr
->
is_from_alias_table
())
{
DATA_PRINTF
(
is_oracle_mode
?
"
\"
%.*s
\"
.
\"
%.*s
\"
"
:
"`%.*s`.`%.*s`"
,
LEN_AND_PTR
(
expr
->
get_table_name
()),
LEN_AND_PTR
(
col_name
));
}
else
{
if
(
!
expr
->
get_synonym_name
().
empty
()
&&
!
expr
->
get_synonym_db_name
().
empty
())
{
ObString
synonyn_db_name
=
expr
->
get_synonym_db_name
();
...
...
src/sql/session/ob_basic_session_info.h
浏览文件 @
4640a92c
...
...
@@ -1259,48 +1259,31 @@ public:
int
get_max_allowed_packet
(
int64_t
&
max_allowed_pkt
)
const
;
int
get_net_buffer_length
(
int64_t
&
net_buffer_len
)
const
;
/// @}
int64_t
get_session_info_mem_size
()
const
{
return
block_allocator_
.
get_total_mem_size
();
}
int64_t
get_sys_var_mem_size
()
const
{
return
base_sys_var_alloc_
.
total
();
}
// for improving cache miss of proxy, nothing to do with the set_partition_hit() above.
ObPartitionHitInfo
&
partition_hit
()
{
return
partition_hit_
;
}
void
set_shadow
(
bool
is_shadow
)
{
ATOMIC_STORE
(
&
thread_data_
.
is_shadow_
,
is_shadow
);
}
bool
is_shadow
()
{
return
ATOMIC_LOAD
(
&
thread_data_
.
is_shadow_
);
}
uint32_t
get_version
()
const
{
return
version_
;
}
uint32_t
get_magic_num
()
{
return
magic_num_
;
}
int64_t
get_current_execution_id
()
const
{
return
current_execution_id_
;
}
const
common
::
ObCurTraceId
::
TraceId
&
get_last_trace_id
()
const
{
return
last_trace_id_
;
}
void
set_current_execution_id
(
int64_t
execution_id
)
{
current_execution_id_
=
execution_id
;
}
void
set_last_trace_id
(
common
::
ObCurTraceId
::
TraceId
*
trace_id
)
int64_t
get_session_info_mem_size
()
const
{
return
block_allocator_
.
get_total_mem_size
();
}
int64_t
get_sys_var_mem_size
()
const
{
return
base_sys_var_alloc_
.
total
();
}
ObPartitionHitInfo
&
partition_hit
()
{
return
partition_hit_
;
}
// 和上面的set_partition_hit没有任何关系
bool
get_err_final_partition_hit
(
int
err_ret
)
{
bool
is_partition_hit
=
partition_hit
().
get_bool
();
if
(
is_proxy_refresh_location_ret
(
err_ret
))
{
is_partition_hit
=
false
;
}
else
if
(
get_is_in_retry
()
&&
is_proxy_refresh_location_ret
(
retry_info_
.
get_last_query_retry_err
()))
{
is_partition_hit
=
false
;
}
return
is_partition_hit
;
};
bool
is_proxy_refresh_location_ret
(
int
err_ret
)
{
return
common
::
OB_NOT_MASTER
==
err_ret
;
}
void
set_shadow
(
bool
is_shadow
)
{
ATOMIC_STORE
(
&
thread_data_
.
is_shadow_
,
is_shadow
);
}
bool
is_shadow
()
{
return
ATOMIC_LOAD
(
&
thread_data_
.
is_shadow_
);
}
uint32_t
get_version
()
const
{
return
version_
;}
uint32_t
get_magic_num
()
{
return
magic_num_
;}
int64_t
get_current_execution_id
()
const
{
return
current_execution_id_
;
}
const
common
::
ObCurTraceId
::
TraceId
&
get_last_trace_id
()
const
{
return
last_trace_id_
;
}
void
set_current_execution_id
(
int64_t
execution_id
)
{
current_execution_id_
=
execution_id
;
}
void
set_last_trace_id
(
common
::
ObCurTraceId
::
TraceId
*
trace_id
)
{
if
(
OB_ISNULL
(
trace_id
))
{
}
else
{
...
...
src/sql/session/ob_sql_session_info.cpp
浏览文件 @
4640a92c
...
...
@@ -803,7 +803,9 @@ int ObSQLSessionInfo::get_ps_session_info(const ObPsStmtId stmt_id, ObPsSessionI
int
ObSQLSessionInfo
::
remove_ps_session_info
(
const
ObPsStmtId
stmt_id
)
{
int
ret
=
OB_SUCCESS
;
ObPsSessionInfo
*
session_info
=
NULL
;
ObPsSessionInfo
*
session_info
=
NULL
;
LOG_TRACE
(
"remove ps session info"
,
K
(
ret
),
K
(
stmt_id
),
K
(
get_sessid
()),
K
(
lbt
()));
if
(
OB_FAIL
(
ps_session_info_map_
.
erase_refactored
(
stmt_id
,
&
session_info
)))
{
LOG_WARN
(
"ps session info not exist"
,
K
(
stmt_id
));
}
else
if
(
OB_ISNULL
(
session_info
))
{
...
...
unittest/sql/rewrite/result/test_transformer_stmt_after_together.result
浏览文件 @
4640a92c
...
...
@@ -65110,8 +65110,8 @@ SQL: select * from vv1;
]
},
"is_alias":false,
"alias_name":"(`
opt`.`
t1`.`c1` + 2)",
"expr_name":"(`
opt`.`
t1`.`c1` + 2)",
"alias_name":"(`t1`.`c1` + 2)",
"expr_name":"(`t1`.`c1` + 2)",
"default": {
"NULL":"NULL"
},
...
...
@@ -65355,7 +65355,7 @@ SQL: select * from vv1;
},
"is_alias":false,
"alias_name":"c1",
"expr_name":"`
opt`.`
t1`.`c1`",
"expr_name":"`t1`.`c1`",
"default": {
"NULL":"NULL"
},
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录