fix stmt rollback failed cause 4038 returned to client

This commit is contained in:
chinaxing 2023-12-29 07:43:19 +00:00 committed by ob-robot
parent 54a47d33fd
commit 73394d9ef0
2 changed files with 8 additions and 6 deletions

View File

@ -833,7 +833,7 @@ OB_INLINE int ObResultSet::do_close_plan(int errcode, ObExecContext &ctx)
return ret;
}
int ObResultSet::close(int &client_ret)
int ObResultSet::do_close(int *client_ret)
{
int ret = OB_SUCCESS;
LinkExecCtxGuard link_guard(my_session_, get_exec_context());
@ -948,8 +948,9 @@ int ObResultSet::close(int &client_ret)
}
// notify close fail to listener
int err = OB_SUCCESS != do_close_plan_ret ? do_close_plan_ret : ret;
if (OB_SUCCESS != err && err != errcode_ && close_fail_cb_.is_valid()) {
close_fail_cb_(err, client_ret);
if (client_ret != NULL
&& OB_SUCCESS != err && err != errcode_ && close_fail_cb_.is_valid()) {
close_fail_cb_(err, *client_ret);
}
//Save the current execution state to determine whether to refresh location
//and perform other necessary cleanup operations when the statement exits.

View File

@ -122,9 +122,10 @@ public:
/// @return OB_ITER_END when no more data available
int get_next_row(const common::ObNewRow *&row);
/// close the result set after get all the rows
int close() { int unused = 0; return close(unused); }
int close() { return do_close(NULL); }
// close result set and rewrite the client ret
int close(int &client_ret);
int close(int &client_ret) { return do_close(&client_ret); }
/// get number of rows affected by INSERT/UPDATE/DELETE
int64_t get_affected_rows() const;
int64_t get_return_rows() const { return return_rows_; }
@ -346,7 +347,7 @@ private:
int init_cmd_exec_context(ObExecContext &exec_ctx);
int on_cmd_execute();
int auto_end_plan_trans(ObPhysicalPlan& plan, int ret, bool &async);
int do_close(int *client_ret = NULL);
void store_affected_rows(ObPhysicalPlanCtx &plan_ctx);
void store_found_rows(ObPhysicalPlanCtx &plan_ctx);
int store_last_insert_id(ObExecContext &ctx);