[CP] scheduler iter reset errno

This commit is contained in:
yangqise7en
2023-09-20 13:44:17 +00:00
committed by ob-robot
parent 7e58c0831b
commit 526eb5bf90
5 changed files with 24 additions and 17 deletions

View File

@ -271,6 +271,8 @@ int ObMediumCompactionScheduleFunc::schedule_next_medium_for_leader(
} }
#endif #endif
ret = schedule_next_medium_primary_cluster(major_snapshot, schedule_stat); ret = schedule_next_medium_primary_cluster(major_snapshot, schedule_stat);
} else {
LOG_TRACE("not leader", K(ret), K(role), K(ls_.get_ls_id()));
} }
return ret; return ret;
} }
@ -338,8 +340,8 @@ int ObMediumCompactionScheduleFunc::schedule_next_medium_primary_cluster(
} else if (OB_ISNULL(medium_info_list_)) { } else if (OB_ISNULL(medium_info_list_)) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("medium info list is unexpected null", K(ret), KPC(this), KPC_(medium_info_list)); LOG_WARN("medium info list is unexpected null", K(ret), KPC(this), KPC_(medium_info_list));
} else if (!medium_info_list_->could_schedule_next_round()) { // check medium list int mds_table } else if (!medium_info_list_->could_schedule_next_round(last_major->get_snapshot_version())) {
// do nothing // check medium list int mds_table
} else if (OB_FAIL(get_adaptive_reason(schedule_major_snapshot, adaptive_merge_reason))) { } else if (OB_FAIL(get_adaptive_reason(schedule_major_snapshot, adaptive_merge_reason))) {
LOG_WARN("failed to get adaptive reason", KR(ret), K(schedule_major_snapshot)); LOG_WARN("failed to get adaptive reason", KR(ret), K(schedule_major_snapshot));
} else if (adaptive_merge_reason > ObAdaptiveMergePolicy::AdaptiveMergeReason::NONE) { } else if (adaptive_merge_reason > ObAdaptiveMergePolicy::AdaptiveMergeReason::NONE) {

View File

@ -678,5 +678,17 @@ int ObMediumCompactionInfoList::get_max_sync_medium_scn(int64_t &max_sync_medium
return ret; return ret;
} }
bool ObMediumCompactionInfoList::could_schedule_next_round(const int64_t last_major_snapshot) const
{
bool exist = false;
DLIST_FOREACH_NORET(info, get_list()) {
if (info->medium_snapshot_ > last_major_snapshot) {
exist = true;
break;
}
}
return !need_check_finish() && !exist;
}
} //namespace compaction } //namespace compaction
} // namespace oceanbase } // namespace oceanbase

View File

