Close ob_max_read_stale_time system variable for weak read

This commit is contained in:
obdev
2023-03-26 03:11:40 +00:00
committed by ob-robot
parent b0a7373cb9
commit 4f5644639c
2 changed files with 8 additions and 2 deletions

View File

@ -1157,12 +1157,16 @@ int ObSqlTransControl::check_ls_readable(const uint64_t tenant_id,
} else if (OB_ISNULL(ls = handle.get_ls())) { } else if (OB_ISNULL(ls = handle.get_ls())) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("id service log stream not exist"); LOG_WARN("id service log stream not exist");
} else {
can_read = true;
}
/*
} else if (ObTimeUtility::current_time() - max_stale_time_us } else if (ObTimeUtility::current_time() - max_stale_time_us
< ls->get_ls_wrs_handler()->get_ls_weak_read_ts().convert_to_ts()) { < ls->get_ls_wrs_handler()->get_ls_weak_read_ts().convert_to_ts()) {
can_read = true; can_read = true;
} else if (REACH_TIME_INTERVAL(10 * 1000 * 1000)) { } else if (REACH_TIME_INTERVAL(10 * 1000 * 1000)) {
LOG_WARN("log stream unreadable", K(ls_id), K(addr), K(max_stale_time_us)); LOG_WARN("log stream unreadable", K(ls_id), K(addr), K(max_stale_time_us));
} }*/
} else { } else {
LOG_TRACE("log stream is not local", K(ls_id), K(addr)); LOG_TRACE("log stream is not local", K(ls_id), K(addr));
} }

View File

@ -715,6 +715,7 @@ ERRSIM_POINT_DEF(ERRSIM_WEAK_READ_SNAPSHOT_DELAY_US);
int ObTransService::get_weak_read_snapshot_version(const int64_t max_read_stale_time, int ObTransService::get_weak_read_snapshot_version(const int64_t max_read_stale_time,
SCN &snapshot) SCN &snapshot)
{ {
UNUSED(max_read_stale_time);
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
bool monotinic_read = true;; bool monotinic_read = true;;
// server weak read version // server weak read version
@ -730,7 +731,8 @@ 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)) {
const int64_t snapshot_barrier = ObTimeUtility::current_time() - max_read_stale_time int64_t max_stale_time = ObWeakReadUtil::max_stale_time_for_weak_consistency(tenant_id_, 0);
const int64_t snapshot_barrier = ObTimeUtility::current_time() - max_stale_time
+ abs(ERRSIM_WEAK_READ_SNAPSHOT_DELAY_US); + abs(ERRSIM_WEAK_READ_SNAPSHOT_DELAY_US);
if (snapshot.convert_to_ts() < snapshot_barrier) { if (snapshot.convert_to_ts() < snapshot_barrier) {
TRANS_LOG(WARN, "weak read snapshot too stale", K(snapshot), TRANS_LOG(WARN, "weak read snapshot too stale", K(snapshot),