Fix root_macro_seq compat

This commit is contained in:
JiahuaChen 2024-08-22 09:10:56 +00:00 committed by ob-robot
parent ba068fff43
commit 11d47a78ce
4 changed files with 18 additions and 10 deletions

View File

@ -1135,6 +1135,10 @@ TEST_F(TestLSTabletService, test_empty_shell_mds_compat)
ASSERT_TRUE(nullptr == upgrade_tablet.mds_data_);
ASSERT_TRUE(ObTabletStatus::Status::DELETED == upgrade_tablet.tablet_meta_.last_persisted_committed_tablet_status_.tablet_status_);
// release tmp memory and tablet
empty_shell_tablet.mds_data_->~ObTabletMdsData();
compat_allocator.free(empty_shell_tablet.mds_data_);
empty_shell_tablet.mds_data_ = nullptr;
ret = ls_tablet_service_->do_remove_tablet(ls_id_, tablet_id);
ASSERT_EQ(OB_SUCCESS, ret);
}

View File

@ -64,9 +64,9 @@ ObSSTableBasicMeta::ObSSTableBasicMeta()
master_key_id_(0),
sstable_logic_seq_(0),
latest_row_store_type_(ObRowStoreType::MAX_ROW_STORE),
root_macro_seq_(0),
table_backup_flag_(),
table_shared_flag_()
table_shared_flag_(),
root_macro_seq_(0)
{
MEMSET(encrypt_key_, 0, share::OB_MAX_TABLESPACE_ENCRYPT_KEY_LENGTH);
}
@ -248,7 +248,8 @@ DEFINE_SERIALIZE(ObSSTableBasicMeta)
sstable_logic_seq_,
latest_row_store_type_,
table_backup_flag_,
table_shared_flag_);
table_shared_flag_,
root_macro_seq_);
if (OB_FAIL(ret)) {
} else if (OB_UNLIKELY(length_ != pos - start_pos)) {
ret = OB_ERR_UNEXPECTED;
@ -330,7 +331,8 @@ int ObSSTableBasicMeta::decode_for_compat(const char *buf, const int64_t data_le
sstable_logic_seq_,
latest_row_store_type_,
table_backup_flag_,
table_shared_flag_);
table_shared_flag_,
root_macro_seq_);
return ret;
}
@ -373,7 +375,8 @@ DEFINE_GET_SERIALIZE_SIZE(ObSSTableBasicMeta)
sstable_logic_seq_,
latest_row_store_type_,
table_backup_flag_,
table_shared_flag_);
table_shared_flag_,
root_macro_seq_);
return len;
}

View File

@ -187,10 +187,10 @@ public:
int16_t sstable_logic_seq_;
common::ObRowStoreType latest_row_store_type_;
char encrypt_key_[share::OB_MAX_TABLESPACE_ENCRYPT_KEY_LENGTH];
int64_t root_macro_seq_; // placeholder, will be used after palf branch merged
storage::ObTableBackupFlag table_backup_flag_; //cannot add backup flag to ObSSTableMetaChecker
//quick restore with rebuild replace major will has same key sstable
storage::ObTableSharedFlag table_shared_flag_;
int64_t root_macro_seq_; // placeholder, will be used after palf branch merged
//Add new variable need consider ObSSTableMetaChecker
};

View File

@ -630,6 +630,7 @@ TEST_F(TestSSTableMeta, test_sstable_meta_deep_copy)
const int64_t buf_size = 8 << 10; //8K
int64_t pos = 0;
char *flat_buf_1 = (char*)ob_malloc(buf_size, ObMemAttr());
MEMSET(flat_buf_1, 0, buf_size);
int64_t deep_copy_size = src_meta.get_deep_copy_size();
ObSSTableMeta *flat_meta_1;
ret = src_meta.deep_copy(flat_buf_1, deep_copy_size, pos, flat_meta_1);
@ -637,11 +638,10 @@ TEST_F(TestSSTableMeta, test_sstable_meta_deep_copy)
ASSERT_EQ(deep_copy_size, pos);
OB_LOG(INFO, "cooper", K(src_meta), K(sizeof(ObSSTableMeta)), K(deep_copy_size));
OB_LOG(INFO, "cooper", K(*flat_meta_1));
// can't use MEMCMP between dynamic memory and flat memory, because one is stack, the other is heap
ASSERT_EQ(src_meta.basic_meta_, flat_meta_1->basic_meta_);
// ASSERT_EQ(0, MEMCMP((char*)&src_meta.data_root_info_, (char*)&flat_meta_1->data_root_info_, sizeof(src_meta.data_root_info_)));
// ASSERT_EQ(0, MEMCMP((char*)&src_meta.macro_info_, (char*)&dst_meta->macro_info_, sizeof(src_meta.macro_info_)));
// ASSERT_EQ(0, MEMCMP((char*)&src_meta.cg_sstables_, (char*)&dst_meta->cg_sstables_, sizeof(src_meta.cg_sstables_)));
ASSERT_EQ(0, MEMCMP((char*)&src_meta.data_root_info_, (char*)&flat_meta_1->data_root_info_, sizeof(src_meta.data_root_info_)));
ASSERT_EQ(0, MEMCMP((char*)&src_meta.macro_info_, (char*)&flat_meta_1->macro_info_, sizeof(src_meta.macro_info_)));
// ASSERT_EQ(0, MEMCMP((char*)&src_meta.cg_sstables_, (char*)&flat_meta_1->cg_sstables_, sizeof(src_meta.cg_sstables_)));
ASSERT_EQ(0, MEMCMP(src_meta.column_checksums_, flat_meta_1->column_checksums_, src_meta.column_checksum_count_ * sizeof(int64_t)));
ASSERT_EQ(src_meta.tx_ctx_.len_, flat_meta_1->tx_ctx_.len_);
ASSERT_EQ(src_meta.tx_ctx_.count_, flat_meta_1->tx_ctx_.count_);
@ -650,6 +650,7 @@ TEST_F(TestSSTableMeta, test_sstable_meta_deep_copy)
// test deep copy from flat memory meta to flat memory meta
pos = 0;
char *flat_buf_2 = (char*)ob_malloc_align(4<<10, buf_size, ObMemAttr());
MEMSET(flat_buf_2, 0, buf_size);
deep_copy_size = flat_meta_1->get_deep_copy_size();
ObSSTableMeta *flat_meta_2;
ret = flat_meta_1->deep_copy(flat_buf_2, deep_copy_size, pos, flat_meta_2);