restore index/meta tree for each sstable during quick restore

This commit is contained in:
wxhwang 2024-09-18 08:00:25 +00:00 committed by ob-robot
parent 43ab7d650e
commit 94664087ce
18 changed files with 509 additions and 136 deletions

View File

@ -1237,6 +1237,11 @@ ERRSIM_DEF_INT(errsim_backup_table_list_batch_size, OB_CLUSTER_PARAMETER, "20000
"Range: [1,) in integer",
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
ERRSIM_DEF_BOOL(enable_quick_restore_remove_backup_dest_test, OB_CLUSTER_PARAMETER, "False",
"when remove backup dest test mode is enabled, io from backup will "
"resturn OB_EAGAIN",
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
#ifdef TRANS_MODULE_TEST
DEF_INT(module_test_trx_memory_errsim_percentage, OB_CLUSTER_PARAMETER, "0", "[0, 100]",
"the percentage of memory errsim. Rang:[0,100]",

View File

@ -45,6 +45,58 @@ int ObBackupSSTableSecMetaIterator::init(
const share::ObBackupDest &backup_dest,
const share::ObBackupSetDesc &backup_set_desc,
ObBackupMetaIndexStore &meta_index_store)
{
int ret = OB_SUCCESS;
if (IS_INIT) {
ret = OB_INIT_TWICE;
LOG_WARN("iterator init twice", K(ret));
} else if (FALSE_IT(datum_range_.set_whole_range())) {
} else if (OB_FAIL(inner_init_(tablet_id,
tablet_handle,
table_key,
backup_dest,
backup_set_desc,
meta_index_store))) {
LOG_WARN("failed to inner init iterator", K(ret));
}
return ret;
}
int ObBackupSSTableSecMetaIterator::init(
const common::ObTabletID &tablet_id,
const storage::ObTabletHandle &tablet_handle,
const storage::ObITable::TableKey &table_key,
const blocksstable::ObDatumRange &query_range,
const share::ObBackupDest &backup_dest,
const share::ObBackupSetDesc &backup_set_desc,
ObBackupMetaIndexStore &meta_index_store)
{
int ret = OB_SUCCESS;
if (IS_INIT) {
ret = OB_INIT_TWICE;
LOG_WARN("iterator init twice", K(ret));
} else if (OB_FAIL(deep_copy_query_range_(query_range))) {
LOG_WARN("failed to deep copy query range", K(ret), K(query_range));
} else if (OB_FAIL(inner_init_(tablet_id,
tablet_handle,
table_key,
backup_dest,
backup_set_desc,
meta_index_store))) {
LOG_WARN("failed to inner init iterator", K(ret));
}
return ret;
}
int ObBackupSSTableSecMetaIterator::inner_init_(
const common::ObTabletID &tablet_id,
const storage::ObTabletHandle &tablet_handle,
const storage::ObITable::TableKey &table_key,
const share::ObBackupDest &backup_dest,
const share::ObBackupSetDesc &backup_set_desc,
ObBackupMetaIndexStore &meta_index_store)
{
int ret = OB_SUCCESS;
ObBackupMetaIndex meta_index;
@ -54,10 +106,7 @@ int ObBackupSSTableSecMetaIterator::init(
ObBackupSSTableMeta *sstable_meta_ptr = NULL;
ObTabletCreateSSTableParam create_sstable_param;
if (IS_INIT) {
ret = OB_INIT_TWICE;
LOG_WARN("iterator init twice", K(ret));
} else if (OB_FAIL(get_backup_data_type_(table_key, backup_data_type))) {
if (OB_FAIL(get_backup_data_type_(table_key, backup_data_type))) {
LOG_WARN("failed to get backup data type", K(ret), K(table_key));
} else if (OB_FAIL(
get_meta_index_(tablet_id, meta_index_store, meta_index))) {
@ -107,6 +156,27 @@ int ObBackupSSTableSecMetaIterator::get_next(ObDataMacroBlockMeta &macro_meta)
return ret;
}
int ObBackupSSTableSecMetaIterator::deep_copy_query_range_(const blocksstable::ObDatumRange &query_range)
{
int ret = OB_SUCCESS;
// deep copy start/end key
if (OB_FAIL(query_range.start_key_.deep_copy(datum_range_.start_key_, allocator_))) {
LOG_WARN("failed to deep copy start key", K(ret), K(query_range));
} else if (OB_FAIL(query_range.start_key_.store_rowkey_.deep_copy(datum_range_.start_key_.store_rowkey_, allocator_))) {
LOG_WARN("failed to deep copy start store row key", K(ret), K(query_range));
} else if (OB_FAIL(query_range.end_key_.deep_copy(datum_range_.end_key_, allocator_))) {
LOG_WARN("failed to deep copy start key", K(ret), K(query_range));
} else if (OB_FAIL(query_range.end_key_.store_rowkey_.deep_copy(datum_range_.end_key_.store_rowkey_, allocator_))) {
LOG_WARN("failed to deep copy start store row key", K(ret), K(query_range));
} else {
datum_range_.group_idx_ = query_range.group_idx_;
datum_range_.border_flag_ = query_range.border_flag_;
}
return ret;
}
int ObBackupSSTableSecMetaIterator::get_backup_data_type_(
const storage::ObITable::TableKey &table_key,
share::ObBackupDataType &backup_data_type)
@ -280,7 +350,6 @@ int ObBackupSSTableSecMetaIterator::create_tmp_sstable_(
int ObBackupSSTableSecMetaIterator::init_sstable_sec_meta_iter_(const storage::ObTabletHandle &tablet_handle)
{
int ret = OB_SUCCESS;
datum_range_.set_whole_range();
ObSSTable *sstable = NULL;
const storage::ObITableReadInfo *index_read_info = NULL;
if (OB_FAIL(table_handle_.get_sstable(sstable))) {
@ -292,7 +361,7 @@ int ObBackupSSTableSecMetaIterator::init_sstable_sec_meta_iter_(const storage::O
*sstable,
*index_read_info,
allocator_))) {
LOG_WARN("failed to open sec meta iterator", K(ret));
LOG_WARN("failed to open sec meta iterator", K(ret), K(datum_range_));
}
return ret;
}

View File

@ -38,6 +38,13 @@ public:
const share::ObBackupDest &backup_dest,
const share::ObBackupSetDesc &backup_set_desc,
ObBackupMetaIndexStore &meta_index_store);
int init(const common::ObTabletID &tablet_id,
const storage::ObTabletHandle &tablet_handle,
const storage::ObITable::TableKey &table_key,
const blocksstable::ObDatumRange &query_range,
const share::ObBackupDest &backup_dest,
const share::ObBackupSetDesc &backup_set_desc,
ObBackupMetaIndexStore &meta_index_store);
int get_next(blocksstable::ObDataMacroBlockMeta &macro_meta);
private:
@ -62,6 +69,14 @@ private:
ObBackupSSTableMeta *&ptr);
private:
int inner_init_(
const common::ObTabletID &tablet_id,
const storage::ObTabletHandle &tablet_handle,
const storage::ObITable::TableKey &table_key,
const share::ObBackupDest &backup_dest,
const share::ObBackupSetDesc &backup_set_desc,
ObBackupMetaIndexStore &meta_index_store);
int deep_copy_query_range_(const blocksstable::ObDatumRange &query_range);
int build_create_sstable_param_(
const storage::ObTabletHandle &tablet_handle,
const ObBackupSSTableMeta &backup_sstable_meta,

View File

@ -276,7 +276,7 @@ int ObDDLStartReplayExecutor::replay_ddl_start(ObTabletHandle &tablet_handle, co
if (!is_lob_meta_tablet && ls_->is_cs_replica() && OB_FAIL(pre_process_for_cs_replica(direct_load_param, table_key, tablet_handle, tablet_id))) {
LOG_WARN("pre process for cs replica failed", K(ret), K(direct_load_param), K(table_key), K(tablet_id));
} else if (OB_FAIL(tenant_direct_load_mgr->replay_create_tablet_direct_load(tablet_handle, log_->get_execution_id(), direct_load_param))) {
} else if (OB_FAIL(tenant_direct_load_mgr->replay_create_tablet_direct_load(tablet_handle.get_obj(), log_->get_execution_id(), direct_load_param))) {
LOG_WARN("create tablet manager failed", K(ret));
} else if (OB_FAIL(tenant_direct_load_mgr->get_tablet_mgr_and_check_major(
ls_->get_ls_id(),

View File

@ -324,7 +324,7 @@ int ObTenantDirectLoadMgr::create_tablet_direct_load(
}
int ObTenantDirectLoadMgr::replay_create_tablet_direct_load(
const ObTabletHandle &tablet_handle,
const ObTablet *tablet,
const int64_t execution_id,
const ObTabletDirectLoadInsertParam &build_param)
{
@ -332,15 +332,15 @@ int ObTenantDirectLoadMgr::replay_create_tablet_direct_load(
if (OB_UNLIKELY(!is_inited_)) {
ret = OB_NOT_INIT;
LOG_WARN("not init", K(ret));
} else if (OB_UNLIKELY(!tablet_handle.is_valid() || execution_id < 0 || !build_param.is_valid())) {
} else if (OB_UNLIKELY(OB_ISNULL(tablet) || execution_id < 0 || !build_param.is_valid())) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", K(ret), K(tablet_handle), K(execution_id), K(build_param));
LOG_WARN("invalid argument", K(ret), KP(tablet), K(execution_id), K(build_param));
} else {
ObTabletMemberWrapper<ObTabletTableStore> table_store_wrapper;
ObTabletDirectLoadMgrHandle direct_load_mgr_handle;
ObTabletDirectLoadMgrKey data_mgr_key(build_param.common_param_.tablet_id_, build_param.common_param_.direct_load_type_);
ObBucketHashWLockGuard guard(bucket_lock_, data_mgr_key.hash());
if (OB_FAIL(tablet_handle.get_obj()->fetch_table_store(table_store_wrapper))) {
if (OB_FAIL(tablet->fetch_table_store(table_store_wrapper))) {
LOG_WARN("fetch table store failed", K(ret));
} else if (OB_FAIL(try_create_tablet_direct_load_mgr_nolock(
nullptr != table_store_wrapper.get_member()->get_major_sstables().get_boundary_table(false/*first*/),

View File

@ -98,7 +98,7 @@ public:
const bool only_persisted_ddl_data = false);
int replay_create_tablet_direct_load(
const ObTabletHandle &tablet_handle,
const ObTablet *tablet,
const int64_t execution_id,
const ObTabletDirectLoadInsertParam &param);

View File

@ -65,7 +65,9 @@ bool ObPhysicalCopyCtx::is_valid() const
} else if (OB_ISNULL(restore_base_info_)
|| OB_ISNULL(second_meta_index_store_)) {
bool_ret = false;
} else if (!ObTabletRestoreAction::is_restore_replace_remote_sstable(restore_action_) && OB_ISNULL(restore_macro_block_id_mgr_)) {
} else if (!ObTabletRestoreAction::is_restore_remote_sstable(restore_action_)
&& !ObTabletRestoreAction::is_restore_replace_remote_sstable(restore_action_)
&& OB_ISNULL(restore_macro_block_id_mgr_)) {
bool_ret = false;
LOG_WARN_RET(OB_INVALID_ARGUMENT, "restore_macro_block_id_mgr_ is null", K_(restore_action), KP_(restore_macro_block_id_mgr));
}

View File

@ -839,8 +839,7 @@ int ObSSTableCopyFinishTask::get_cluster_version_(
bool ObSSTableCopyFinishTask::is_sstable_should_rebuild_index_(const ObMigrationSSTableParam *sstable_param) const
{
return !sstable_param->is_empty_sstable()
&& !is_shared_sstable_without_copy_(sstable_param)
&& !ObTabletRestoreAction::is_restore_remote_sstable(copy_ctx_.restore_action_);
&& !is_shared_sstable_without_copy_(sstable_param);
}
bool ObSSTableCopyFinishTask::is_shared_sstable_without_copy_(const ObMigrationSSTableParam *sstable_param) const
@ -933,6 +932,9 @@ int ObSSTableCopyFinishTask::build_restore_macro_block_id_mgr_(
if (!init_param.is_leader_restore_) {
restore_macro_block_id_mgr_ = nullptr;
} else if (ObTabletRestoreAction::is_restore_remote_sstable(init_param.restore_action_)) {
// restore index/meta tree for backup sstable, macro blocks should be got by iterator.
restore_macro_block_id_mgr_ = nullptr;
} else if (ObTabletRestoreAction::is_restore_replace_remote_sstable(init_param.restore_action_)) {
restore_macro_block_id_mgr_ = nullptr;
} else {
@ -1037,8 +1039,6 @@ int ObSSTableCopyFinishTask::alloc_and_init_sstable_creator_(ObCopiedSSTableCrea
ObCopiedSSTableCreatorImpl *tmp_creator = nullptr;
if (sstable_param_->is_empty_sstable()) {
tmp_creator = MTL_NEW(ObCopiedEmptySSTableCreator, "CopySSTCreator");
} else if (ObTabletRestoreAction::is_restore_remote_sstable(copy_ctx_.restore_action_)) {
tmp_creator = MTL_NEW(ObBackupSSTableCreator, "CopySSTCreator");
#ifdef OB_BUILD_SHARED_STORAGE
} else if (sstable_param_->is_shared_sstable()) {
tmp_creator = MTL_NEW(ObCopiedSharedSSTableCreator, "CopySSTCreator");

View File

@ -20,6 +20,7 @@
#include "storage/high_availability/ob_storage_ha_utils.h"
#include "storage/access/ob_table_read_info.h"
#include "storage/tablet/ob_tablet_iterator.h"
#include "storage/backup/ob_backup_factory.h"
#include "observer/omt/ob_tenant.h"
#include "common/storage/ob_device_common.h"
@ -73,7 +74,9 @@ bool ObCopyMacroBlockReaderInitParam::is_valid() const
|| OB_ISNULL(meta_index_store_)
|| OB_ISNULL(second_meta_index_store_)) {
bool_ret = false;
} else if (!ObTabletRestoreAction::is_restore_replace_remote_sstable(restore_action_) && OB_ISNULL(restore_macro_block_id_mgr_)) {
} else if (!ObTabletRestoreAction::is_restore_remote_sstable(restore_action_)
&& !ObTabletRestoreAction::is_restore_replace_remote_sstable(restore_action_)
&& OB_ISNULL(restore_macro_block_id_mgr_)) {
bool_ret = false;
LOG_WARN_RET(OB_INVALID_ARGUMENT, "restore_macro_block_id_mgr_ is null", K_(restore_action), KP_(restore_macro_block_id_mgr));
}
@ -338,13 +341,18 @@ ObCopyMacroBlockRestoreReader::ObCopyMacroBlockRestoreReader()
table_key_(),
copy_macro_range_info_(nullptr),
restore_base_info_(nullptr),
meta_index_store_(nullptr),
second_meta_index_store_(nullptr),
restore_macro_block_id_mgr_(nullptr),
data_buffer_(),
allocator_(),
macro_block_index_(0),
macro_block_count_(0),
data_size_(0)
data_size_(0),
datum_range_(),
sec_meta_iterator_(nullptr),
restore_action_(ObTabletRestoreAction::RESTORE_NONE),
meta_row_buf_("CopyMacroMetaRow")
{
ObMemAttr attr(MTL_ID(), "CMBReReader");
allocator_.set_attr(attr);
@ -352,6 +360,10 @@ ObCopyMacroBlockRestoreReader::ObCopyMacroBlockRestoreReader()
ObCopyMacroBlockRestoreReader::~ObCopyMacroBlockRestoreReader()
{
if (OB_NOT_NULL(sec_meta_iterator_)) {
backup::ObLSBackupFactory::free(sec_meta_iterator_);
sec_meta_iterator_ = nullptr;
}
allocator_.reset();
}
@ -359,6 +371,10 @@ int ObCopyMacroBlockRestoreReader::init(
const ObCopyMacroBlockReaderInitParam &param)
{
int ret = OB_SUCCESS;
ObLSHandle ls_handle;
ObLSService *ls_service = nullptr;
ObLS *ls = nullptr;
ObTabletHandle tablet_handle;
if (is_inited_) {
ret = OB_INIT_TWICE;
@ -366,17 +382,55 @@ int ObCopyMacroBlockRestoreReader::init(
} else if (!param.is_valid() || !param.is_leader_restore_) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid args", K(ret), K(param));
} else if (ObTabletRestoreAction::is_restore_remote_sstable(param.restore_action_)
&& ObBackupSetFileDesc::is_backup_set_not_support_quick_restore(param.restore_base_info_->backup_compatible_)) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("restore remote sstable, but backup set not support quick restore", K(ret), K(param));
} else if (OB_ISNULL(ls_service = MTL(ObLSService *))) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("ls service should not be null", K(ret), KP(ls_service));
} else if (OB_FAIL(ls_service->get_ls(param.ls_id_, ls_handle, ObLSGetMod::HA_MOD))) {
LOG_WARN("fail to get log stream", K(ret), K(param));
} else if (OB_UNLIKELY(nullptr == (ls = ls_handle.get_ls()))) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("log stream should not be NULL", K(ret), K(param));
} else if (OB_FAIL(ls->ha_get_tablet(param.table_key_.get_tablet_id(), tablet_handle))) {
LOG_WARN("failed to get tablet handle", K(ret), K(param));
} else if (OB_FAIL(alloc_buffers())) {
LOG_WARN("failed to alloc buffers", K(ret));
} else {
table_key_ = param.table_key_;
copy_macro_range_info_ = param.copy_macro_range_info_;
restore_base_info_ = param.restore_base_info_;
meta_index_store_ = param.meta_index_store_;
second_meta_index_store_ = param.second_meta_index_store_;
restore_macro_block_id_mgr_ = param.restore_macro_block_id_mgr_;
if (OB_FAIL(restore_macro_block_id_mgr_->get_block_id_index(copy_macro_range_info_->start_macro_block_id_, macro_block_index_))) {
LOG_WARN("failed to get block id index", K(ret), KPC(copy_macro_range_info_));
restore_action_ = param.restore_action_;
if (ObTabletRestoreAction::is_restore_remote_sstable(param.restore_action_)) {
// iterate and return all macro mata using iterator to build index/meta tree.
datum_range_.set_start_key(copy_macro_range_info_->start_macro_block_end_key_);
datum_range_.end_key_.set_max_rowkey();
datum_range_.set_left_closed();
datum_range_.set_right_open();
if (OB_FAIL(ObRestoreUtils::create_backup_sstable_sec_meta_iterator(param.tenant_id_,
table_key_.get_tablet_id(),
tablet_handle,
table_key_,
datum_range_,
*restore_base_info_,
*meta_index_store_,
sec_meta_iterator_))) {
LOG_WARN("failed to create backup sstable sec meta iterator", K(ret), K(param));
}
} else {
// otherwise, read macro data from backup with macro id from restore_macro_block_id_mgr_.
restore_macro_block_id_mgr_ = param.restore_macro_block_id_mgr_;
if (OB_FAIL(restore_macro_block_id_mgr_->get_block_id_index(copy_macro_range_info_->start_macro_block_id_, macro_block_index_))) {
LOG_WARN("failed to get block id index", K(ret), KPC(copy_macro_range_info_));
}
}
if (OB_SUCC(ret)) {
macro_block_count_ = 0;
is_inited_ = true;
}
@ -425,7 +479,10 @@ int ObCopyMacroBlockRestoreReader::get_next_macro_block(
{
int ret = OB_SUCCESS;
int64_t occupy_size = 0;
ObLogicMacroBlockId logic_block_id;
header.reset();
meta_row_buf_.reuse();
#ifdef ERRSIM
// Simulate minor macro data read failed.
@ -441,8 +498,31 @@ int ObCopyMacroBlockRestoreReader::get_next_macro_block(
LOG_WARN("not inited", K(ret));
} else if (macro_block_count_ == copy_macro_range_info_->macro_block_count_) {
ret = OB_ITER_END;
} else if (ObTabletRestoreAction::is_restore_remote_sstable(restore_action_)) {
// If restore remote sstable, just return backup macro meta to rebuild index/meta tree.
blocksstable::ObDataMacroBlockMeta macro_meta;
blocksstable::ObDatumRow macro_meta_row;
common::ObArenaAllocator meta_row_allocator;
backup::ObBackupDeviceMacroBlockId backup_macro_id;
if (OB_FAIL(sec_meta_iterator_->get_next(macro_meta))) {
LOG_WARN("failed to get next macro meta", K(ret), K(macro_block_count_), KPC(copy_macro_range_info_));
} else if (FALSE_IT(macro_block_id = macro_meta.get_macro_id())) {
} else if (FALSE_IT(logic_block_id = macro_meta.get_logic_id())) {
} else if (OB_FAIL(macro_meta_row.init(macro_meta.get_meta_val().rowkey_count_ + 1))) {
LOG_WARN("failed to init macro meta row", K(ret), K(macro_meta_row));
} else if (OB_FAIL(macro_meta.build_row(macro_meta_row, meta_row_allocator))) {
LOG_WARN("failed to build macro row", K(ret), K(macro_meta));
} else if (OB_FAIL(meta_row_buf_.write_serialize(macro_meta_row))) {
LOG_WARN("failed to write serialize macro meta row into meta row buf", K(ret), K(macro_meta_row), K_(meta_row_buf));
} else if (FALSE_IT(occupy_size = meta_row_buf_.length())) {
} else {
data.assign(meta_row_buf_.data(), occupy_size);
header.occupy_size_ = occupy_size;
header.is_reuse_macro_block_ = true;
header.data_type_ = ObCopyMacroBlockHeader::DataType::MACRO_META_ROW;
}
} else {
ObLogicMacroBlockId logic_block_id;
// Otherwise, macro data should be read from backup device.
share::ObBackupDataType data_type;
share::ObBackupPath backup_path;
const int64_t align_size = DIO_READ_ALIGN_SIZE;
@ -480,19 +560,22 @@ int ObCopyMacroBlockRestoreReader::get_next_macro_block(
header.is_reuse_macro_block_ = false;
header.data_type_ = ObCopyMacroBlockHeader::MACRO_DATA;
header.occupy_size_ = data_buffer_.length();
}
}
macro_block_count_++;
macro_block_index_++;
if (macro_block_count_ == copy_macro_range_info_->macro_block_count_) {
if (logic_block_id != copy_macro_range_info_->end_macro_block_id_) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get macro block end macro block id is not equal to macro block range",
K(ret), K_(macro_block_count), K_(macro_block_index), K(logic_block_id),
"end_macro_block_id", copy_macro_range_info_->end_macro_block_id_, K(table_key_));
}
if (OB_SUCC(ret)) {
macro_block_count_++;
macro_block_index_++;
if (macro_block_count_ == copy_macro_range_info_->macro_block_count_) {
if (logic_block_id != copy_macro_range_info_->end_macro_block_id_) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get macro block end macro block id is not equal to macro block range",
K(ret), K_(macro_block_count), K_(macro_block_index), K(logic_block_id),
"end_macro_block_id", copy_macro_range_info_->end_macro_block_id_, K(table_key_));
}
}
}
return ret;
}
@ -2711,7 +2794,7 @@ int ObCopySSTableMacroRestoreReader::get_next_sstable_range_info_(
{
int ret = OB_SUCCESS;
MAKE_TENANT_SWITCH_SCOPE_GUARD(guard);
ObArray<ObRestoreMacroBlockId> block_id_array;
ObLSHandle ls_handle;
ObLSService *ls_service = NULL;
ObLS *ls = NULL;
@ -2735,62 +2818,147 @@ int ObCopySSTableMacroRestoreReader::get_next_sstable_range_info_(
LOG_WARN("log stream should not be NULL", KR(ret), K_(rpc_arg));
} else if (OB_FAIL(ls->ha_get_tablet(rpc_arg_.tablet_id_, tablet_handle))) {
LOG_WARN("failed to get tablet", K(ret), K_(rpc_arg));
} else {
SMART_VAR(ObRestoreMacroBlockIdMgr, restore_block_id_mgr) {
if (OB_FAIL(restore_block_id_mgr.init(rpc_arg_.tablet_id_, tablet_handle, table_key,
*restore_base_info_, *meta_index_store_, *second_meta_index_store_))) {
LOG_WARN("failed to init restore block id mgr", K(ret), K(rpc_arg_), K(table_key));
} else if (OB_FAIL(restore_block_id_mgr.get_restore_macro_block_id_array(block_id_array))) {
LOG_WARN("failed to get restore macro block id array", K(ret), K(rpc_arg_), K(table_key));
} else if (OB_FAIL(build_sstable_range_info_(table_key, block_id_array, sstable_macro_range_info))) {
LOG_WARN("failed to build sstable range info", K(ret), K(rpc_arg_), K(table_key));
}
} else if (ObBackupSetFileDesc::is_backup_set_not_support_quick_restore(restore_base_info_->backup_compatible_)) {
if (OB_FAIL(build_sstable_range_info_(rpc_arg_.tablet_id_,
tablet_handle,
table_key,
sstable_macro_range_info))) {
LOG_WARN("failed to build sstable range info", K(ret), K(rpc_arg_), K(table_key));
}
} else if (OB_FAIL(build_sstable_range_info_using_iterator_(rpc_arg_.tablet_id_,
tablet_handle,
table_key,
sstable_macro_range_info))) {
LOG_WARN("failed to build sstable range info using iterator", K(ret), K(rpc_arg_), K(table_key));
}
return ret;
}
int ObCopySSTableMacroRestoreReader::build_sstable_range_info_(
int ObCopySSTableMacroRestoreReader::build_sstable_range_info_using_iterator_(
const common::ObTabletID &tablet_id,
const storage::ObTabletHandle &tablet_handle,
const ObITable::TableKey &table_key,
const common::ObIArray<ObRestoreMacroBlockId> &block_id_array,
ObCopySSTableMacroRangeInfo &sstable_macro_range_info)
{
int ret = OB_SUCCESS;
if (!is_inited_) {
ret = OB_NOT_INIT;
LOG_WARN("copy sstable macro restore reader do not init", K(ret));
} else if (!table_key.is_valid()) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("build sstable range info get invalid argument", K(ret), K(table_key));
} else if (FALSE_IT(sstable_macro_range_info.copy_table_key_ = table_key)) {
} else if (block_id_array.empty()) {
//do nothing
LOG_INFO("sstable do not has any macro block", K(table_key));
backup::ObBackupSSTableSecMetaIterator *sstable_sec_meta_iterator = nullptr;
sstable_macro_range_info.copy_table_key_ = table_key;
if (OB_FAIL(ObRestoreUtils::create_backup_sstable_sec_meta_iterator(rpc_arg_.tenant_id_,
tablet_id,
tablet_handle,
table_key,
*restore_base_info_,
*meta_index_store_,
sstable_sec_meta_iterator))) {
LOG_WARN("failed to create backup sstable sec meta iterator", K(ret), K(rpc_arg_));
} else {
ObCopyMacroRangeInfo macro_range_info;
int64_t index = 0;
while (OB_SUCC(ret) && index < block_id_array.count()) {
macro_range_info.reuse();
int64_t macro_block_count = 0;
for (; OB_SUCC(ret)
&& index < block_id_array.count()
&& macro_block_count < rpc_arg_.macro_range_max_marco_count_; ++index, ++macro_block_count) {
const ObRestoreMacroBlockId &pair = block_id_array.at(index);
if (0 == macro_block_count) {
macro_range_info.start_macro_block_id_ = pair.logic_block_id_;
int64_t macro_block_count = 0;
SMART_VARS_3((blocksstable::ObDataMacroBlockMeta, macro_meta),
(ObCopyMacroRangeInfo, macro_range_info),
(ObDatumRowkey, end_key)) {
while (OB_SUCC(ret)) {
macro_meta.reset();
if (OB_FAIL(sstable_sec_meta_iterator->get_next(macro_meta))) {
if (OB_ITER_END == ret) {
ret = OB_SUCCESS;
break;
} else {
LOG_WARN("failed to get next", K(ret));
}
} else if (0 == macro_block_count) {
// first macro within the range
macro_range_info.start_macro_block_id_ = macro_meta.get_logic_id();
macro_range_info.is_leader_restore_ = true;
end_key.reset();
if (OB_FAIL(macro_meta.get_rowkey(end_key))) {
LOG_WARN("failed to get rowkey", K(ret), K(table_key), K(macro_meta));
} else if (OB_FAIL(macro_range_info.deep_copy_start_end_key(end_key))) {
LOG_WARN("failed to deep copy start end key", K(ret), K(end_key), K(table_key), K(macro_meta));
} else {
LOG_INFO("succeed get start logical id end key", K(end_key), K(macro_meta), K(table_key));
}
}
if (OB_SUCC(ret)) {
++macro_block_count;
macro_range_info.end_macro_block_id_ = macro_meta.get_logic_id();
macro_range_info.macro_block_count_ = macro_block_count;
if (macro_block_count < rpc_arg_.macro_range_max_marco_count_) {
} else if (OB_FAIL(sstable_macro_range_info.copy_macro_range_array_.push_back(macro_range_info))) {
LOG_WARN("failed to push macro range info into array", K(ret), K(macro_range_info));
} else {
macro_block_count = 0;
macro_range_info.reuse();
}
}
macro_range_info.end_macro_block_id_ = pair.logic_block_id_;
}
if (OB_SUCC(ret)) {
macro_range_info.is_leader_restore_ = true;
macro_range_info.macro_block_count_ = macro_block_count;
if (OB_FAIL(sstable_macro_range_info.copy_macro_range_array_.push_back(macro_range_info))) {
LOG_WARN("failed to push macro range info into array", K(ret), K(macro_range_info));
if (OB_FAIL(ret)) {
} else if (0 == macro_block_count) {
} else if (OB_FAIL(sstable_macro_range_info.copy_macro_range_array_.push_back(macro_range_info))) {
LOG_WARN("failed to push macro range info into array", K(ret), K(macro_range_info));
}
}
}
if (OB_NOT_NULL(sstable_sec_meta_iterator)) {
backup::ObLSBackupFactory::free(sstable_sec_meta_iterator);
}
return ret;
}
int ObCopySSTableMacroRestoreReader::build_sstable_range_info_(
const common::ObTabletID &tablet_id,
const storage::ObTabletHandle &tablet_handle,
const ObITable::TableKey &table_key,
ObCopySSTableMacroRangeInfo &sstable_macro_range_info)
{
int ret = OB_SUCCESS;
ObArray<ObRestoreMacroBlockId> block_id_array;
sstable_macro_range_info.copy_table_key_ = table_key;
SMART_VAR(ObRestoreMacroBlockIdMgr, restore_block_id_mgr) {
if (OB_FAIL(restore_block_id_mgr.init(tablet_id,
tablet_handle,
table_key,
*restore_base_info_,
*meta_index_store_,
*second_meta_index_store_))) {
LOG_WARN("failed to init restore block id mgr", K(ret), K(rpc_arg_), K(table_key));
} else if (OB_FAIL(restore_block_id_mgr.get_restore_macro_block_id_array(block_id_array))) {
LOG_WARN("failed to get restore macro block id array", K(ret), K(rpc_arg_), K(table_key));
} else if (block_id_array.empty()) {
//do nothing
LOG_INFO("sstable do not has any macro block", K(table_key));
} else {
ObCopyMacroRangeInfo macro_range_info;
int64_t index = 0;
while (OB_SUCC(ret) && index < block_id_array.count()) {
macro_range_info.reuse();
int64_t macro_block_count = 0;
for (; OB_SUCC(ret)
&& index < block_id_array.count()
&& macro_block_count < rpc_arg_.macro_range_max_marco_count_; ++index, ++macro_block_count) {
const ObRestoreMacroBlockId &pair = block_id_array.at(index);
if (0 == macro_block_count) {
macro_range_info.start_macro_block_id_ = pair.logic_block_id_;
}
macro_range_info.end_macro_block_id_ = pair.logic_block_id_;
}
if (OB_SUCC(ret)) {
macro_range_info.is_leader_restore_ = true;
macro_range_info.macro_block_count_ = macro_block_count;
if (OB_FAIL(sstable_macro_range_info.copy_macro_range_array_.push_back(macro_range_info))) {
LOG_WARN("failed to push macro range info into array", K(ret), K(macro_range_info));
}
}
}
}
}
return ret;
}

View File

@ -157,6 +157,7 @@ private:
ObITable::TableKey table_key_;
const ObCopyMacroRangeInfo *copy_macro_range_info_;
const ObRestoreBaseInfo *restore_base_info_;
backup::ObBackupMetaIndexStoreWrapper *meta_index_store_;
backup::ObBackupMetaIndexStoreWrapper *second_meta_index_store_;
ObRestoreMacroBlockIdMgr *restore_macro_block_id_mgr_;
blocksstable::ObBufferReader data_buffer_; // Data used to assemble macroblocks
@ -165,6 +166,10 @@ private:
int64_t macro_block_index_;
int64_t macro_block_count_;
int64_t data_size_;
ObDatumRange datum_range_;
backup::ObBackupSSTableSecMetaIterator *sec_meta_iterator_;
ObTabletRestoreAction::ACTION restore_action_;
ObSelfBufferWriter meta_row_buf_;
DISALLOW_COPY_AND_ASSIGN(ObCopyMacroBlockRestoreReader);
};
@ -688,8 +693,14 @@ private:
const ObITable::TableKey &table_key,
ObCopySSTableMacroRangeInfo &sstable_macro_range_info);
int build_sstable_range_info_(
const common::ObTabletID &tablet_id,
const storage::ObTabletHandle &tablet_handle,
const ObITable::TableKey &table_key,
ObCopySSTableMacroRangeInfo &sstable_macro_range_info);
int build_sstable_range_info_using_iterator_(
const common::ObTabletID &tablet_id,
const storage::ObTabletHandle &tablet_handle,
const ObITable::TableKey &table_key,
const common::ObIArray<ObRestoreMacroBlockId> &block_id_array,
ObCopySSTableMacroRangeInfo &sstable_macro_range_info);
int fetch_sstable_macro_range_header_(obrpc::ObCopySSTableMacroRangeInfoHeader &header);

View File

@ -387,6 +387,80 @@ int ObRestoreUtils::get_backup_data_type(
return ret;
}
int ObRestoreUtils::create_backup_sstable_sec_meta_iterator(
const uint64_t tenant_id,
const common::ObTabletID &tablet_id,
const storage::ObTabletHandle &tablet_handle,
const ObITable::TableKey &table_key,
const blocksstable::ObDatumRange &query_range,
const ObRestoreBaseInfo &restore_base_info,
backup::ObBackupMetaIndexStoreWrapper &meta_index_store,
backup::ObBackupSSTableSecMetaIterator *&sstable_sec_meta_iterator)
{
int ret = OB_SUCCESS;
share::ObBackupSetDesc backup_set_desc;
ObBackupDataType backup_data_type;
backup::ObRestoreMetaIndexStore *meta_index_store_ptr = nullptr;
backup::ObBackupSSTableSecMetaIterator *iterator = nullptr;
const share::ObBackupDest &backup_dest = restore_base_info.backup_dest_;
if (OB_ISNULL(iterator = backup::ObLSBackupFactory::get_backup_sstable_sec_meta_iterator(tenant_id))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("failed to get backup sstable sec meta iterator", K(ret));
} else if (OB_FAIL(restore_base_info.get_last_backup_set_desc(backup_set_desc))) {
LOG_WARN("failed to get last backup set desc", K(ret));
} else if (OB_FAIL(ObRestoreUtils::get_backup_data_type(table_key, backup_data_type))) {
LOG_WARN("failed to get backup data type", K(ret), K(table_key));
} else if (OB_FAIL(meta_index_store.get_backup_meta_index_store(backup_data_type, meta_index_store_ptr))) {
LOG_WARN("failed to get backup meta index store", K(ret), K(backup_data_type));
} else if (OB_FAIL(iterator->init(table_key.get_tablet_id(),
tablet_handle,
table_key,
query_range,
backup_dest,
backup_set_desc,
*meta_index_store_ptr))) {
LOG_WARN("failed to init sstable sec meta iterator", K(ret), K(table_key),
K(query_range), K(backup_dest), K(backup_set_desc), K(restore_base_info));
} else {
sstable_sec_meta_iterator = iterator;
iterator = nullptr;
}
if (OB_NOT_NULL(iterator)) {
backup::ObLSBackupFactory::free(iterator);
}
return ret;
}
int ObRestoreUtils::create_backup_sstable_sec_meta_iterator(
const uint64_t tenant_id,
const common::ObTabletID &tablet_id,
const storage::ObTabletHandle &tablet_handle,
const ObITable::TableKey &table_key,
const ObRestoreBaseInfo &restore_base_info,
backup::ObBackupMetaIndexStoreWrapper &meta_index_store,
backup::ObBackupSSTableSecMetaIterator *&sstable_sec_meta_iterator)
{
int ret = OB_SUCCESS;
blocksstable::ObDatumRange query_range;
query_range.set_whole_range();
if (OB_FAIL(create_backup_sstable_sec_meta_iterator(tenant_id,
tablet_id,
tablet_handle,
table_key,
query_range,
restore_base_info,
meta_index_store,
sstable_sec_meta_iterator))) {
LOG_WARN("failed to create backup sstable sec meta iterator", K(ret));
}
return ret;
}
/******************ObTabletGroupRestoreArg*********************/
ObTabletGroupRestoreArg::ObTabletGroupRestoreArg()
: tenant_id_(OB_INVALID_ID),
@ -783,15 +857,14 @@ int ObRestoreMacroBlockIdMgr::inner_init_v2_(
const ObITable::TableKey &table_key = sstable_metas.at(index).sstable_meta_.table_key_;
ObArenaAllocator allocator;
backup::ObBackupSSTableSecMetaIterator *iterator = NULL;
if (OB_ISNULL(iterator = backup::ObLSBackupFactory::get_backup_sstable_sec_meta_iterator(tenant_id))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("failed to get backup sstable sec meta iterator", K(ret));
} else if (OB_FAIL(prepare_backup_sstable_sec_meta_iterator_(tablet_id, tablet_handle,
table_key, restore_base_info, allocator, meta_index_store, iterator))) {
LOG_WARN("failed to prepare sstable sec meta iterator from backup", K(ret), K(tablet_id), K(table_key));
} else if (OB_ISNULL(iterator)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("iterator should not be null", K(ret));
if (OB_FAIL(ObRestoreUtils::create_backup_sstable_sec_meta_iterator(tenant_id,
tablet_id,
tablet_handle,
table_key,
restore_base_info,
meta_index_store,
iterator))) {
LOG_WARN("failed to create backup sstable sec meta iterator", K(ret), K(tablet_id), K(table_key));
} else if (OB_FAIL(get_macro_block_index_list_from_iter_(*iterator, block_id_array_))) {
LOG_WARN("failed to get macro block index list from iter", K(ret), K(tablet_id), K(table_key), K(restore_base_info));
} else {
@ -900,38 +973,6 @@ int ObRestoreMacroBlockIdMgr::get_restore_macro_block_id_array(
return ret;
}
int ObRestoreMacroBlockIdMgr::prepare_backup_sstable_sec_meta_iterator_(
const common::ObTabletID &tablet_id,
const storage::ObTabletHandle &tablet_handle,
const ObITable::TableKey &table_key,
const ObRestoreBaseInfo &restore_base_info,
common::ObIAllocator &allocator,
backup::ObBackupMetaIndexStoreWrapper &meta_index_store,
backup::ObBackupSSTableSecMetaIterator *&sstable_sec_meta_iterator)
{
int ret = OB_SUCCESS;
const share::ObBackupDest &backup_dest = restore_base_info.backup_dest_;
share::ObBackupSetDesc backup_set_desc;
backup::ObRestoreMetaIndexStore *meta_index_store_ptr = NULL;
ObBackupDataType backup_data_type;
if (OB_FAIL(restore_base_info.get_last_backup_set_desc(backup_set_desc))) {
LOG_WARN("failed to get last backup set desc", K(ret));
} else if (OB_FAIL(ObRestoreUtils::get_backup_data_type(table_key, backup_data_type))) {
LOG_WARN("failed to get backup data type", K(ret), K(table_key));
} else if (OB_FAIL(meta_index_store.get_backup_meta_index_store(backup_data_type, meta_index_store_ptr))) {
LOG_WARN("failed to get backup meta index store", K(ret), K(backup_data_type));
} else if (OB_FAIL(sstable_sec_meta_iterator->init(tablet_id,
tablet_handle,
table_key,
backup_dest,
backup_set_desc,
*meta_index_store_ptr))) {
LOG_WARN("failed to init sstable sec meta iterator", K(ret), K(tablet_id), K(table_key),
K(backup_dest), K(backup_set_desc), K(restore_base_info));
}
return ret;
}
int ObRestoreMacroBlockIdMgr::get_macro_block_index_list_from_iter_(
backup::ObBackupSSTableSecMetaIterator &meta_iter,
common::ObIArray<ObRestoreMacroBlockId> &macro_id_list)

View File

@ -103,9 +103,29 @@ struct ObTabletRestoreAction
struct ObRestoreUtils
{
static int get_backup_data_type(
static int get_backup_data_type(
const ObITable::TableKey &table_key,
share::ObBackupDataType &data_type);
// call backup::ObLSBackupFactory::free to release iterator after not use.
static int create_backup_sstable_sec_meta_iterator(
const uint64_t tenant_id,
const common::ObTabletID &tablet_id,
const storage::ObTabletHandle &tablet_handle,
const ObITable::TableKey &table_key,
const blocksstable::ObDatumRange &query_range,
const ObRestoreBaseInfo &restore_base_info,
backup::ObBackupMetaIndexStoreWrapper &meta_index_store,
backup::ObBackupSSTableSecMetaIterator *&sstable_sec_meta_iterator);
static int create_backup_sstable_sec_meta_iterator(
const uint64_t tenant_id,
const common::ObTabletID &tablet_id,
const storage::ObTabletHandle &tablet_handle,
const ObITable::TableKey &table_key,
const ObRestoreBaseInfo &restore_base_info,
backup::ObBackupMetaIndexStoreWrapper &meta_index_store,
backup::ObBackupSSTableSecMetaIterator *&sstable_sec_meta_iterator);
};
struct ObTabletGroupRestoreArg
@ -240,14 +260,6 @@ private:
backup::ObBackupMetaIndexStoreWrapper &meta_index_store);
private:
int prepare_backup_sstable_sec_meta_iterator_(
const common::ObTabletID &tablet_id,
const storage::ObTabletHandle &tablet_handle,
const ObITable::TableKey &table_key,
const ObRestoreBaseInfo &restore_base_info,
common::ObIAllocator &allocator,
backup::ObBackupMetaIndexStoreWrapper &meta_index_store,
backup::ObBackupSSTableSecMetaIterator *&sstable_sec_meta_iterator);
int get_macro_block_index_list_from_iter_(
backup::ObBackupSSTableSecMetaIterator &sstable_sec_meta_iterator,
common::ObIArray<ObRestoreMacroBlockId> &macro_id_list);

View File

@ -2817,9 +2817,8 @@ int ObTabletRestoreTask::check_need_copy_macro_blocks_(
bool &need_copy)
{
int ret = OB_SUCCESS;
if (ObTabletRestoreAction::is_restore_remote_sstable(tablet_restore_ctx_->action_)) {
need_copy = false;
} else if (OB_FAIL(ObStorageHATaskUtils::check_need_copy_macro_blocks(param,
// TODO(wangxiaohui.wxh): do not copy macro blocks when restore remote sstable
if (OB_FAIL(ObStorageHATaskUtils::check_need_copy_macro_blocks(param,
tablet_restore_ctx_->is_leader_,
need_copy))) {
LOG_WARN("failed to check need copy macro blocks", K(ret), K(param), KPC(tablet_restore_ctx_));

View File

@ -179,9 +179,19 @@ int ObTenantRestoreInfoMgr::refresh_restore_info()
int ObTenantRestoreInfoMgr::get_backup_dest(const int64_t backup_set_id, share::ObBackupDest &backup_dest)
{
int ret = OB_SUCCESS;
#ifdef ERRSIM
const bool enable_error_test = GCONF.enable_quick_restore_remove_backup_dest_test;
if (enable_error_test) {
ret = OB_EAGAIN;
LOG_WARN("enable error test, fake backup dest is removed", K(ret));
}
#endif
lib::ObMutexGuard guard(mutex_);
int64_t idx = -1;
if (!is_refreshed_) {
if (OB_FAIL(ret)) {
} else if (!is_refreshed_) {
ret = OB_EAGAIN;
LOG_WARN("restore info has not been refreshed", K(ret), K(backup_set_id));
} else if (OB_FAIL(get_restore_backup_set_brief_info_(backup_set_id, idx))) {

View File

@ -1402,3 +1402,41 @@ bool ObTableStoreUtil::check_intersect_by_scn_range(const ObITable &a, const ObI
}
return bret;
}
int ObTableStoreUtil::check_has_backup_macro_block(const ObITable *table, bool &has_backup_macro)
{
int ret = OB_SUCCESS;
ObSSTableMetaHandle sst_meta_hdl;
common::ObArray<ObSSTableWrapper> cg_sstable_array;
has_backup_macro = false;
if (OB_ISNULL(table)) {
ret = OB_INVALID_ARGUMENT;
LOG_ERROR("table is null", K(ret));
} else if (table->is_memtable()) {
// memtable has no backup macro block
} else if (OB_FAIL(static_cast<const ObSSTable *>(table)->get_meta(sst_meta_hdl))) {
LOG_WARN("failed to get new sstable meta handle", K(ret), KPC(table));
} else if (sst_meta_hdl.get_sstable_meta().get_basic_meta().table_backup_flag_.has_backup()) {
has_backup_macro = true;
} else if (!table->is_co_sstable()) {
} else if (!static_cast<const ObCOSSTableV2 *>(table)->is_inited()) {
} else if (OB_FAIL(static_cast<const ObCOSSTableV2 *>(table)->get_all_tables(cg_sstable_array))) {
LOG_WARN("failed to get all cg tables from co table", K(ret), KPC(table));
} else {
for (int64_t i = 0; OB_SUCC(ret) && i < cg_sstable_array.count(); ++i) {
ObSSTableWrapper &sstable_wrapper = cg_sstable_array.at(i);
ObSSTable *sstable = NULL;
if (OB_ISNULL(sstable = sstable_wrapper.get_sstable())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("table should not be null", K(ret));
} else if (OB_FAIL(sstable->get_meta(sst_meta_hdl))) {
LOG_WARN("failed to get sstable meta handle", K(ret), KPC(sstable));
} else if (sst_meta_hdl.get_sstable_meta().get_basic_meta().table_backup_flag_.has_backup()) {
has_backup_macro = true;
break;
}
}
}
return ret;
}

View File

@ -256,6 +256,8 @@ struct ObTableStoreUtil
static bool check_include_by_scn_range(const ObITable &ltable, const ObITable &rtable);
static bool check_intersect_by_scn_range(const ObITable &ltable, const ObITable &rtable);
static int check_has_backup_macro_block(const ObITable *table, bool &has_backup_macro);
};
} // storage

View File

@ -5836,16 +5836,16 @@ int ObTablet::start_direct_load_task_if_need()
if (OB_FAIL(pre_process_cs_replica(direct_load_param))) {
LOG_WARN("failed to process cs replica", K(ret), KPC(this));
} else if (OB_FAIL(tenant_direct_load_mgr->create_tablet_direct_load(
unused_context_id,
tablet_meta_.ddl_execution_id_,
direct_load_param,
tablet_meta_.ddl_checkpoint_scn_,
true/*only_persisted_ddl_data*/))) {
} else if (OB_FAIL(tenant_direct_load_mgr->replay_create_tablet_direct_load(
this, tablet_meta_.ddl_execution_id_, direct_load_param))) {
LOG_WARN("create tablet manager failed", K(ret));
} else if (OB_FAIL(tenant_direct_load_mgr->get_tablet_mgr(
ObTabletDirectLoadMgrKey(tablet_meta_.tablet_id_, ObDirectLoadType::DIRECT_LOAD_DDL), direct_load_mgr_handle))) {
LOG_WARN("get tablet mgr failed", K(ret), K(tablet_meta_));
} else if (OB_FAIL(direct_load_mgr_handle.get_full_obj()->update(
nullptr/*lob_direct_load_mgr*/, // replay is independent for data and lob meta tablet, force null here
direct_load_param))) {
LOG_WARN("update direct load mgr failed", K(ret));
} else if (OB_FAIL(direct_load_mgr_handle.get_full_obj()->start_with_checkpoint(
*this, tablet_meta_.ddl_start_scn_, tablet_meta_.ddl_data_format_version_,
tablet_meta_.ddl_execution_id_, tablet_meta_.ddl_checkpoint_scn_))) {

View File

@ -1569,14 +1569,15 @@ int ObTabletTableStore::inner_replace_remote_major_sstable_(
LOG_WARN("failed to get major tables from old store", K(ret), K(old_store));
}
bool has_backup_macro = false;
for (int64_t idx = 0; OB_SUCC(ret) && idx < old_tables_array.count(); ++idx) {
old_table = old_tables_array.at(idx);
if (OB_ISNULL(old_table)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get unexpected null table", K(ret), K(old_store));
} else if (OB_FAIL(static_cast<ObSSTable *>(old_table)->get_meta(old_sst_meta_hdl))) {
LOG_WARN("failed to get old sstable meta handle", K(ret), KPC(old_table));
} else if (old_sst_meta_hdl.get_sstable_meta().get_basic_meta().table_backup_flag_.has_no_backup()) {
} else if (OB_FAIL(ObTableStoreUtil::check_has_backup_macro_block(old_table, has_backup_macro))) {
LOG_WARN("failed to check table has backup macro block", K(ret), KPC(old_table));
} else if (!has_backup_macro) {
if (OB_FAIL(new_tables_array.push_back(old_table))) {
LOG_WARN("failed to push back", K(ret));
}