Fix weak read timeout bug
This commit is contained in:
@ -377,7 +377,7 @@ int ObTenantWeakReadClusterService::start_service()
|
|||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_ERROR("WRS leader epoch is invalid", KR(ret), K(leader_epoch));
|
LOG_ERROR("WRS leader epoch is invalid", KR(ret), K(leader_epoch));
|
||||||
} else {
|
} else {
|
||||||
SCN cur_min_version, cur_max_version, gts_scn;
|
SCN cur_min_version, cur_max_version, gts_scn, gts_barrier_scn;
|
||||||
bool record_exist = false;
|
bool record_exist = false;
|
||||||
|
|
||||||
begin_query_ts = ObTimeUtility::current_time();
|
begin_query_ts = ObTimeUtility::current_time();
|
||||||
@ -387,15 +387,13 @@ int ObTenantWeakReadClusterService::start_service()
|
|||||||
LOG_WARN("query cluster version range from WRS table fail", KR(ret));
|
LOG_WARN("query cluster version range from WRS table fail", KR(ret));
|
||||||
} else if (OB_FAIL(OB_TS_MGR.get_gts(tenant_id, NULL, gts_scn))) {
|
} else if (OB_FAIL(OB_TS_MGR.get_gts(tenant_id, NULL, gts_scn))) {
|
||||||
LOG_WARN("get gts error", K(ret), K(cur_min_version), K(cur_max_version));
|
LOG_WARN("get gts error", K(ret), K(cur_min_version), K(cur_max_version));
|
||||||
|
} else if (OB_FAIL(gts_barrier_scn.convert_from_ts(gts_scn.convert_to_ts() - max_stale_time))) {
|
||||||
|
LOG_WARN("convert from ts error", K(ret), K(gts_scn), K(gts_barrier_scn));
|
||||||
} else {
|
} else {
|
||||||
begin_persist_ts = ObTimeUtility::current_time();
|
begin_persist_ts = ObTimeUtility::current_time();
|
||||||
|
|
||||||
// new weak read version delay should smaller than max_stale_time
|
// new weak read version delay should smaller than max_stale_time
|
||||||
int64_t new_version = MAX(cur_max_version.convert_to_ts(), gts_scn.convert_to_ts() - max_stale_time);
|
SCN new_version_scn = SCN::max(cur_max_version, gts_barrier_scn);
|
||||||
SCN new_version_scn;
|
|
||||||
if (OB_FAIL(new_version_scn.convert_from_ts(new_version))) {
|
|
||||||
LOG_ERROR("convert for gts fail", KR(ret));
|
|
||||||
} else {
|
|
||||||
SCN new_min_version = new_version_scn;
|
SCN new_min_version = new_version_scn;
|
||||||
SCN new_max_version = generate_max_version_(new_min_version);
|
SCN new_max_version = generate_max_version_(new_min_version);
|
||||||
int64_t affected_rows = 0;
|
int64_t affected_rows = 0;
|
||||||
@ -407,6 +405,13 @@ int ObTenantWeakReadClusterService::start_service()
|
|||||||
K(cur_max_version), K(new_min_version), K(new_max_version), K(max_stale_time),
|
K(cur_max_version), K(new_min_version), K(new_max_version), K(max_stale_time),
|
||||||
K(record_exist), K(affected_rows), K(error_count_for_change_leader_),
|
K(record_exist), K(affected_rows), K(error_count_for_change_leader_),
|
||||||
K(last_error_tstamp_for_change_leader_));
|
K(last_error_tstamp_for_change_leader_));
|
||||||
|
} else if (new_min_version < min_version_ || new_max_version < max_version_) {
|
||||||
|
ret = OB_ERR_UNEXPECTED;
|
||||||
|
LOG_ERROR("unexpected new_min_version or new_max_version", K(new_min_version),
|
||||||
|
K(new_max_version),
|
||||||
|
K(min_version_),
|
||||||
|
K(max_version_),
|
||||||
|
K(current_version_));
|
||||||
} else {
|
} else {
|
||||||
// init version
|
// init version
|
||||||
min_version_ = new_min_version;
|
min_version_ = new_min_version;
|
||||||
@ -420,7 +425,6 @@ int ObTenantWeakReadClusterService::start_service()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (OB_SUCCESS == ret) {
|
if (OB_SUCCESS == ret) {
|
||||||
// update the active server number after service start,
|
// update the active server number after service start,
|
||||||
|
|||||||
Reference in New Issue
Block a user