Fix ls migration tablet table store check clog checkpoint scn with minor sstable error
This commit is contained in:
		@ -1007,11 +1007,10 @@ int ObLSMigrationHandler::check_can_skip_prepare_status_(bool &can_skip)
 | 
			
		||||
  if (!is_inited_) {
 | 
			
		||||
    ret = OB_NOT_INIT;
 | 
			
		||||
    LOG_WARN("ls migration handler do not init", K(ret));
 | 
			
		||||
  //} else if (OB_FAIL(get_ls_migration_task_(task))) {
 | 
			
		||||
  //  LOG_WARN("failed to get ls migration task", K(ret), KPC(ls_));
 | 
			
		||||
  //} else if (ObMigrationOpType::REBUILD_LS_OP == task.arg_.type_) {
 | 
			
		||||
  //  can_skip = false;
 | 
			
		||||
  // TODO(muwei.ym) Open IT in 4.3 and the condition should change to migration status rebuild flag setted.
 | 
			
		||||
  } else if (OB_FAIL(get_ls_migration_task_(task))) {
 | 
			
		||||
    LOG_WARN("failed to get ls migration task", K(ret), KPC(ls_));
 | 
			
		||||
  } else if (ObMigrationOpType::REBUILD_LS_OP == task.arg_.type_) {
 | 
			
		||||
    can_skip = false;
 | 
			
		||||
  } else {
 | 
			
		||||
    can_skip = true;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -725,10 +725,13 @@ int ObStartPrepareMigrationTask::process()
 | 
			
		||||
    LOG_WARN("failed to deal with local ls", K(ret), K(*ctx_));
 | 
			
		||||
  } else if (OB_FAIL(wait_transfer_tablets_ready_())) {
 | 
			
		||||
    LOG_WARN("failed to wait transfer tablets ready", K(ret), KPC(ctx_));
 | 
			
		||||
  } else if (OB_FAIL(wait_log_replay_sync_())) {
 | 
			
		||||
    LOG_WARN("failed to wait log replay sync", K(ret), KPC(ctx_));
 | 
			
		||||
  } else if (OB_FAIL(remove_local_incomplete_tablets_())) {
 | 
			
		||||
    LOG_WARN("failed to remove local incomplete tablets", K(ret), KPC(ctx_));
 | 
			
		||||
  }
 | 
			
		||||
  //TODO(muwei.ym) delete it in 4.2 RC3
 | 
			
		||||
  /*
 | 
			
		||||
  else if (OB_FAIL(wait_log_replay_sync_())) {
 | 
			
		||||
    LOG_WARN("failed to wait log replay sync", K(ret), KPC(ctx_));
 | 
			
		||||
  } else if (OB_FAIL(wait_ls_checkpoint_scn_push_())) {
 | 
			
		||||
    LOG_WARN("failed to wait ls checkpoint ts push", K(ret), KPC(ctx_));
 | 
			
		||||
  } else if (OB_FAIL(prepare_backfill_tx_tablets_())) {
 | 
			
		||||
@ -736,6 +739,7 @@ int ObStartPrepareMigrationTask::process()
 | 
			
		||||
  } else if (OB_FAIL(generate_prepare_migration_dags_())) {
 | 
			
		||||
    LOG_WARN("failed to generate prepare migration dags", K(ret), KPC(ctx_));
 | 
			
		||||
  }
 | 
			
		||||
  */
 | 
			
		||||
 | 
			
		||||
  if (OB_FAIL(ret)) {
 | 
			
		||||
    int tmp_ret = OB_SUCCESS;
 | 
			
		||||
 | 
			
		||||
@ -26,6 +26,9 @@ using namespace share;
 | 
			
		||||
namespace storage
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
//errsim def
 | 
			
		||||
ERRSIM_POINT_DEF(PHYSICAL_COPY_TASK_GET_TABLET_FAILED);
 | 
			
		||||
 | 
			
		||||
/******************ObPhysicalCopyCtx*********************/
 | 
			
		||||
ObPhysicalCopyCtx::ObPhysicalCopyCtx()
 | 
			
		||||
  : lock_(),
 | 
			
		||||
@ -780,6 +783,17 @@ int ObSSTableCopyFinishTask::prepare_data_store_desc_(
 | 
			
		||||
    LOG_WARN("failed to get merge type", K(ret), KPC(sstable_param));
 | 
			
		||||
  } else if (OB_FAIL(ls_->ha_get_tablet(tablet_id, tablet_handle))) {
 | 
			
		||||
    LOG_WARN("failed to do ha get tablet", K(ret), K(tablet_id));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
#ifdef ERRSIM
 | 
			
		||||
    if (OB_SUCC(ret)) {
 | 
			
		||||
      ret = PHYSICAL_COPY_TASK_GET_TABLET_FAILED ? : OB_SUCCESS;
 | 
			
		||||
      if (OB_FAIL(ret)) {
 | 
			
		||||
        STORAGE_LOG(ERROR, "fake PHYSICAL_COPY_TASK_GET_TABLET_FAILED", K(ret));
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
  if (OB_FAIL(ret)) {
 | 
			
		||||
  } else if (OB_ISNULL(tablet = tablet_handle.get_obj())) {
 | 
			
		||||
    ret = OB_ERR_UNEXPECTED;
 | 
			
		||||
    LOG_WARN("tablet should not be NULL", K(ret), K(tablet_id));
 | 
			
		||||
 | 
			
		||||
@ -23,6 +23,8 @@ using namespace oceanbase;
 | 
			
		||||
using namespace share;
 | 
			
		||||
using namespace storage;
 | 
			
		||||
 | 
			
		||||
ERRSIM_POINT_DEF(CHECK_CAN_REBUILD);
 | 
			
		||||
 | 
			
		||||
ObLSRebuildCtx::ObLSRebuildCtx()
 | 
			
		||||
  : ls_id_(),
 | 
			
		||||
    type_(),
 | 
			
		||||
@ -716,6 +718,14 @@ int ObRebuildService::check_can_rebuild_(
 | 
			
		||||
  } else {
 | 
			
		||||
    can_rebuild = true;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
#ifdef ERRSIM
 | 
			
		||||
  if (OB_FAIL(ret)) {
 | 
			
		||||
    //do nothing
 | 
			
		||||
  } else {
 | 
			
		||||
    can_rebuild = CHECK_CAN_REBUILD ? false: true;
 | 
			
		||||
  }
 | 
			
		||||
#endif
 | 
			
		||||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -25,6 +25,7 @@
 | 
			
		||||
#include "observer/ob_server_event_history_table_operator.h"
 | 
			
		||||
#include "ob_storage_ha_utils.h"
 | 
			
		||||
#include "storage/compaction/ob_tenant_tablet_scheduler.h"
 | 
			
		||||
#include "ob_rebuild_service.h"
 | 
			
		||||
 | 
			
		||||
using namespace oceanbase::transaction;
 | 
			
		||||
using namespace oceanbase::share;
 | 
			
		||||
@ -49,6 +50,7 @@ ERRSIM_POINT_DEF(EN_START_TRANSFER_IN_FAILED);
 | 
			
		||||
ERRSIM_POINT_DEF(EN_UPDATE_ALL_TABLET_TO_LS_FAILED);
 | 
			
		||||
ERRSIM_POINT_DEF(EN_UPDATE_TRANSFER_TASK_FAILED);
 | 
			
		||||
ERRSIM_POINT_DEF(EN_START_CAN_NOT_RETRY);
 | 
			
		||||
ERRSIM_POINT_DEF(EN_MAKE_SRC_LS_REBUILD);
 | 
			
		||||
 | 
			
		||||
ObTransferHandler::ObTransferHandler()
 | 
			
		||||
  : is_inited_(false),
 | 
			
		||||
@ -495,6 +497,16 @@ int ObTransferHandler::do_with_start_status_(const share::ObTransferTaskInfo &ta
 | 
			
		||||
  } else {
 | 
			
		||||
    if (OB_FAIL(report_to_meta_table_(task_info))) {
 | 
			
		||||
      LOG_WARN("failed to report to meta table", K(ret), K(task_info));
 | 
			
		||||
    } else {
 | 
			
		||||
#ifdef ERRSIM
 | 
			
		||||
      bool is_src_ls_rebuild = EN_MAKE_SRC_LS_REBUILD ? false: true;
 | 
			
		||||
      ObRebuildService *rebuild_service = MTL(ObRebuildService*);
 | 
			
		||||
      ObLSRebuildType type(ObLSRebuildType::TRANSFER);
 | 
			
		||||
      if (!is_src_ls_rebuild) {
 | 
			
		||||
      } else if (OB_FAIL(rebuild_service->add_rebuild_ls(task_info.src_ls_id_, type))) {
 | 
			
		||||
        LOG_WARN("failed to add rebuild ls", K(ret), K(task_info));
 | 
			
		||||
      }
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  if (OB_SUCCESS != (tmp_ret = record_server_event_(ret, round_, task_info))) {
 | 
			
		||||
 | 
			
		||||
@ -2210,9 +2210,12 @@ int ObTabletTableStore::combine_ha_minor_sstables_(
 | 
			
		||||
  //2.old store minor sstables contains remote logical sstable and after clog_checkpoint_scn sstables.
 | 
			
		||||
  SCN max_copy_end_scn;
 | 
			
		||||
  max_copy_end_scn.set_min();
 | 
			
		||||
  ObArray<ObITable *> tmp_minor_sstables;
 | 
			
		||||
  const SCN clog_checkpoint_scn = tablet.get_clog_checkpoint_scn();
 | 
			
		||||
 | 
			
		||||
  for (int64_t i = 0; OB_SUCC(ret) && i < need_add_minor_sstables.count(); ++i) {
 | 
			
		||||
    ObITable *table = need_add_minor_sstables.at(i);
 | 
			
		||||
    if (OB_FAIL(new_minor_sstables.push_back(table))) {
 | 
			
		||||
    if (OB_FAIL(tmp_minor_sstables.push_back(table))) {
 | 
			
		||||
      LOG_WARN("failed to push table into array", K(ret), KPC(table));
 | 
			
		||||
    } else {
 | 
			
		||||
      max_copy_end_scn = table->get_end_scn();
 | 
			
		||||
@ -2229,10 +2232,25 @@ int ObTabletTableStore::combine_ha_minor_sstables_(
 | 
			
		||||
      }
 | 
			
		||||
    } else if (table->get_end_scn() <= max_copy_end_scn) {
 | 
			
		||||
      //do nothing
 | 
			
		||||
    } else if (OB_FAIL(new_minor_sstables.push_back(table))) {
 | 
			
		||||
    } else if (OB_FAIL(tmp_minor_sstables.push_back(table))) {
 | 
			
		||||
      LOG_WARN("failed to push table into array", K(ret), KPC(table));
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (OB_SUCC(ret)) {
 | 
			
		||||
    //TODO(muwei.ym) remove compare with clog checkpoint scn in 4.2 RC3
 | 
			
		||||
    if (tmp_minor_sstables.empty()) {
 | 
			
		||||
      //do nothing
 | 
			
		||||
    } else if (OB_FAIL(ObTableStoreUtil::sort_minor_tables(tmp_minor_sstables))) {
 | 
			
		||||
      LOG_WARN("failed to sort minor tables", K(ret), K(tmp_minor_sstables));
 | 
			
		||||
    } else if (clog_checkpoint_scn > tmp_minor_sstables.at(tmp_minor_sstables.count() - 1)->get_end_scn()) {
 | 
			
		||||
      FLOG_INFO("tablet clog checkpoint scn is bigger than all minor sstables end scn, no need to keep it",
 | 
			
		||||
          K(clog_checkpoint_scn), K(tmp_minor_sstables), K(major_tables_));
 | 
			
		||||
    } else if (OB_FAIL(new_minor_sstables.assign(tmp_minor_sstables))) {
 | 
			
		||||
      LOG_WARN("failed to assign minor sstables", K(ret), K(tmp_minor_sstables));
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user