fix max_stale_time_ns is us actually

This commit is contained in:
dimstars
2023-03-11 05:41:12 +00:00
committed by ob-robot
parent a6f4e3965c
commit 8842a2ff03
2 changed files with 7 additions and 5 deletions

View File

@ -1132,7 +1132,7 @@ void ObSqlTransControl::clear_xa_branch(const ObXATransID &xid, ObTxDesc *&tx_de
int ObSqlTransControl::check_ls_readable(const uint64_t tenant_id,
const share::ObLSID &ls_id,
const common::ObAddr &addr,
const int64_t max_stale_time_ns,
const int64_t max_stale_time_us,
bool &can_read)
{
int ret = OB_SUCCESS;
@ -1140,9 +1140,9 @@ int ObSqlTransControl::check_ls_readable(const uint64_t tenant_id,
if (!ls_id.is_valid()
|| !addr.is_valid()
|| max_stale_time_ns <= 0) {
|| max_stale_time_us <= 0) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", K(ls_id), K(addr), K(max_stale_time_ns));
LOG_WARN("invalid argument", K(ls_id), K(addr), K(max_stale_time_us));
} else if (observer::ObServer::get_instance().get_self() == addr) {
storage::ObLSService *ls_svr = MTL(storage::ObLSService *);
storage::ObLSHandle handle;
@ -1156,9 +1156,11 @@ int ObSqlTransControl::check_ls_readable(const uint64_t tenant_id,
} else if (OB_ISNULL(ls = handle.get_ls())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("id service log stream not exist");
} else if (ObTimeUtility::current_time() - max_stale_time_ns / 1000
} else if (ObTimeUtility::current_time() - max_stale_time_us
< ls->get_ls_wrs_handler()->get_ls_weak_read_ts().convert_to_ts()) {
can_read = true;
} else if (REACH_TIME_INTERVAL(10 * 1000 * 1000)) {
LOG_WARN("log stream unreadable", K(ls_id), K(addr), K(max_stale_time_us));
}
} else {
LOG_TRACE("log stream is not local", K(ls_id), K(addr));

View File

@ -238,7 +238,7 @@ public:
static int check_ls_readable(const uint64_t tenant_id,
const share::ObLSID &ls_id,
const common::ObAddr &addr,
const int64_t max_stale_time_ns,
const int64_t max_stale_time_us,
bool &can_read);
private:
DISALLOW_COPY_AND_ASSIGN(ObSqlTransControl);