fix problem about ss merge && fix mysqltest case

This commit is contained in:
Fengjingkun 2024-12-11 13:15:21 +00:00 committed by ob-robot
parent 851163a95b
commit bb6cb53d73
2 changed files with 31 additions and 10 deletions

View File

@ -726,8 +726,21 @@ int ObMediumCompactionScheduleFunc::check_if_schema_changed(
bool &is_schema_changed)
{
int ret = OB_SUCCESS;
is_schema_changed = false;
int64_t full_stored_col_cnt = 0;
if (OB_UNLIKELY(!schema.is_inited())) {
ObTabletMemberWrapper<ObTabletTableStore> wrapper;
ObSSTable *last_major = nullptr;
if (OB_FAIL(tablet.fetch_table_store(wrapper))) {
LOG_WARN("failed to get table store wrapper", K(ret));
} else if (FALSE_IT(last_major = static_cast<ObSSTable*>(wrapper.get_member()->get_major_sstables().get_boundary_table(true/*last*/)))) {
} else if (OB_ISNULL(last_major)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get unexpected null major sstable", KR(ret), KPC(last_major));
} else if (0 == last_major->get_data_macro_block_count()
&& ObCompressorType::NONE_COMPRESSOR == tablet.get_last_major_compressor_type()) {
// empty major, no need to check whether schema changed
} else if (OB_UNLIKELY(!schema.is_inited())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("schema is not inited", KR(ret), K(schema));
} else if (OB_FAIL(schema.get_stored_column_count_in_sstable(full_stored_col_cnt))) {
@ -735,19 +748,23 @@ int ObMediumCompactionScheduleFunc::check_if_schema_changed(
} else if (OB_UNLIKELY(tablet.get_last_major_column_count() > full_stored_col_cnt)) {
ret = OB_ERR_UNEXPECTED;
LOG_ERROR("stored col cnt in curr schema is less than old major sstable", K(ret),
"col_cnt_in_sstable", tablet.get_last_major_column_count(),
"col_cnt_in_schema", full_stored_col_cnt, K(schema));
} else if (tablet.get_last_major_column_count() != full_stored_col_cnt
|| tablet.get_last_major_compressor_type() != schema.get_compressor_type()
|| (ObRowStoreType::DUMMY_ROW_STORE != tablet.get_last_major_latest_row_store_type()
&& tablet.get_last_major_latest_row_store_type() != schema.row_store_type_)) {
"col_cnt_in_sstable", tablet.get_last_major_column_count(),
"col_cnt_in_schema", full_stored_col_cnt, K(schema));
} else if (tablet.get_last_major_column_count() != full_stored_col_cnt) {
is_schema_changed = true;
LOG_INFO("schema changed", K(schema), K(full_stored_col_cnt),
"col_cnt_in_sstable", tablet.get_last_major_column_count(),
"compressor_type_in_sstable", tablet.get_last_major_compressor_type(),
"col_cnt_in_sstable", tablet.get_last_major_column_count());
} else if (ObRowStoreType::DUMMY_ROW_STORE != tablet.get_last_major_latest_row_store_type()
&& tablet.get_last_major_latest_row_store_type() != schema.row_store_type_) {
is_schema_changed = true;
LOG_INFO("schema changed", K(schema),
"latest_row_store_type_in_sstable", tablet.get_last_major_latest_row_store_type());
} else if (tablet.get_last_major_compressor_type() == schema.get_compressor_type()) {
// schema not changed, do nothing
} else {
is_schema_changed = false;
is_schema_changed = true;
LOG_INFO("schema changed", K(schema), KPC(last_major),
"compressor_type_in_sstable", tablet.get_last_major_compressor_type());
}
return ret;
}

View File

@ -95,6 +95,7 @@
#include "share/ob_tablet_replica_checksum_operator.h"
#include "storage/blocksstable/ob_datum_row_utils.h"
#include "storage/compaction/ob_partition_merge_policy.h"
#include "observer/ob_server_event_history_table_operator.h"
namespace oceanbase
{
@ -5615,6 +5616,9 @@ int ObTablet::build_migration_tablet_param_major_ckm_info(
LOG_WARN("major ckm info on table store is invalid", K(ret), K(tablet_id), K(major_ckm_info));
} else if (major_ckm_info.is_empty() || is_output_exec_mode(major_ckm_info.get_exec_mode())) {
// do not copy OUTPUT major ckm info to migrate or backup
#ifdef ERRSIM
SERVER_EVENT_SYNC_ADD("ss_merge_errsim", "src_is_exec_svr", "tenant_id", MTL_ID(), "ls_id", tablet_meta_.get_ls_id());
#endif
} else if (OB_FAIL(mig_tablet_param.major_ckm_info_.assign(major_ckm_info, &mig_tablet_param.allocator_))) {
LOG_WARN("failed to assign major ckm info from table store", K(ret), K(tablet_id), K(table_store));
}