Adjust the compatibility for ob_max_read_stale_time for user

This commit is contained in:
obdev
2023-06-08 07:53:44 +00:00
committed by ob-robot
parent f4b390d643
commit 3eee8c1e84
2 changed files with 6 additions and 3 deletions

View File

@ -1202,7 +1202,8 @@ int ObSqlTransControl::check_ls_readable(const uint64_t tenant_id,
|| max_stale_time_us <= -2) { || max_stale_time_us <= -2) {
ret = OB_INVALID_ARGUMENT; ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", K(ls_id), K(addr), K(max_stale_time_us)); LOG_WARN("invalid argument", K(ls_id), K(addr), K(max_stale_time_us));
} else if (max_stale_time_us < 0) { } else if (max_stale_time_us < 0
|| GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_4_2_0_0) {
// no need check // no need check
can_read = true; can_read = true;
} else if (observer::ObServer::get_instance().get_self() == addr) { } else if (observer::ObServer::get_instance().get_self() == addr) {

View File

@ -730,7 +730,9 @@ int ObTransService::get_weak_read_snapshot_version(const int64_t max_read_stale_
// do nothing // do nothing
} }
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
if (max_read_stale_us_for_user < 0) { if (monotinic_read
|| max_read_stale_us_for_user < 0
|| GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_4_2_0_0) {
// no need to check barrier version // no need to check barrier version
snapshot = wrs_scn; snapshot = wrs_scn;
} else { } else {
@ -742,7 +744,7 @@ int ObTransService::get_weak_read_snapshot_version(const int64_t max_read_stale_
} else { } else {
const int64_t current_time_us = MTL_IS_PRIMARY_TENANT() const int64_t current_time_us = MTL_IS_PRIMARY_TENANT()
? std::max(ObTimeUtility::current_time(), gts_cache.convert_to_ts()) ? std::max(ObTimeUtility::current_time(), gts_cache.convert_to_ts())
: 0 ; : gts_cache.convert_to_ts();
current_scn.convert_from_ts(current_time_us - max_read_stale_us_for_user); current_scn.convert_from_ts(current_time_us - max_read_stale_us_for_user);
snapshot = SCN::max(wrs_scn, current_scn); snapshot = SCN::max(wrs_scn, current_scn);
} }