diff --git a/src/storage/compaction/ob_medium_compaction_func.cpp b/src/storage/compaction/ob_medium_compaction_func.cpp index 1d41eb809..3328cd0ff 100644 --- a/src/storage/compaction/ob_medium_compaction_func.cpp +++ b/src/storage/compaction/ob_medium_compaction_func.cpp @@ -143,6 +143,7 @@ int ObMediumCompactionScheduleFunc::find_valid_freeze_info( ret = OB_ERR_UNEXPECTED; LOG_WARN("schema version is invalid", K(ret), K(freeze_info)); } else if (OB_UNLIKELY(freeze_info.schema_version_ < last_sstable_schema_version)) { + medium_info.is_skip_tenant_major_ = true; force_schedule_medium_merge = true; FLOG_INFO("schema version in freeze info is too small, try to schedule medium compaction instead", K(ret), K(tablet_id), K(last_sstable_schema_version), K(freeze_info)); @@ -157,16 +158,15 @@ int ObMediumCompactionScheduleFunc::find_valid_freeze_info( K(scheduler_frozen_version)); schedule_snapshot = freeze_info.frozen_scn_.get_val_for_tx(); schedule_with_newer_info = true; + medium_info.is_skip_tenant_major_ = true; ret = OB_SUCCESS; + FLOG_INFO("schedule with newer freeze info", K(ret), K(freeze_info)); + continue; } } else { LOG_WARN("failed to get table schema", K(ret), K(medium_info)); } - } - if (OB_SUCC(ret)) { // success to get table schema - if (schedule_with_newer_info) { - FLOG_INFO("schedule with newer freeze info", K(ret), K(freeze_info)); - } + } else { break; } } // end of while @@ -1018,7 +1018,7 @@ int ObMediumCompactionScheduleFunc::get_table_schema_to_merge( if (tablet_id.id() > ObTabletID::MIN_USER_TABLET_ID && tablet_id != tablet.get_tablet_meta().data_tablet_id_ && ATOMIC_BCAS(&have_set_errno, false, true)) { - LOG_INFO("ERRSIM EN_SCHEDULE_MAJOR_GET_TABLE_SCHEMA", K(ret), K(table_id), K(tablet_id)); + LOG_INFO("ERRSIM EN_SCHEDULE_MAJOR_GET_TABLE_SCHEMA", K(ret), K(table_id), K(tablet_id), K(storage_schema)); errno_tablet_id = tablet_id; return ret; } else { diff --git a/src/storage/compaction/ob_medium_compaction_info.cpp b/src/storage/compaction/ob_medium_compaction_info.cpp index d062f013f..ad6ca6913 100644 --- a/src/storage/compaction/ob_medium_compaction_info.cpp +++ b/src/storage/compaction/ob_medium_compaction_info.cpp @@ -363,6 +363,7 @@ ObMediumCompactionInfo::ObMediumCompactionInfo() is_schema_changed_(false), tenant_id_(0), co_major_merge_type_(ObCOMajorMergePolicy::INVALID_CO_MAJOR_MERGE_TYPE), + is_skip_tenant_major_(false), reserved_(0), cluster_id_(0), data_version_(0), @@ -594,7 +595,7 @@ int64_t ObMediumCompactionInfo::to_string(char* buf, const int64_t buf_len) cons K_(medium_snapshot), K_(last_medium_snapshot), K_(tenant_id), K_(cluster_id), K_(medium_compat_version), K_(data_version), K_(is_schema_changed), K_(storage_schema), "co_major_merge_type", ObCOMajorMergePolicy::co_major_merge_type_to_str(static_cast(co_major_merge_type_)), - K_(contain_parallel_range), K_(parallel_merge_info)); + K_(is_skip_tenant_major), K_(contain_parallel_range), K_(parallel_merge_info)); J_OBJ_END(); } return pos; diff --git a/src/storage/compaction/ob_medium_compaction_info.h b/src/storage/compaction/ob_medium_compaction_info.h index 2c74a1463..b27686908 100644 --- a/src/storage/compaction/ob_medium_compaction_info.h +++ b/src/storage/compaction/ob_medium_compaction_info.h @@ -226,7 +226,7 @@ public: static const int64_t MEDIUM_COMPAT_VERSION_LATEST = MEDIUM_COMPAT_VERSION_V4; private: static const int32_t SCS_ONE_BIT = 1; - static const int32_t SCS_RESERVED_BITS = 28; + static const int32_t SCS_RESERVED_BITS = 27; public: union { @@ -239,6 +239,7 @@ public: uint64_t is_schema_changed_ : SCS_ONE_BIT; uint64_t tenant_id_ : 16; // record tenant_id of ls primary_leader, just for throw medium uint64_t co_major_merge_type_ : 4; + uint64_t is_skip_tenant_major_ : SCS_ONE_BIT; uint64_t reserved_ : SCS_RESERVED_BITS; }; }; diff --git a/src/storage/compaction/ob_medium_list_checker.cpp b/src/storage/compaction/ob_medium_list_checker.cpp index 2680c8d23..f40ae18b3 100644 --- a/src/storage/compaction/ob_medium_list_checker.cpp +++ b/src/storage/compaction/ob_medium_list_checker.cpp @@ -146,9 +146,14 @@ int ObMediumListChecker::check_next_schedule_medium( ret = OB_SUCCESS; } } else if (OB_UNLIKELY(freeze_info.frozen_scn_.get_val_for_tx() < next_medium_info->medium_snapshot_)) { - ret = OB_ERR_UNEXPECTED; - LOG_ERROR("next major medium info may lost", - KR(ret), "freeze_version", freeze_info.frozen_scn_.get_val_for_tx(), KPC(next_medium_info), K(last_major_snapshot)); + if (next_medium_info->is_skip_tenant_major_) { + // ATTENTION! Critical diagnostic log, DO NOT CHANGE!!! + FLOG_INFO("medium info have marked skip tenant major, may have schema issue when schedule tenant major", KR(ret), KPC(next_medium_info), K(freeze_info)); + } else { + ret = OB_ERR_UNEXPECTED; + LOG_ERROR("next major medium info may lost", + KR(ret), "freeze_version", freeze_info.frozen_scn_.get_val_for_tx(), KPC(next_medium_info), K(last_major_snapshot)); + } } } else { // medium info from same cluster_id, can't make sure all medium info exists, so not check medium & last_major_snapshot