diagnose ls only once
This commit is contained in:
		@ -708,11 +708,38 @@ int ObCompactionDiagnoseMgr::get_suspect_info_and_print(
 | 
				
			|||||||
  return ret;
 | 
					  return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ObCompactionDiagnoseMgr::diagnose_ls_merge(
 | 
					void ObCompactionDiagnoseMgr::diagnose_tenant_ls(
 | 
				
			||||||
    const ObMergeType merge_type,
 | 
					    const bool diagnose_major_flag,
 | 
				
			||||||
 | 
					    const bool weak_read_ts_ready,
 | 
				
			||||||
 | 
					    const int64_t compaction_scn,
 | 
				
			||||||
 | 
					    const bool is_leader,
 | 
				
			||||||
    const ObLSID &ls_id)
 | 
					    const ObLSID &ls_id)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  return get_suspect_info_and_print(merge_type, ls_id, ObTabletID(INT64_MAX));
 | 
					  int tmp_ret = OB_SUCCESS;
 | 
				
			||||||
 | 
					  // check weak read ts
 | 
				
			||||||
 | 
					  if (diagnose_major_flag
 | 
				
			||||||
 | 
					      && !weak_read_ts_ready
 | 
				
			||||||
 | 
					      && can_add_diagnose_info()
 | 
				
			||||||
 | 
					      && OB_TMP_FAIL(SET_DIAGNOSE_INFO(
 | 
				
			||||||
 | 
					                info_array_[idx_++],
 | 
				
			||||||
 | 
					                MEDIUM_MERGE,
 | 
				
			||||||
 | 
					                MTL_ID(),
 | 
				
			||||||
 | 
					                ls_id,
 | 
				
			||||||
 | 
					                ObTabletID(INT64_MAX),
 | 
				
			||||||
 | 
					                ObCompactionDiagnoseInfo::DIA_STATUS_FAILED,
 | 
				
			||||||
 | 
					                ObTimeUtility::fast_current_time(),
 | 
				
			||||||
 | 
					                "weak read ts is not ready, compaction_scn",
 | 
				
			||||||
 | 
					                compaction_scn))) {
 | 
				
			||||||
 | 
					    LOG_WARN_RET(tmp_ret, "failed to add dignose info about weak read ts", K(ls_id), K(compaction_scn));
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  // check ls suspect info for memtable freezing
 | 
				
			||||||
 | 
					  if (OB_TMP_FAIL(get_suspect_info_and_print(MINI_MERGE, ls_id, ObTabletID(INT64_MAX)))) {
 | 
				
			||||||
 | 
					    LOG_WARN_RET(tmp_ret, "failed to diagnose about memtable freezing", K(ls_id));
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  // check ls locality change and leader change
 | 
				
			||||||
 | 
					  if (is_leader && OB_TMP_FAIL(get_suspect_info_and_print(MEDIUM_MERGE, ls_id, ObTabletID(INT64_MAX)))) {
 | 
				
			||||||
 | 
					    LOG_WARN_RET(tmp_ret, "failed to diagnose about ls locality change", K(ls_id));
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ObCompactionDiagnoseMgr::get_next_tablet(ObLSID &ls_id)
 | 
					int ObCompactionDiagnoseMgr::get_next_tablet(ObLSID &ls_id)
 | 
				
			||||||
@ -871,6 +898,9 @@ int ObCompactionDiagnoseMgr::diagnose_tenant_tablet()
 | 
				
			|||||||
            LOG_WARN("failed to set ls check status", K(ret), K(ls_id), K(ls_check_status));
 | 
					            LOG_WARN("failed to set ls check status", K(ret), K(ls_id), K(ls_check_status));
 | 
				
			||||||
          } else if (!ls_check_status.need_merge_) {
 | 
					          } else if (!ls_check_status.need_merge_) {
 | 
				
			||||||
            (void)abnormal_ls_id.push_back(ls_id);
 | 
					            (void)abnormal_ls_id.push_back(ls_id);
 | 
				
			||||||
 | 
					          } else {
 | 
				
			||||||
 | 
					            (void)diagnose_tenant_ls(diagnose_major_flag, ls_check_status.weak_read_ts_ready_, compaction_scn,
 | 
				
			||||||
 | 
					                ls_check_status.is_leader_, ls_id);
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
          LOG_WARN("failed to get ls check status from map", K(ret));
 | 
					          LOG_WARN("failed to get ls check status from map", K(ret));
 | 
				
			||||||
@ -879,30 +909,6 @@ int ObCompactionDiagnoseMgr::diagnose_tenant_tablet()
 | 
				
			|||||||
      ++diagnose_tablets;
 | 
					      ++diagnose_tablets;
 | 
				
			||||||
      if (OB_SUCC(ret)) {
 | 
					      if (OB_SUCC(ret)) {
 | 
				
			||||||
        if (ls_check_status.need_merge_) {
 | 
					        if (ls_check_status.need_merge_) {
 | 
				
			||||||
          // check weak read ts
 | 
					 | 
				
			||||||
          if (diagnose_major_flag
 | 
					 | 
				
			||||||
              && !ls_check_status.weak_read_ts_ready_
 | 
					 | 
				
			||||||
              && can_add_diagnose_info()
 | 
					 | 
				
			||||||
              && OB_TMP_FAIL(SET_DIAGNOSE_INFO(
 | 
					 | 
				
			||||||
                        info_array_[idx_++],
 | 
					 | 
				
			||||||
                        MEDIUM_MERGE,
 | 
					 | 
				
			||||||
                        MTL_ID(),
 | 
					 | 
				
			||||||
                        ls_id,
 | 
					 | 
				
			||||||
                        ObTabletID(INT64_MAX),
 | 
					 | 
				
			||||||
                        ObCompactionDiagnoseInfo::DIA_STATUS_FAILED,
 | 
					 | 
				
			||||||
                        ObTimeUtility::fast_current_time(),
 | 
					 | 
				
			||||||
                        "weak read ts is not ready, compaction_scn",
 | 
					 | 
				
			||||||
                        compaction_scn))) {
 | 
					 | 
				
			||||||
            LOG_WARN("failed to add dignose info about weak read ts", K(tmp_ret), K(compaction_scn));
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
          // check ls suspect info for memtable freezing
 | 
					 | 
				
			||||||
          if (OB_TMP_FAIL(diagnose_ls_merge(MINI_MERGE, ls_id))) {
 | 
					 | 
				
			||||||
            LOG_WARN("failed to diagnose about memtable freezing", K(tmp_ret));
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
          // check ls locality change and leader change
 | 
					 | 
				
			||||||
          if (ls_check_status.is_leader_ && OB_TMP_FAIL(diagnose_ls_merge(MEDIUM_MERGE, ls_id))) {
 | 
					 | 
				
			||||||
            LOG_WARN("failed to diagnose about ls locality change", K(tmp_ret));
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
          if (OB_TMP_FAIL(diagnose_tablet_major_and_medium(diagnose_major_flag,
 | 
					          if (OB_TMP_FAIL(diagnose_tablet_major_and_medium(diagnose_major_flag,
 | 
				
			||||||
              ls_check_status.weak_read_ts_ready_, compaction_scn,
 | 
					              ls_check_status.weak_read_ts_ready_, compaction_scn,
 | 
				
			||||||
              ls_id, *tablet_handle_.get_obj(), tablet_major_finish))) {
 | 
					              ls_id, *tablet_handle_.get_obj(), tablet_major_finish))) {
 | 
				
			||||||
 | 
				
			|||||||
@ -439,8 +439,11 @@ private:
 | 
				
			|||||||
  int get_next_tablet(ObLSID &ls_id);
 | 
					  int get_next_tablet(ObLSID &ls_id);
 | 
				
			||||||
  void release_last_tenant();
 | 
					  void release_last_tenant();
 | 
				
			||||||
  int gen_ls_check_status(const ObLSID &ls_id, const int64_t compaction_scn, ObLSCheckStatus &ls_status);
 | 
					  int gen_ls_check_status(const ObLSID &ls_id, const int64_t compaction_scn, ObLSCheckStatus &ls_status);
 | 
				
			||||||
  int diagnose_ls_merge(
 | 
					  void diagnose_tenant_ls(
 | 
				
			||||||
      const ObMergeType merge_type,
 | 
					      const bool diagnose_major_flag,
 | 
				
			||||||
 | 
					      const bool weak_read_ts_ready,
 | 
				
			||||||
 | 
					      const int64_t compaction_scn,
 | 
				
			||||||
 | 
					      const bool is_leader,
 | 
				
			||||||
      const ObLSID &ls_id);
 | 
					      const ObLSID &ls_id);
 | 
				
			||||||
  int diagnose_tablet_mini_merge(const ObLSID &ls_id, ObTablet &tablet);
 | 
					  int diagnose_tablet_mini_merge(const ObLSID &ls_id, ObTablet &tablet);
 | 
				
			||||||
  int diagnose_tablet_minor_merge(const ObLSID &ls_id, ObTablet &tablet);
 | 
					  int diagnose_tablet_minor_merge(const ObLSID &ls_id, ObTablet &tablet);
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user