fix bug multi_query batch optimization record error affected_row in sql_audit

This commit is contained in:
yishenglanlingzui
2023-08-10 02:48:35 +00:00
committed by ob-robot
parent 668e9415e3
commit 3b8bba9461
3 changed files with 7 additions and 5 deletions

View File

@ -215,10 +215,11 @@ int ObSyncPlanDriver::response_result(ObMySQLResultSet &result)
} else {
//has implicit cursor, send ok packet to client by implicit cursor
result.reset_implicit_cursor_idx();
while (OB_SUCC(ret) && OB_SUCC(result.switch_implicit_cursor())) {
int64_t curr_affected_row = 0;
while (OB_SUCC(ret) && OB_SUCC(result.switch_implicit_cursor(curr_affected_row))) {
ObOKPParam ok_param;
ok_param.message_ = const_cast<char*>(result.get_message());
ok_param.affected_rows_ = result.get_affected_rows();
ok_param.affected_rows_ = curr_affected_row;
ok_param.is_partition_hit_ = session_.partition_hit().get_bool();
ok_param.has_more_result_ = !result.is_cursor_end();
process_ok = true;

View File

@ -1681,9 +1681,10 @@ bool ObResultSet::has_implicit_cursor() const
return bret;
}
int ObResultSet::switch_implicit_cursor()
int ObResultSet::switch_implicit_cursor(int64_t &affected_rows)
{
int ret = OB_SUCCESS;
affected_rows = 0;
ObPhysicalPlanCtx *plan_ctx = get_exec_context().get_physical_plan_ctx();
if (OB_ISNULL(plan_ctx)) {
ret = OB_ERR_UNEXPECTED;
@ -1693,7 +1694,7 @@ int ObResultSet::switch_implicit_cursor()
LOG_WARN("cursor_idx is invalid", K(ret));
}
} else {
set_affected_rows(plan_ctx->get_affected_rows());
affected_rows = plan_ctx->get_affected_rows();
memset(message_, 0, sizeof(message_));
if (OB_FAIL(set_mysql_info())) {
LOG_WARN("set mysql info failed", K(ret));

View File

@ -302,7 +302,7 @@ public:
// 深拷计划中的field columns,存放在field_columns_成员中
int copy_field_columns(const ObPhysicalPlan &plan);
bool has_implicit_cursor() const;
int switch_implicit_cursor();
int switch_implicit_cursor(int64_t &affected_rows);
void reset_implicit_cursor_idx()
{
if (get_exec_context().get_physical_plan_ctx() != nullptr)