[to #50045111] ps cursor support packet retry

This commit is contained in:
LiuYoung00
2023-06-05 04:50:51 +00:00
committed by ob-robot
parent e4f9ef434a
commit 121b93052a
3 changed files with 36 additions and 2 deletions

View File

@ -1072,6 +1072,22 @@ int ObMPStmtExecute::execute_response(ObSQLSessionInfo &session,
NULL/*result*/, &ret, NULL/*func*/, true);
if (OB_FAIL(ObSPIService::dbms_dynamic_open(&pl_ctx, *cursor))) {
LOG_WARN("open cursor fail. ", K(ret), K(stmt_id_));
if (!THIS_WORKER.need_retry()) {
int cli_ret = OB_SUCCESS;
retry_ctrl_.test_and_save_retry_state(
gctx_, ctx_, result, ret, cli_ret, is_arraybinding_ /*ararybinding only local retry*/);
if (OB_ERR_PROXY_REROUTE == ret) {
LOG_DEBUG("run stmt_query failed, check if need retry",
K(ret), K(cli_ret), K(retry_ctrl_.need_retry()), K_(stmt_id));
} else {
LOG_WARN("run stmt_query failed, check if need retry",
K(ret), K(cli_ret), K(retry_ctrl_.need_retry()), K_(stmt_id));
}
ret = cli_ret;
}
if (OB_ERR_PROXY_REROUTE == ret && !is_arraybinding_) {
need_response_error = true;
}
}
}
/*

View File

@ -453,6 +453,23 @@ int ObMPStmtPrexecute::execute_response(ObSQLSessionInfo &session,
get_ctx().cur_sql_ = sql_;
if (OB_FAIL(ObSPIService::dbms_dynamic_open(&pl_ctx, *cursor))) {
LOG_WARN("cursor open faild.", K(cursor->get_id()));
// select do not support arraybinding
if (!THIS_WORKER.need_retry()) {
int cli_ret = OB_SUCCESS;
retry_ctrl.test_and_save_retry_state(
gctx_, ctx, result, ret, cli_ret, get_arraybounding() /*ararybinding only local retry*/);
if (OB_ERR_PROXY_REROUTE == ret) {
LOG_DEBUG("run stmt_query failed, check if need retry",
K(ret), K(cli_ret), K(retry_ctrl.need_retry()), K_(stmt_id));
} else {
LOG_WARN("run stmt_query failed, check if need retry",
K(ret), K(cli_ret), K(retry_ctrl.need_retry()), K_(stmt_id));
}
ret = cli_ret;
}
if (OB_ERR_PROXY_REROUTE == ret && !get_arraybounding()) {
need_response_error = true;
}
} else {
int64_t row_num = 0;
bool is_fetched = false;

View File

@ -3782,7 +3782,7 @@ int ObSPIService::dbms_cursor_open(ObPLExecCtx *ctx,
*spi_result.get_result_set(),
ret,
cli_ret,
true,
cursor.is_ps_cursor() ? false : true,
true,
cursor.is_ps_cursor() ? false : true);
LOG_WARN("failed to fill_cursor, check if need retry",
@ -3840,7 +3840,8 @@ int ObSPIService::dbms_cursor_open(ObPLExecCtx *ctx,
}
ret = OB_SUCCESS == ret ? close_ret : ret;
retry_cnt++;
} while (RETRY_TYPE_NONE != retry_ctrl.get_retry_type());
} while ((!cursor.is_ps_cursor() && RETRY_TYPE_NONE != retry_ctrl.get_retry_type())
|| (cursor.is_ps_cursor() && RETRY_TYPE_LOCAL == retry_ctrl.get_retry_type()));
session->set_query_start_time(old_query_start_time);
}