@ -102,7 +102,6 @@ public:
common::ObIAllocator &allocator, common::ObIAllocator &allocator,
const ObExtraMediumInfo &extra_medium_info, const ObExtraMediumInfo &extra_medium_info,
const ObTabletDumpedMediumInfo *medium_info_list); const ObTabletDumpedMediumInfo *medium_info_list);
void reset(); void reset();
OB_INLINE bool is_empty() const { return 0 == medium_info_list_.get_size(); } OB_INLINE bool is_empty() const { return 0 == medium_info_list_.get_size(); }
OB_INLINE int64_t size() const { return medium_info_list_.get_size(); } OB_INLINE int64_t size() const { return medium_info_list_.get_size(); }
@ -115,10 +114,7 @@ public:
OB_INLINE int64_t get_wait_check_medium_scn() const { return extra_info_.wait_check_flag_ ? extra_info_.last_medium_scn_ : 0; } OB_INLINE int64_t get_wait_check_medium_scn() const { return extra_info_.wait_check_flag_ ? extra_info_.last_medium_scn_ : 0; }
OB_INLINE bool need_check_finish() const { return get_wait_check_medium_scn() > 0; } OB_INLINE bool need_check_finish() const { return get_wait_check_medium_scn() > 0; }
// check status on serialized medium list // check status on serialized medium list
OB_INLINE bool could_schedule_next_round() const OB_INLINE bool could_schedule_next_round(const int64_t last_major_snapshot) const;
{
return !need_check_finish() && medium_info_list_.is_empty();
}
OB_INLINE ObMediumCompactionInfo::ObCompactionType get_last_compaction_type() const OB_INLINE ObMediumCompactionInfo::ObCompactionType get_last_compaction_type() const
{ {
return static_cast<ObMediumCompactionInfo::ObCompactionType>(extra_info_.last_compaction_type_); return static_cast<ObMediumCompactionInfo::ObCompactionType>(extra_info_.last_compaction_type_);

View File

@ -1677,7 +1677,7 @@ int ObCompactionScheduleIterator::get_next_ls(ObLSHandle &ls_handle)
++ls_idx_; ++ls_idx_;
ls_tablet_svr_ = nullptr; ls_tablet_svr_ = nullptr;
tablet_ids_.reuse(); tablet_ids_.reuse();
LOG_TRACE("tablet iter end", K(ret), K(ls_idx_), K(tablet_idx_), "tablet_cnt", tablet_ids_.count()); LOG_TRACE("tablet iter end", K(ret), K(ls_idx_), K(tablet_idx_), "tablet_cnt", tablet_ids_.count(), K_(ls_ids));
} }
do { do {
if (finish_cur_batch_) { if (finish_cur_batch_) {
@ -1688,10 +1688,11 @@ int ObCompactionScheduleIterator::get_next_ls(ObLSHandle &ls_handle)
} else if (OB_FAIL(get_cur_ls_handle(ls_handle))) { } else if (OB_FAIL(get_cur_ls_handle(ls_handle))) {
if (OB_LS_NOT_EXIST == ret) { if (OB_LS_NOT_EXIST == ret) {
LOG_TRACE("ls not exist", K(ret), K(ls_idx_), K(ls_ids_[ls_idx_])); LOG_TRACE("ls not exist", K(ret), K(ls_idx_), K(ls_ids_[ls_idx_]));
skip_cur_ls();
} else { } else {
LOG_WARN("failed to get ls", K(ret), K(ls_idx_), K(ls_ids_[ls_idx_])); LOG_WARN("failed to get ls", K(ret), K(ls_idx_), K(ls_ids_[ls_idx_]));
ret = OB_LS_NOT_EXIST;
} }
skip_cur_ls();
} else { } else {
ls_tablet_svr_ = ls_handle.get_ls()->get_tablet_svr(); ls_tablet_svr_ = ls_handle.get_ls()->get_tablet_svr();
} }
@ -1745,11 +1746,11 @@ int ObCompactionScheduleIterator::get_next_tablet(ObTabletHandle &tablet_handle)
} else { } else {
const common::ObTabletID &tablet_id = tablet_ids_.at(tablet_idx_); const common::ObTabletID &tablet_id = tablet_ids_.at(tablet_idx_);
if (OB_FAIL(get_tablet_handle(tablet_id, tablet_handle))) { if (OB_FAIL(get_tablet_handle(tablet_id, tablet_handle))) {
if (OB_TABLET_NOT_EXIST == ret) { if (OB_TABLET_NOT_EXIST != ret) {
tablet_idx_++;
} else {
LOG_WARN("fail to get tablet", K(ret), K(tablet_idx_), K(tablet_id)); LOG_WARN("fail to get tablet", K(ret), K(tablet_idx_), K(tablet_id));
ret = OB_TABLET_NOT_EXIST;
} }
tablet_idx_++;
} else { } else {
tablet_handle.set_wash_priority(WashTabletPriority::WTP_LOW); tablet_handle.set_wash_priority(WashTabletPriority::WTP_LOW);
tablet_idx_++; tablet_idx_++;

View File

@ -139,14 +139,10 @@ void TestCompactionIter::test_iter(
ASSERT_EQ(loop_cnt, iter_cnt / max_batch_tablet_cnt + (iter_cnt % max_batch_tablet_cnt != 0)); ASSERT_EQ(loop_cnt, iter_cnt / max_batch_tablet_cnt + (iter_cnt % max_batch_tablet_cnt != 0));
} else if (error_tablet_idx < 0 || error_tablet_idx >= tablet_cnt_per_ls) { } else if (error_tablet_idx < 0 || error_tablet_idx >= tablet_cnt_per_ls) {
// no errno // no errno
} else if (OB_TABLET_NOT_EXIST == input_errno) { } else {
// for this errno, just skip this tablet // for this errno, just skip this tablet
ASSERT_EQ(iter_cnt, ls_cnt * (tablet_cnt_per_ls - 1)); ASSERT_EQ(iter_cnt, ls_cnt * (tablet_cnt_per_ls - 1));
ASSERT_EQ(loop_cnt, iter_cnt / max_batch_tablet_cnt + (iter_cnt % max_batch_tablet_cnt != 0)); ASSERT_EQ(loop_cnt, iter_cnt / max_batch_tablet_cnt + (iter_cnt % max_batch_tablet_cnt != 0));
} else {
// for this errno, just skip cur ls, reset tablet won't be scheduled
ASSERT_EQ(iter_cnt, ls_cnt * error_tablet_idx);
ASSERT_EQ(loop_cnt, iter_cnt / max_batch_tablet_cnt + (iter_cnt % max_batch_tablet_cnt != 0));
} }
} }