[BUG] fix 4138 because unclear session timestamp

This commit is contained in:
Handora
2023-06-06 07:42:32 +00:00
committed by ob-robot
parent f16a8319fc
commit 82b923c9db
4 changed files with 94 additions and 27 deletions

View File

@ -560,6 +560,16 @@ int ObSqlTransControl::start_stmt(ObExecContext &exec_ctx)
LOG_WARN("call sql stmt end hook fail", K(tmp_ret));
}
}
if (OB_SUCC(ret)
&& !ObSQLUtils::is_nested_sql(&exec_ctx)
&& das_ctx.get_snapshot().core_.version_.is_valid()) {
// maintain the read snapshot version on session for multi-version garbage
// colloecor. It is maintained for all cases except remote exection with ac
// = 1. So we need carefully design the version for the corner case.
session->set_reserved_snapshot_version(das_ctx.get_snapshot().core_.version_);
}
bool print_log = false;
#ifndef NDEBUG
print_log = true;
@ -911,6 +921,10 @@ int ObSqlTransControl::end_stmt(ObExecContext &exec_ctx, const bool rollback)
ret = COVER_SUCC(tmp_ret);
}
if (OB_SUCC(ret) && !ObSQLUtils::is_nested_sql(&exec_ctx)) {
session->reset_reserved_snapshot_version();
}
bool print_log = false;
#ifndef NDEBUG
print_log = true;