fix leader don't be added to the blacklist
This commit is contained in:
@ -1237,12 +1237,19 @@ int ObLS::get_ls_info(ObLSVTInfo &ls_info)
|
||||
} else if (OB_FAIL(ls_tx_svr_.check_tx_blocked(tx_blocked))) {
|
||||
LOG_WARN("check tx ls state error", K(ret),KPC(this));
|
||||
} else {
|
||||
// The readable point of the primary tenant is weak read ts,
|
||||
// and the readable point of the standby tenant is readable scn
|
||||
if (MTL_IS_PRIMARY_TENANT()) {
|
||||
ls_info.weak_read_scn_ = ls_wrs_handler_.get_ls_weak_read_ts();
|
||||
} else if (OB_FAIL(get_ls_replica_readable_scn(ls_info.weak_read_scn_))) {
|
||||
TRANS_LOG(WARN, "get ls replica readable scn fail", K(ret), KPC(this));
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
ls_info.ls_id_ = ls_meta_.ls_id_;
|
||||
ls_info.replica_type_ = ls_meta_.get_replica_type();
|
||||
ls_info.ls_state_ = role;
|
||||
ls_info.migrate_status_ = migrate_status;
|
||||
ls_info.tablet_count_ = ls_tablet_svr_.get_tablet_count();
|
||||
ls_info.weak_read_scn_ = ls_wrs_handler_.get_ls_weak_read_ts();
|
||||
ls_info.need_rebuild_ = is_need_rebuild;
|
||||
ls_info.checkpoint_scn_ = ls_meta_.get_clog_checkpoint_scn();
|
||||
ls_info.checkpoint_lsn_ = ls_meta_.get_clog_base_lsn().val_;
|
||||
@ -1254,6 +1261,7 @@ int ObLS::get_ls_info(ObLSVTInfo &ls_info)
|
||||
TRANS_LOG(INFO, "current ls is blocked", K(ls_info));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ int ObBLService::do_black_list_check_(sqlclient::ObMySQLResult *result)
|
||||
SCN gts_scn;
|
||||
if (OB_FAIL(get_info_from_result_(*result, bl_key, ls_info))) {
|
||||
TRANS_LOG(WARN, "get_info_from_result_ fail ", KR(ret), K(result));
|
||||
} else if (ls_info.is_leader()) {
|
||||
} else if (ls_info.is_leader() && check_need_skip_leader_(bl_key.get_tenant_id())) {
|
||||
// cannot add leader into blacklist
|
||||
} else if (ls_info.weak_read_scn_ == 0) {
|
||||
// log stream is initializing, should't be put into blacklist
|
||||
@ -274,6 +274,21 @@ int ObBLService::do_black_list_check_(sqlclient::ObMySQLResult *result)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ObBLService::check_need_skip_leader_(const uint64_t tenant_id)
|
||||
{
|
||||
bool need_skip = true;
|
||||
int ret = OB_SUCCESS;
|
||||
MTL_SWITCH(tenant_id) {
|
||||
if (!MTL_IS_PRIMARY_TENANT()) {
|
||||
need_skip = false;
|
||||
}
|
||||
}
|
||||
if (!need_skip) {
|
||||
TRANS_LOG(INFO, "needn't skip leader", KR(ret), K(need_skip), K(tenant_id));
|
||||
}
|
||||
return need_skip;
|
||||
}
|
||||
|
||||
int ObBLService::do_clean_up_()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -380,6 +380,7 @@ private:
|
||||
int do_clean_up_();
|
||||
int get_info_from_result_(sqlclient::ObMySQLResult &result, ObBLKey &bl_key, ObLsInfo &ls_info);
|
||||
int64_t get_tenant_max_stale_time_(uint64_t tenant_id);
|
||||
bool check_need_skip_leader_(const uint64_t tenant_id);
|
||||
void print_stat_();
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user