fix zero data checksum for row store column table && fix empty result for compaction in errsim mode
This commit is contained in:
@ -466,6 +466,7 @@ int ObCOTabletMergeCtx::create_sstable(const ObSSTable *&new_sstable)
|
||||
const ObIArray<ObStorageColumnGroupSchema> &cg_schemas = get_schema()->get_column_groups();
|
||||
const ObTablesHandleArray &cg_tables_handle = merged_cg_tables_handle_;
|
||||
ObITable *base_co_table = nullptr;
|
||||
ObCOSSTableV2 *co_sstable = nullptr;
|
||||
|
||||
/*
|
||||
* There are only 2 case:
|
||||
@ -484,10 +485,13 @@ int ObCOTabletMergeCtx::create_sstable(const ObSSTable *&new_sstable)
|
||||
CTX_SET_DIAGNOSE_LOCATION(*this);
|
||||
} else if (FALSE_IT(base_co_table = cg_tables_handle.get_table(0))) {
|
||||
} else if (OB_UNLIKELY(NULL == base_co_table || !base_co_table->is_co_sstable()
|
||||
|| !static_cast<ObCOSSTableV2 *>(base_co_table)->is_cgs_empty_co_table())) {
|
||||
|| OB_ISNULL(co_sstable = static_cast<ObCOSSTableV2 *>(base_co_table)))) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("get unexpected cg sstable", K(ret), KPC(base_co_table), K(cg_tables_handle), K(cg_schemas));
|
||||
CTX_SET_DIAGNOSE_LOCATION(*this);
|
||||
} else if (OB_FAIL(co_sstable->build_cs_meta_without_cgs())) {
|
||||
LOG_WARN("failed to build cs meta without cgs", K(ret), KPC(this));
|
||||
CTX_SET_DIAGNOSE_LOCATION(*this);
|
||||
} else {
|
||||
// only exist one co table here, emtpy or empty cg sstables
|
||||
new_sstable = static_cast<ObSSTable *>(base_co_table);
|
||||
|
@ -293,6 +293,33 @@ int ObCOSSTableV2::fill_cg_sstables(const common::ObIArray<ObITable *> &cg_table
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObCOSSTableV2::build_cs_meta_without_cgs()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSSTableMetaHandle sstable_meta_handle;
|
||||
if (OB_UNLIKELY(!is_cgs_empty_co_)) {
|
||||
ret = OB_STATE_NOT_MATCH;
|
||||
LOG_WARN("no need to build cs meta for co table without cg sstables", K(ret), KPC(this));
|
||||
} else if (OB_UNLIKELY(!is_loaded())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("co table is unexpected not loaded", K(ret), KPC(this));
|
||||
} else if (OB_FAIL(ObSSTable::get_meta(sstable_meta_handle))) {
|
||||
LOG_WARN("failed to get meta handle", K(ret), KPC(this));
|
||||
} else {
|
||||
const ObSSTableBasicMeta &basic_meta = sstable_meta_handle.get_sstable_meta().get_basic_meta();
|
||||
cs_meta_.data_macro_block_cnt_ = basic_meta.data_macro_block_count_;
|
||||
cs_meta_.use_old_macro_block_cnt_ = basic_meta.use_old_macro_block_count_;
|
||||
cs_meta_.data_micro_block_cnt_ = basic_meta.data_micro_block_count_;
|
||||
cs_meta_.index_macro_block_cnt_ = basic_meta.index_macro_block_count_;
|
||||
cs_meta_.occupy_size_ = basic_meta.occupy_size_;
|
||||
cs_meta_.original_size_ = basic_meta.original_size_;
|
||||
cs_meta_.data_checksum_ = basic_meta.data_checksum_;
|
||||
// cs_meta_.column_group_cnt_ and cs_meta_.full_column_cnt_ are assigned in ObCOSSTableV2::init
|
||||
LOG_INFO("[RowColSwitch] finish build cs meta without cg sstables", K_(cs_meta), K(basic_meta), KPC(this));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObCOSSTableV2::build_cs_meta()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -143,6 +143,7 @@ public:
|
||||
bool is_row_store_only_co_table() const { return is_cgs_empty_co_ && is_all_cg_base(); }
|
||||
bool is_cgs_empty_co_table() const { return is_cgs_empty_co_; }
|
||||
int fill_cg_sstables(const common::ObIArray<ObITable *> &cg_tables);
|
||||
int build_cs_meta_without_cgs();
|
||||
OB_INLINE const ObCOSSTableMeta &get_cs_meta() const { return cs_meta_; }
|
||||
OB_INLINE bool is_all_cg_base() const { return ObCOSSTableBaseType::ALL_CG_TYPE == base_type_; }
|
||||
OB_INLINE bool is_rowkey_cg_base() const { return ObCOSSTableBaseType::ROWKEY_CG_TYPE == base_type_; }
|
||||
|
@ -573,7 +573,7 @@ int ObMediumCompactionScheduleFunc::decide_medium_snapshot()
|
||||
}
|
||||
#ifdef ERRSIM
|
||||
if (OB_SUCC(ret) || OB_NO_NEED_MERGE == ret) {
|
||||
ret = errsim_choose_medium_snapshot(max_sync_medium_scn, medium_info);
|
||||
ret = errsim_choose_medium_snapshot(max_sync_medium_scn, medium_info, result);
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
ret = OB_E(EventTable::EN_SCHEDULE_MEDIUM_FAILED) ret;
|
||||
@ -614,12 +614,15 @@ int ObMediumCompactionScheduleFunc::decide_medium_snapshot()
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef ERRSIM
|
||||
int ObMediumCompactionScheduleFunc::errsim_choose_medium_snapshot(
|
||||
const int64_t max_sync_medium_scn,
|
||||
ObMediumCompactionInfo &medium_info)
|
||||
ObMediumCompactionInfo &medium_info,
|
||||
ObGetMergeTablesResult &result)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (tablet_handle_.get_obj()->get_tablet_meta().tablet_id_.id() > ObTabletID::MIN_USER_TABLET_ID) {
|
||||
ObTablet &tablet = *tablet_handle_.get_obj();
|
||||
if (tablet.get_tablet_meta().tablet_id_.id() > ObTabletID::MIN_USER_TABLET_ID) {
|
||||
ret = OB_E(EventTable::EN_SCHEDULE_MEDIUM_COMPACTION) ret;
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
@ -629,18 +632,22 @@ int ObMediumCompactionScheduleFunc::errsim_choose_medium_snapshot(
|
||||
medium_info.medium_snapshot_ = MIN(weak_read_ts_, snapshot_gc_ts);
|
||||
medium_info.compaction_type_ = ObMediumCompactionInfo::MEDIUM_COMPACTION;
|
||||
int64_t max_reserved_snapshot = 0;
|
||||
(void) result.reset();
|
||||
if (OB_FAIL(get_max_reserved_snapshot(max_reserved_snapshot))) {
|
||||
LOG_WARN("failed to get reserved snapshot", K(ret), KPC(this));
|
||||
} else if (medium_info.medium_snapshot_ > max_sync_medium_scn
|
||||
&& medium_info.medium_snapshot_ >= max_reserved_snapshot) {
|
||||
} else if (medium_info.medium_snapshot_ <= max_sync_medium_scn
|
||||
|| medium_info.medium_snapshot_ < max_reserved_snapshot) {
|
||||
ret = OB_NO_NEED_MERGE;
|
||||
} else if (OB_FAIL(ObPartitionMergePolicy::get_result_by_snapshot(tablet, medium_info.medium_snapshot_, result))) {
|
||||
LOG_WARN("failed to get result by snapshot", K(ret), K(medium_info), KPC(this));
|
||||
} else {
|
||||
FLOG_INFO("ERRSIM EN_SCHEDULE_MEDIUM_COMPACTION", KPC(this));
|
||||
ret = OB_SUCCESS;
|
||||
} else {
|
||||
ret = OB_NO_NEED_MERGE;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
int ObMediumCompactionScheduleFunc::init_schema_changed(
|
||||
ObMediumCompactionInfo &medium_info)
|
||||
|
@ -195,10 +195,12 @@ protected:
|
||||
|| ObAdaptiveMergePolicy::REBUILD_COLUMN_GROUP == merge_reason
|
||||
|| ObAdaptiveMergePolicy::CRAZY_MEDIUM_FOR_TEST == merge_reason;
|
||||
}
|
||||
#ifdef ERRSIM
|
||||
int errsim_choose_medium_snapshot(
|
||||
const int64_t max_sync_medium_scn,
|
||||
ObMediumCompactionInfo &medium_info);
|
||||
|
||||
ObMediumCompactionInfo &medium_info,
|
||||
ObGetMergeTablesResult &result);
|
||||
#endif
|
||||
private:
|
||||
ObArenaAllocator allocator_;
|
||||
ObLS &ls_;
|
||||
|
@ -46,6 +46,7 @@ using namespace share::schema;
|
||||
|
||||
namespace compaction
|
||||
{
|
||||
ERRSIM_POINT_DEF(EN_COMPACTION_DISABLE_ROW_COL_SWITCH);
|
||||
|
||||
// keep order with ObMergeType
|
||||
ObPartitionMergePolicy::GetMergeTables ObPartitionMergePolicy::get_merge_tables[MERGE_TYPE_MAX]
|
||||
@ -1850,6 +1851,9 @@ int ObCOMajorMergePolicy::decide_co_major_merge_type(
|
||||
|
||||
if (OB_FAIL(decide_co_major_sstable_status(co_sstable, storage_schema, major_sstable_status))) {
|
||||
LOG_WARN("failed to decide co major sstable status");
|
||||
} else if (OB_UNLIKELY(EN_COMPACTION_DISABLE_ROW_COL_SWITCH)) {
|
||||
major_merge_type = is_major_sstable_match_schema(major_sstable_status) ? BUILD_COLUMN_STORE_MERGE : REBUILD_COLUMN_STORE_MERGE;
|
||||
LOG_INFO("[RowColSwitch] disable row col switch, only allow co major merge", K(tablet_id), K(co_sstable), K(tables), K(major_sstable_status), K(major_merge_type));
|
||||
} else if (OB_FAIL(estimate_row_cnt_for_major_merge(tablet_id.id(), tables, storage_schema, tablet_handle, estimate_row_cnt))) {
|
||||
// if estimate row cnt failed, make major sstable match schema
|
||||
major_merge_type = is_major_sstable_match_schema(major_sstable_status) ? BUILD_COLUMN_STORE_MERGE : REBUILD_COLUMN_STORE_MERGE;
|
||||
|
Reference in New Issue
Block a user