to issue<52247541>:adjust sql retry times if report 6005 in autonomous tranasction

This commit is contained in:
hanr881
2023-11-01 06:13:15 +00:00
committed by ob-robot
parent 933a2b5031
commit cd77c9096b
3 changed files with 19 additions and 1 deletions

View File

@ -560,7 +560,9 @@ public:
// sql which in pl will local retry first. see ObInnerSQLConnection::process_retry. // sql which in pl will local retry first. see ObInnerSQLConnection::process_retry.
// sql which not in pl use the same strategy to avoid never getting the lock. // sql which not in pl use the same strategy to avoid never getting the lock.
if (v.is_from_pl_) { if (v.is_from_pl_) {
if (v.local_retry_times_ <= 1 || !v.session_.get_pl_can_retry()) { if (v.local_retry_times_ <= 1 ||
!v.session_.get_pl_can_retry() ||
ObSQLUtils::is_in_autonomous_block(v.session_.get_cur_exec_ctx())) {
v.no_more_test_ = true; v.no_more_test_ = true;
v.retry_type_ = RETRY_TYPE_LOCAL; v.retry_type_ = RETRY_TYPE_LOCAL;
} else { } else {

View File

@ -4473,6 +4473,21 @@ bool ObSQLUtils::is_nested_sql(ObExecContext *cur_ctx)
return is_pl_nested_sql(cur_ctx) || is_fk_nested_sql(cur_ctx); return is_pl_nested_sql(cur_ctx) || is_fk_nested_sql(cur_ctx);
} }
bool ObSQLUtils::is_in_autonomous_block(ObExecContext *cur_ctx)
{
bool bret = false;
pl::ObPLContext *pl_context = nullptr;
if (cur_ctx != nullptr) {
pl_context = cur_ctx->get_pl_stack_ctx();
for (; !bret && pl_context != nullptr; pl_context = pl_context->get_parent_stack_ctx()) {
if (pl_context->in_autonomous()) {
bret = true;
}
}
}
return bret;
}
bool ObSQLUtils::is_select_from_dual(ObExecContext &ctx) bool ObSQLUtils::is_select_from_dual(ObExecContext &ctx)
{ {
bool bret = false; bool bret = false;

View File

@ -581,6 +581,7 @@ public:
static bool is_fk_nested_sql(ObExecContext *cur_ctx); static bool is_fk_nested_sql(ObExecContext *cur_ctx);
static bool is_iter_uncommitted_row(ObExecContext *cur_ctx); static bool is_iter_uncommitted_row(ObExecContext *cur_ctx);
static bool is_nested_sql(ObExecContext *cur_ctx); static bool is_nested_sql(ObExecContext *cur_ctx);
static bool is_in_autonomous_block(ObExecContext *cur_ctx);
static bool is_select_from_dual(ObExecContext &ctx); static bool is_select_from_dual(ObExecContext &ctx);
static int get_obj_from_ext_obj(const ObObjParam &ext_obj, int64_t pos, ObObj *&obj); static int get_obj_from_ext_obj(const ObObjParam &ext_obj, int64_t pos, ObObj *&obj);