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