fix backup report -4002 issue
This commit is contained in:
@ -1126,17 +1126,52 @@ ObBackupProviderItem::ObBackupProviderItem()
|
||||
ObBackupProviderItem::~ObBackupProviderItem()
|
||||
{}
|
||||
|
||||
int ObBackupProviderItem::set_with_fake(const ObBackupProviderItemType &item_type, const common::ObTabletID &tablet_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (PROVIDER_ITEM_SSTABLE_META != item_type && PROVIDER_ITEM_TABLET_META != item_type) {
|
||||
ret = OB_ERR_SYS;
|
||||
LOG_WARN("get invalid args", K(ret));
|
||||
} else if (!tablet_id.is_valid()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("get invalid args", K(ret), K(tablet_id));
|
||||
} else {
|
||||
item_type_ = item_type;
|
||||
logic_id_ = get_fake_logic_id_();
|
||||
macro_block_id_ = get_fake_macro_id_();
|
||||
table_key_ = get_fake_table_key_();
|
||||
tablet_id_ = tablet_id;
|
||||
if (!is_valid()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("provider item not valid", K(ret), KPC(this));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObBackupProviderItem::set(const ObBackupProviderItemType &item_type, const ObBackupMacroBlockId ¯o_id,
|
||||
const ObITable::TableKey &table_key, const common::ObTabletID &tablet_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
item_type_ = item_type;
|
||||
logic_id_ = macro_id.logic_id_;
|
||||
macro_block_id_ = macro_id.macro_block_id_;
|
||||
table_key_ = table_key;
|
||||
tablet_id_ = tablet_id;
|
||||
nested_offset_ = macro_id.nested_offset_;
|
||||
nested_size_ = macro_id.nested_size_;
|
||||
if (PROVIDER_ITEM_MACRO_ID != item_type) {
|
||||
ret = OB_ERR_SYS;
|
||||
LOG_WARN("get invalid args", K(ret));
|
||||
} else if (!macro_id.is_valid() || !table_key.is_valid() || !tablet_id.is_valid()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("get invalid args", K(ret), K(macro_id), K(table_key), K(tablet_id));
|
||||
} else {
|
||||
item_type_ = item_type;
|
||||
logic_id_ = macro_id.logic_id_;
|
||||
macro_block_id_ = macro_id.macro_block_id_;
|
||||
table_key_ = table_key;
|
||||
tablet_id_ = tablet_id;
|
||||
nested_offset_ = macro_id.nested_offset_;
|
||||
nested_size_ = macro_id.nested_size_;
|
||||
if (!is_valid()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("provider item not valid", K(ret), KPC(this));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1208,15 +1243,14 @@ int ObBackupProviderItem::deep_copy(const ObBackupProviderItem &src, char *buf,
|
||||
|
||||
bool ObBackupProviderItem::is_valid() const
|
||||
{
|
||||
bool bret = true;
|
||||
if (PROVIDER_ITEM_MACRO_ID == item_type_) {
|
||||
bret = logic_id_.is_valid() && table_key_.is_valid() && tablet_id_.is_valid(); // no need to check macro id valid
|
||||
} else if (PROVIDER_ITEM_SSTABLE_META == item_type_) {
|
||||
bret = tablet_id_.is_valid();
|
||||
} else if (PROVIDER_ITEM_TABLET_META == item_type_) {
|
||||
bret = tablet_id_.is_valid();
|
||||
} else {
|
||||
bool bret = false;
|
||||
if (PROVIDER_ITEM_MACRO_ID != item_type_
|
||||
&& PROVIDER_ITEM_SSTABLE_META != item_type_
|
||||
&& PROVIDER_ITEM_TABLET_META != item_type_) {
|
||||
bret = false;
|
||||
} else {
|
||||
bret = logic_id_.is_valid() && macro_block_id_.is_valid()
|
||||
&& table_key_.is_valid() && tablet_id_.is_valid();
|
||||
}
|
||||
return bret;
|
||||
}
|
||||
@ -1290,6 +1324,26 @@ DEFINE_GET_SERIALIZE_SIZE(ObBackupProviderItem)
|
||||
return size;
|
||||
}
|
||||
|
||||
ObITable::TableKey ObBackupProviderItem::get_fake_table_key_() const
|
||||
{
|
||||
ObITable::TableKey table_key;
|
||||
table_key.tablet_id_ = ObTabletID(1);
|
||||
table_key.table_type_ = ObITable::TableType::MAJOR_SSTABLE;
|
||||
table_key.version_range_.snapshot_version_ = 0;
|
||||
table_key.column_group_idx_ = 0;
|
||||
return table_key;
|
||||
}
|
||||
|
||||
ObLogicMacroBlockId ObBackupProviderItem::get_fake_logic_id_() const
|
||||
{
|
||||
return ObLogicMacroBlockId(0/*data_seq*/, 1/*logic_version*/, 1/*tablet_id*/);
|
||||
}
|
||||
|
||||
MacroBlockId ObBackupProviderItem::get_fake_macro_id_() const
|
||||
{
|
||||
return MacroBlockId(4096/*first_id*/, 0/*second_id*/, 0/*third_id*/);
|
||||
}
|
||||
|
||||
/* ObBackupProviderItemCompare */
|
||||
|
||||
ObBackupProviderItemCompare::ObBackupProviderItemCompare(int &sort_ret) : result_code_(sort_ret), backup_data_type_()
|
||||
@ -1874,13 +1928,7 @@ int ObBackupTabletProvider::add_sstable_item_(const common::ObTabletID &tablet_i
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObBackupProviderItem item;
|
||||
ObLogicMacroBlockId fake_logic_id;
|
||||
MacroBlockId fake_macro_block_id;
|
||||
ObITable::TableKey fake_table_key;
|
||||
ObBackupMacroBlockId macro_id;
|
||||
macro_id.macro_block_id_ = fake_macro_block_id;
|
||||
macro_id.logic_id_ = fake_logic_id;
|
||||
if (OB_FAIL(item.set(PROVIDER_ITEM_SSTABLE_META, macro_id, fake_table_key, tablet_id))) {
|
||||
if (OB_FAIL(item.set_with_fake(PROVIDER_ITEM_SSTABLE_META, tablet_id))) {
|
||||
LOG_WARN("failed to set item", K(ret), K(tablet_id));
|
||||
} else if (!item.is_valid()) {
|
||||
ret = OB_INVALID_DATA;
|
||||
@ -1897,14 +1945,8 @@ int ObBackupTabletProvider::add_tablet_item_(const common::ObTabletID &tablet_id
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObBackupProviderItem item;
|
||||
ObLogicMacroBlockId fake_logic_id;
|
||||
MacroBlockId fake_macro_block_id;
|
||||
ObITable::TableKey fake_table_key;
|
||||
ObBackupMacroBlockId macro_id;
|
||||
macro_id.macro_block_id_ = fake_macro_block_id;
|
||||
macro_id.logic_id_ = fake_logic_id;
|
||||
if (OB_FAIL(item.set(PROVIDER_ITEM_TABLET_META, macro_id, fake_table_key, tablet_id))) {
|
||||
LOG_WARN("failed to set item", K(ret), K(fake_table_key), K(tablet_id));
|
||||
if (OB_FAIL(item.set_with_fake(PROVIDER_ITEM_TABLET_META, tablet_id))) {
|
||||
LOG_WARN("failed to set item", K(ret), K(tablet_id));
|
||||
} else if (!item.is_valid()) {
|
||||
ret = OB_INVALID_DATA;
|
||||
LOG_WARN("backup item is not valid", K(ret), K(item));
|
||||
|
||||
Reference in New Issue
Block a user