fix report scn logic when batch looping medium merge
This commit is contained in:
@ -598,8 +598,8 @@ int ObPartitionMergeHelper::init_merge_iters(const ObIPartitionMergeFuser &fuser
|
|||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
STORAGE_LOG(WARN, "unexpected null iter", K(ret), K(i), K(merge_param));
|
STORAGE_LOG(WARN, "unexpected null iter", K(ret), K(i), K(merge_param));
|
||||||
} else if (OB_UNLIKELY(table->is_remote_logical_minor_sstable())) {
|
} else if (OB_UNLIKELY(table->is_remote_logical_minor_sstable())) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_EAGAIN;
|
||||||
LOG_WARN("unexpected remote minor sstable", K(ret), KP(sstable));
|
LOG_WARN("unexpected remote minor sstable, try later", K(ret), KP(sstable));
|
||||||
} else if (table->is_sstable()) {
|
} else if (table->is_sstable()) {
|
||||||
sstable = static_cast<ObSSTable *>(table);
|
sstable = static_cast<ObSSTable *>(table);
|
||||||
if (sstable->get_data_macro_block_count() <= 0) {
|
if (sstable->get_data_macro_block_count() <= 0) {
|
||||||
|
|||||||
@ -1259,7 +1259,6 @@ int ObTenantTabletScheduler::schedule_all_tablets_medium()
|
|||||||
LOG_WARN("failed to init iterator", K(ret));
|
LOG_WARN("failed to init iterator", K(ret));
|
||||||
} else {
|
} else {
|
||||||
bool all_ls_weak_read_ts_ready = true;
|
bool all_ls_weak_read_ts_ready = true;
|
||||||
bool check_report_scn_flag = false;
|
|
||||||
int64_t merge_version = get_frozen_version();
|
int64_t merge_version = get_frozen_version();
|
||||||
ObLSHandle ls_handle;
|
ObLSHandle ls_handle;
|
||||||
ObLS *ls = nullptr;
|
ObLS *ls = nullptr;
|
||||||
@ -1276,7 +1275,7 @@ int ObTenantTabletScheduler::schedule_all_tablets_medium()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (REACH_TENANT_TIME_INTERVAL(CHECK_REPORT_SCN_INTERVAL)) {
|
if (REACH_TENANT_TIME_INTERVAL(CHECK_REPORT_SCN_INTERVAL)) {
|
||||||
check_report_scn_flag = true;
|
medium_ls_tablet_iter_.set_report_scn_flag();
|
||||||
}
|
}
|
||||||
if (REACH_TENANT_TIME_INTERVAL(CHECK_LS_LOCALITY_INTERVAL)) {
|
if (REACH_TENANT_TIME_INTERVAL(CHECK_LS_LOCALITY_INTERVAL)) {
|
||||||
if (OB_TMP_FAIL(ls_locality_cache_.refresh_ls_locality())) {
|
if (OB_TMP_FAIL(ls_locality_cache_.refresh_ls_locality())) {
|
||||||
@ -1286,7 +1285,7 @@ int ObTenantTabletScheduler::schedule_all_tablets_medium()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef ERRSIM
|
#ifdef ERRSIM
|
||||||
check_report_scn_flag = true;
|
medium_ls_tablet_iter_.set_report_scn_flag();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (OB_SUCC(ret) && schedule_tablet_cnt < SCHEDULE_TABLET_BATCH_CNT) {
|
while (OB_SUCC(ret) && schedule_tablet_cnt < SCHEDULE_TABLET_BATCH_CNT) {
|
||||||
@ -1313,7 +1312,7 @@ int ObTenantTabletScheduler::schedule_all_tablets_medium()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// loop tablet_meta table to update smaller report_scn because of migration
|
// loop tablet_meta table to update smaller report_scn because of migration
|
||||||
if (OB_SUCC(ret) && check_report_scn_flag) {
|
if (OB_SUCC(ret) && medium_ls_tablet_iter_.need_report_scn()) {
|
||||||
int tmp_ret = update_report_scn_as_ls_leader(*ls);
|
int tmp_ret = update_report_scn_as_ls_leader(*ls);
|
||||||
|
|
||||||
#ifndef ERRSIM
|
#ifndef ERRSIM
|
||||||
@ -1459,6 +1458,7 @@ int ObCompactionScheduleIterator::build_iter()
|
|||||||
tablet_ids_.reuse();
|
tablet_ids_.reuse();
|
||||||
scan_finish_ = false;
|
scan_finish_ = false;
|
||||||
merge_finish_ = true;
|
merge_finish_ = true;
|
||||||
|
report_scn_flag_ = false;
|
||||||
LOG_TRACE("build iter", K(ret), K(ls_ids_));
|
LOG_TRACE("build iter", K(ret), K(ls_ids_));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -1499,6 +1499,7 @@ void ObCompactionScheduleIterator::reset()
|
|||||||
tablet_ids_.reuse();
|
tablet_ids_.reuse();
|
||||||
scan_finish_ = false;
|
scan_finish_ = false;
|
||||||
merge_finish_ = false;
|
merge_finish_ = false;
|
||||||
|
report_scn_flag_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObCompactionScheduleIterator::is_valid() const
|
bool ObCompactionScheduleIterator::is_valid() const
|
||||||
@ -1551,7 +1552,7 @@ int64_t ObCompactionScheduleIterator::to_string(char *buf, const int64_t buf_len
|
|||||||
{
|
{
|
||||||
int64_t pos = 0;
|
int64_t pos = 0;
|
||||||
J_OBJ_START();
|
J_OBJ_START();
|
||||||
J_KV(K_(ls_idx), K_(ls_ids), K_(tablet_idx), K(tablet_ids_.count()));
|
J_KV(K_(report_scn_flag), K_(ls_idx), K_(ls_ids), K_(tablet_idx), K(tablet_ids_.count()));
|
||||||
if (is_valid()) {
|
if (is_valid()) {
|
||||||
J_COMMA();
|
J_COMMA();
|
||||||
J_KV("cur_ls", ls_ids_.at(ls_idx_), K_(tablet_idx));
|
J_KV("cur_ls", ls_ids_.at(ls_idx_), K_(tablet_idx));
|
||||||
|
|||||||
@ -65,6 +65,7 @@ public:
|
|||||||
ObLSGetMod mod = ObLSGetMod::STORAGE_MOD,
|
ObLSGetMod mod = ObLSGetMod::STORAGE_MOD,
|
||||||
const int64_t timeout_us = 0)
|
const int64_t timeout_us = 0)
|
||||||
: mod_(mod),
|
: mod_(mod),
|
||||||
|
report_scn_flag_(false),
|
||||||
is_major_(is_major),
|
is_major_(is_major),
|
||||||
scan_finish_(false),
|
scan_finish_(false),
|
||||||
merge_finish_(false),
|
merge_finish_(false),
|
||||||
@ -80,6 +81,8 @@ public:
|
|||||||
int get_next_tablet(ObLSHandle &ls_handle, ObTabletHandle &tablet_handle);
|
int get_next_tablet(ObLSHandle &ls_handle, ObTabletHandle &tablet_handle);
|
||||||
bool is_scan_finish() const { return scan_finish_; }
|
bool is_scan_finish() const { return scan_finish_; }
|
||||||
bool tenant_merge_finish() const { return merge_finish_ & scan_finish_; }
|
bool tenant_merge_finish() const { return merge_finish_ & scan_finish_; }
|
||||||
|
void set_report_scn_flag() { report_scn_flag_ = true; }
|
||||||
|
bool need_report_scn() const { return report_scn_flag_; }
|
||||||
void update_merge_finish(bool merge_finish) {
|
void update_merge_finish(bool merge_finish) {
|
||||||
merge_finish_ &= merge_finish;
|
merge_finish_ &= merge_finish;
|
||||||
}
|
}
|
||||||
@ -96,6 +99,7 @@ private:
|
|||||||
static const int64_t LS_ID_ARRAY_CNT = 10;
|
static const int64_t LS_ID_ARRAY_CNT = 10;
|
||||||
static const int64_t TABLET_ID_ARRAY_CNT = 2000;
|
static const int64_t TABLET_ID_ARRAY_CNT = 2000;
|
||||||
ObLSGetMod mod_;
|
ObLSGetMod mod_;
|
||||||
|
bool report_scn_flag_;
|
||||||
bool is_major_;
|
bool is_major_;
|
||||||
bool scan_finish_;
|
bool scan_finish_;
|
||||||
bool merge_finish_;
|
bool merge_finish_;
|
||||||
|
|||||||
Reference in New Issue
Block a user