[CP] disable transferred out tablets for minor merge
This commit is contained in:
		@ -739,7 +739,7 @@ int ObStorageHATaskUtils::check_minor_sstable_need_copy_(
 | 
			
		||||
  } else if (OB_ISNULL(tablet = tablet_handle.get_obj())) {
 | 
			
		||||
    ret = OB_ERR_UNEXPECTED;
 | 
			
		||||
    LOG_WARN("tablet should not be NULL", K(ret), K(param), K(tablet_handle));
 | 
			
		||||
  } else if (OB_FAIL(tablet->get_mini_minor_sstables(minor_table_iter))) {
 | 
			
		||||
  } else if (OB_FAIL(tablet->get_all_minor_sstables(minor_table_iter))) {
 | 
			
		||||
    LOG_WARN("failed to get tables handle array", K(ret), K(param));
 | 
			
		||||
  } else if (0 == minor_table_iter.count()) {
 | 
			
		||||
    need_copy = true;
 | 
			
		||||
 | 
			
		||||
@ -646,8 +646,8 @@ int ObTabletBackfillTXTask::get_backfill_tx_minor_sstables_(
 | 
			
		||||
  } else if (OB_ISNULL(tablet)) {
 | 
			
		||||
    ret = OB_INVALID_ARGUMENT;
 | 
			
		||||
    LOG_WARN("get backfll tx minor sstable get invalid argument", K(ret), KP(tablet));
 | 
			
		||||
  } else if (OB_FAIL(tablet->get_mini_minor_sstables(minor_table_iter))) {
 | 
			
		||||
    LOG_WARN("failed to get mini  minor sstables", K(ret));
 | 
			
		||||
  } else if (OB_FAIL(tablet->get_all_minor_sstables(minor_table_iter))) {
 | 
			
		||||
    LOG_WARN("failed to get all minor sstables", K(ret));
 | 
			
		||||
  } else {
 | 
			
		||||
    while (OB_SUCC(ret)) {
 | 
			
		||||
      ObTableHandleV2 table_handle;
 | 
			
		||||
 | 
			
		||||
@ -3662,8 +3662,7 @@ int ObTablet::update_upper_trans_version(ObLS &ls, bool &is_updated)
 | 
			
		||||
    LOG_INFO("paused, cannot update trans version now", K(ret), K(ls_id), K(tablet_id));
 | 
			
		||||
  } else if (OB_FAIL(fetch_table_store(table_store_wrapper))) {
 | 
			
		||||
    LOG_WARN("fail to fetch table store", K(ret));
 | 
			
		||||
  } else if (OB_FAIL(table_store_wrapper.get_member()->get_mini_minor_sstables(
 | 
			
		||||
      true/*is_ha_data_status_complete*/, iter))) {
 | 
			
		||||
  } else if (OB_FAIL(table_store_wrapper.get_member()->get_mini_minor_sstables(iter))) {
 | 
			
		||||
    LOG_WARN("fail to get mini minor sstable", K(ret), K(table_store_wrapper));
 | 
			
		||||
  } else {
 | 
			
		||||
    ObITable *table = nullptr;
 | 
			
		||||
@ -5424,8 +5423,7 @@ int ObTablet::get_mini_minor_sstables(ObTableStoreIterator &table_store_iter) co
 | 
			
		||||
    LOG_WARN("not inited", K(ret));
 | 
			
		||||
  } else if (OB_FAIL(fetch_table_store(table_store_wrapper))) {
 | 
			
		||||
    LOG_WARN("fail to fetch table store", K(ret));
 | 
			
		||||
  } else if (OB_FAIL(table_store_wrapper.get_member()->get_mini_minor_sstables(
 | 
			
		||||
      tablet_meta_.ha_status_.is_data_status_complete(), table_store_iter))) {
 | 
			
		||||
  } else if (OB_FAIL(table_store_wrapper.get_member()->get_mini_minor_sstables(table_store_iter))) {
 | 
			
		||||
    LOG_WARN("fail to get ddl sstable handles", K(ret));
 | 
			
		||||
  } else if (!table_store_addr_.is_memory_object()
 | 
			
		||||
      && OB_FAIL(table_store_iter.set_handle(table_store_wrapper.get_meta_handle()))) {
 | 
			
		||||
@ -7509,5 +7507,24 @@ int ObTablet::check_ready_for_read_if_need(const ObTablet &old_tablet)
 | 
			
		||||
  }
 | 
			
		||||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int ObTablet::get_all_minor_sstables(ObTableStoreIterator &table_store_iter) const
 | 
			
		||||
{
 | 
			
		||||
  int ret = OB_SUCCESS;
 | 
			
		||||
  ObTabletMemberWrapper<ObTabletTableStore> table_store_wrapper;
 | 
			
		||||
  if (IS_NOT_INIT) {
 | 
			
		||||
    ret = OB_NOT_INIT;
 | 
			
		||||
    LOG_WARN("not inited", K(ret));
 | 
			
		||||
  } else if (OB_FAIL(fetch_table_store(table_store_wrapper))) {
 | 
			
		||||
    LOG_WARN("fail to fetch table store", K(ret));
 | 
			
		||||
  } else if (OB_FAIL(table_store_wrapper.get_member()->get_all_minor_sstables(table_store_iter))) {
 | 
			
		||||
    LOG_WARN("fail to get ddl sstable handles", K(ret));
 | 
			
		||||
  } else if (!table_store_addr_.is_memory_object()
 | 
			
		||||
      && OB_FAIL(table_store_iter.set_handle(table_store_wrapper.get_meta_handle()))) {
 | 
			
		||||
    LOG_WARN("fail to set storage meta handle", K(ret), K_(table_store_addr), K(table_store_wrapper));
 | 
			
		||||
  }
 | 
			
		||||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace storage
 | 
			
		||||
} // namespace oceanbase
 | 
			
		||||
 | 
			
		||||
@ -586,6 +586,7 @@ public:
 | 
			
		||||
  int64_t to_string(char *buf, const int64_t buf_len) const;
 | 
			
		||||
  int get_max_column_cnt_on_schema_recorder(int64_t &max_column_cnt);
 | 
			
		||||
  static int get_tablet_version(const char *buf, const int64_t len, int32_t &version);
 | 
			
		||||
  int get_all_minor_sstables(ObTableStoreIterator &table_store_iter) const;
 | 
			
		||||
protected:// for MDS use
 | 
			
		||||
  virtual bool check_is_inited_() const override final { return is_inited_; }
 | 
			
		||||
  virtual const ObTabletMdsData &get_mds_data_() const override final { return mds_data_; }
 | 
			
		||||
 | 
			
		||||
@ -1122,19 +1122,14 @@ int ObTabletTableStore::get_ha_tables(ObTableStoreIterator &iter, bool &is_ready
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int ObTabletTableStore::get_mini_minor_sstables(
 | 
			
		||||
    const bool is_ha_data_status_complete,
 | 
			
		||||
    ObTableStoreIterator &iter) const
 | 
			
		||||
{
 | 
			
		||||
  int ret = OB_SUCCESS;
 | 
			
		||||
  if (IS_NOT_INIT) {
 | 
			
		||||
    ret = OB_NOT_INIT;
 | 
			
		||||
    LOG_WARN("table store is not inited", K(ret));
 | 
			
		||||
  } else if (is_ha_data_status_complete) {
 | 
			
		||||
    if (OB_FAIL(iter.add_tables(minor_tables_, 0, minor_tables_.count()))) {
 | 
			
		||||
      LOG_WARN("failed to get all minor tables", K(ret));
 | 
			
		||||
    }
 | 
			
		||||
  } else if (OB_FAIL(get_ha_mini_minor_sstables_(iter))) {
 | 
			
		||||
    LOG_WARN("failed to get ha mini minor sstables", K(ret), K(minor_tables_));
 | 
			
		||||
  } else if (OB_FAIL(get_mini_minor_sstables_(iter))) {
 | 
			
		||||
    LOG_WARN("failed to get mini minor sstables", K(ret));
 | 
			
		||||
  }
 | 
			
		||||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
@ -2451,21 +2446,6 @@ int ObTabletTableStore::check_old_store_minor_sstables_(
 | 
			
		||||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int ObTabletTableStore::get_ha_mini_minor_sstables_(ObTableStoreIterator &iter) const
 | 
			
		||||
{
 | 
			
		||||
  int ret = OB_SUCCESS;
 | 
			
		||||
  for (int64_t i = 0; OB_SUCC(ret) && i < minor_tables_.count(); ++i) {
 | 
			
		||||
    ObSSTable *table = minor_tables_[i];
 | 
			
		||||
    if (OB_ISNULL(table)) {
 | 
			
		||||
      ret = OB_ERR_UNEXPECTED;
 | 
			
		||||
      LOG_WARN("table should not be NULL", K(ret), K(minor_tables_), KP(table));
 | 
			
		||||
    } else if (OB_FAIL(iter.add_table(table))) {
 | 
			
		||||
      LOG_WARN("failed to push table into minor sstables array", K(ret), KPC(table), K(minor_tables_));
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int ObTabletTableStore::build_ha_minor_tables_(
 | 
			
		||||
    common::ObArenaAllocator &allocator,
 | 
			
		||||
    const ObTablet &tablet,
 | 
			
		||||
@ -2486,6 +2466,48 @@ int ObTabletTableStore::build_ha_minor_tables_(
 | 
			
		||||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//TODO (muwei.ym) temporay fix in 430 for transfer
 | 
			
		||||
int ObTabletTableStore::get_mini_minor_sstables_(ObTableStoreIterator &iter) const
 | 
			
		||||
{
 | 
			
		||||
  int ret = OB_SUCCESS;
 | 
			
		||||
  SCN max_fill_tx_scn(SCN::min_scn());
 | 
			
		||||
  SCN max_end_scn(SCN::min_scn());
 | 
			
		||||
 | 
			
		||||
  for (int64_t i = 0; OB_SUCC(ret) && i < minor_tables_.count(); ++i) {
 | 
			
		||||
    ObSSTable *table = minor_tables_[i];
 | 
			
		||||
    if (OB_ISNULL(table)) {
 | 
			
		||||
      ret = OB_ERR_UNEXPECTED;
 | 
			
		||||
      LOG_WARN("table should not be NULL", K(ret), K(minor_tables_), KP(table));
 | 
			
		||||
    } else {
 | 
			
		||||
      max_fill_tx_scn = SCN::max(max_fill_tx_scn, table->get_filled_tx_scn());
 | 
			
		||||
      max_end_scn = SCN::max(max_end_scn, table->get_end_scn());
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (OB_SUCC(ret)) {
 | 
			
		||||
    if (max_end_scn < max_fill_tx_scn) {
 | 
			
		||||
      //do nothing
 | 
			
		||||
      LOG_INFO("max end scn is smaller than max fill tx scn, cannot minor merge", K(max_end_scn), K(max_fill_tx_scn), K(minor_tables_));
 | 
			
		||||
    } else if (OB_FAIL(iter.add_tables(minor_tables_, 0, minor_tables_.count()))) {
 | 
			
		||||
      LOG_WARN("failed to get all minor tables", K(ret));
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int ObTabletTableStore::get_all_minor_sstables(
 | 
			
		||||
    ObTableStoreIterator &iter) const
 | 
			
		||||
{
 | 
			
		||||
  int ret = OB_SUCCESS;
 | 
			
		||||
  if (IS_NOT_INIT) {
 | 
			
		||||
    ret = OB_NOT_INIT;
 | 
			
		||||
    LOG_WARN("table store is not inited", K(ret));
 | 
			
		||||
  } else if (OB_FAIL(iter.add_tables(minor_tables_, 0, minor_tables_.count()))) {
 | 
			
		||||
    LOG_WARN("failed to get all minor tables", K(ret));
 | 
			
		||||
  }
 | 
			
		||||
  return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int64_t ObTabletTableStore::to_string(char *buf, const int64_t buf_len) const
 | 
			
		||||
{
 | 
			
		||||
  int64_t pos = 0;
 | 
			
		||||
 | 
			
		||||
@ -161,7 +161,6 @@ public:
 | 
			
		||||
  int get_first_frozen_memtable(ObITable *&table) const;
 | 
			
		||||
  int get_ddl_sstables(ObTableStoreIterator &iter) const;
 | 
			
		||||
  int get_mini_minor_sstables(
 | 
			
		||||
      const bool is_ha_data_status_complete,
 | 
			
		||||
      ObTableStoreIterator &iter) const;
 | 
			
		||||
  int get_recycle_version(const int64_t multi_version_start, int64_t &recycle_version) const;
 | 
			
		||||
  int get_ha_tables(ObTableStoreIterator &iter, bool &is_ready_for_read) const;
 | 
			
		||||
@ -198,6 +197,8 @@ public:
 | 
			
		||||
      blocksstable::ObSSTable &orig_sstable,
 | 
			
		||||
      ObStorageMetaHandle &loaded_sstable_handle,
 | 
			
		||||
      blocksstable::ObSSTable *&loaded_sstable);
 | 
			
		||||
  int get_all_minor_sstables(
 | 
			
		||||
      ObTableStoreIterator &iter) const;
 | 
			
		||||
private:
 | 
			
		||||
  int get_need_to_cache_sstables(
 | 
			
		||||
      common::ObIArray<ObStorageMetaValue::MetaType> &meta_types,
 | 
			
		||||
@ -322,7 +323,6 @@ private:
 | 
			
		||||
      common::ObIArray<ObITable *> &new_minor_sstables);
 | 
			
		||||
  int check_old_store_minor_sstables_(
 | 
			
		||||
      common::ObIArray<ObITable *> &old_store_minor_sstables);
 | 
			
		||||
  int get_ha_mini_minor_sstables_(ObTableStoreIterator &iter) const;
 | 
			
		||||
  int replace_ha_minor_sstables_(
 | 
			
		||||
      common::ObArenaAllocator &allocator,
 | 
			
		||||
      const ObTablet &tablet,
 | 
			
		||||
@ -354,6 +354,7 @@ private:
 | 
			
		||||
      const ObIArray<ObITable *> &replace_sstable_array,
 | 
			
		||||
      const ObSSTableArray &old_tables,
 | 
			
		||||
      ObSSTableArray &new_tables) const;
 | 
			
		||||
  int get_mini_minor_sstables_(ObTableStoreIterator &iter) const;
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  static const int64_t TABLE_STORE_VERSION_V1 = 0x0100;
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user