fix ls locality diagnose
This commit is contained in:
@ -27,6 +27,7 @@
|
||||
#include "rootserver/freeze/ob_major_freeze_util.h"
|
||||
#include "share/ob_tablet_meta_table_compaction_operator.h"
|
||||
#include "storage/compaction/ob_compaction_util.h"
|
||||
#include "storage/compaction/ob_medium_compaction_func.h"
|
||||
#include "storage/tablet/ob_tablet.h"
|
||||
namespace oceanbase
|
||||
{
|
||||
@ -483,6 +484,15 @@ int ObCompactionDiagnoseMgr::diagnose_tenant_tablet()
|
||||
LOG_WARN("failed to check ls state", K(tmp_ret), KPC(ls), K(need_merge));
|
||||
} else if (need_merge) {
|
||||
const ObLSID &ls_id = ls->get_ls_id();
|
||||
bool is_leader = false;
|
||||
ObRole role = INVALID_ROLE;
|
||||
if (OB_TMP_FAIL(ObMediumCompactionScheduleFunc::get_palf_role(ls_id, role))) {
|
||||
if (OB_LS_NOT_EXIST != tmp_ret) {
|
||||
LOG_WARN("failed to get palf handle role", K(tmp_ret), K(ls_id));
|
||||
}
|
||||
} else if (is_leader_by_election(role)) {
|
||||
is_leader = true;
|
||||
}
|
||||
bool weak_read_ts_ready = ObTenantTabletScheduler::check_weak_read_ts_ready(compaction_scn, *ls);
|
||||
// check weak read ts
|
||||
if (diagnose_major_flag
|
||||
@ -505,7 +515,7 @@ int ObCompactionDiagnoseMgr::diagnose_tenant_tablet()
|
||||
}
|
||||
|
||||
// check ls locality change and leader change
|
||||
if (OB_TMP_FAIL(diagnose_ls_merge(MEDIUM_MERGE, ls_id))) {
|
||||
if (is_leader && OB_TMP_FAIL(diagnose_ls_merge(MEDIUM_MERGE, ls_id))) {
|
||||
LOG_WARN("failed to diagnose about ls locality change", K(tmp_ret));
|
||||
}
|
||||
ObLSTabletIterator tablet_iter(ObTabletCommon::NO_CHECK_GET_TABLET_TIMEOUT_US);
|
||||
|
||||
@ -325,9 +325,11 @@ int ObPartitionMergeProgress::get_progress_info(ObCompactionProgress &input_prog
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (IS_INIT) {
|
||||
int64_t estimate_unfinished_data_size = estimate_occupy_size_ - pre_scanned_row_cnt_ * avg_row_length_;
|
||||
input_progress.data_size_ = estimate_occupy_size_;
|
||||
input_progress.unfinished_data_size_ =
|
||||
0 == estimate_occupy_size_ ? 0 : estimate_occupy_size_ - pre_scanned_row_cnt_ * avg_row_length_;
|
||||
0 == estimate_occupy_size_ ? 0 :
|
||||
(estimate_unfinished_data_size < 0 ? 0 : estimate_unfinished_data_size);
|
||||
input_progress.estimated_finish_time_ = estimated_finish_time_;
|
||||
}
|
||||
return ret;
|
||||
|
||||
@ -947,6 +947,7 @@ int ObTenantTabletScheduler::schedule_ls_medium_merge(
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
bool is_leader = false;
|
||||
bool could_major_merge = false;
|
||||
bool locality_bad_case = false;
|
||||
const int64_t major_frozen_scn = get_frozen_version();
|
||||
ObRole role = INVALID_ROLE;
|
||||
ObLSLocality ls_locality;
|
||||
@ -968,10 +969,9 @@ int ObTenantTabletScheduler::schedule_ls_medium_merge(
|
||||
LOG_WARN("failed to get ls locality", K(ret), K(ls_id));
|
||||
} else if (ls_locality.is_valid()) {
|
||||
if (!ls_locality.check_exist(GCTX.self_addr())) {
|
||||
locality_bad_case = true;
|
||||
ADD_SUSPECT_INFO(MEDIUM_MERGE, ls_id, ObTabletID(INT64_MAX),
|
||||
"maybe bad case: ls leader is not in ls locality", "leader_addr", GCTX.self_addr(), K(ls_locality));
|
||||
} else {
|
||||
DEL_SUSPECT_INFO(MEDIUM_MERGE, ls_id, ObTabletID(INT64_MAX));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -979,6 +979,9 @@ int ObTenantTabletScheduler::schedule_ls_medium_merge(
|
||||
all_ls_weak_read_ts_ready = false;
|
||||
}
|
||||
}
|
||||
if (!locality_bad_case) {
|
||||
DEL_SUSPECT_INFO(MEDIUM_MERGE, ls_id, ObTabletID(INT64_MAX));
|
||||
}
|
||||
|
||||
while (OB_SUCC(ret) && schedule_tablet_cnt < SCHEDULE_TABLET_BATCH_CNT) { // loop all tablet in ls
|
||||
bool tablet_merge_finish = false;
|
||||
|
||||
Reference in New Issue
Block a user