[CP] use is_schema_changed on medium info
This commit is contained in:
@ -1004,7 +1004,9 @@ int ObBasicTabletMergeCtx::get_medium_compaction_info()
|
|||||||
static_param_.data_version_ = medium_info.data_version_;
|
static_param_.data_version_ = medium_info.data_version_;
|
||||||
static_param_.is_rebuild_column_store_ = (medium_info.medium_merge_reason_ == ObAdaptiveMergePolicy::REBUILD_COLUMN_GROUP);
|
static_param_.is_rebuild_column_store_ = (medium_info.medium_merge_reason_ == ObAdaptiveMergePolicy::REBUILD_COLUMN_GROUP);
|
||||||
static_param_.is_tenant_major_merge_ = medium_info.is_major_compaction();
|
static_param_.is_tenant_major_merge_ = medium_info.is_major_compaction();
|
||||||
static_param_.is_schema_changed_ = medium_info.is_schema_changed_;
|
if (medium_info.medium_compat_version_ >= ObMediumCompactionInfo::MEDIUM_COMPAT_VERSION_V4) {
|
||||||
|
static_param_.is_schema_changed_ = medium_info.is_schema_changed_;
|
||||||
|
}
|
||||||
static_param_.merge_reason_ = (ObAdaptiveMergePolicy::AdaptiveMergeReason)medium_info.medium_merge_reason_;
|
static_param_.merge_reason_ = (ObAdaptiveMergePolicy::AdaptiveMergeReason)medium_info.medium_merge_reason_;
|
||||||
FLOG_INFO("get storage schema to merge", "param", get_dag_param(), KPC_(static_param_.schema), K(medium_info));
|
FLOG_INFO("get storage schema to merge", "param", get_dag_param(), KPC_(static_param_.schema), K(medium_info));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -115,7 +115,7 @@ int ObMediumCompactionScheduleFunc::find_valid_freeze_info(
|
|||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("failed to get schema service from MTL", K(ret));
|
LOG_WARN("failed to get schema service from MTL", K(ret));
|
||||||
} else if (OB_FAIL(tablet.fetch_table_store(table_store_wrapper))) {
|
} else if (OB_FAIL(tablet.fetch_table_store(table_store_wrapper))) {
|
||||||
LOG_WARN("load medium info list fail", K(ret), K(tablet));
|
LOG_WARN("failed to fetch table store", K(ret), K(tablet));
|
||||||
} else {
|
} else {
|
||||||
last_major = static_cast<ObSSTable *>(table_store_wrapper.get_member()->get_major_sstables().get_boundary_table(true/*last*/));
|
last_major = static_cast<ObSSTable *>(table_store_wrapper.get_member()->get_major_sstables().get_boundary_table(true/*last*/));
|
||||||
if (OB_ISNULL(last_major)) {
|
if (OB_ISNULL(last_major)) {
|
||||||
@ -501,7 +501,7 @@ int ObMediumCompactionScheduleFunc::get_max_reserved_snapshot(int64_t &max_reser
|
|||||||
// not sync reserved snapshot yet, should not schedule now
|
// not sync reserved snapshot yet, should not schedule now
|
||||||
} else if (OB_FAIL(MTL(ObTenantFreezeInfoMgr*)->get_min_reserved_snapshot(
|
} else if (OB_FAIL(MTL(ObTenantFreezeInfoMgr*)->get_min_reserved_snapshot(
|
||||||
tablet->get_tablet_meta().tablet_id_, last_major_snapshot_version, snapshot_info))) {
|
tablet->get_tablet_meta().tablet_id_, last_major_snapshot_version, snapshot_info))) {
|
||||||
LOG_WARN("failed to get multi version from freeze info mgr", K(ret), "tablet_id", tablet->get_tablet_meta().tablet_id_);
|
LOG_WARN("failed to get reserved snapshot from freeze info mgr", K(ret), "tablet_id", tablet->get_tablet_meta().tablet_id_);
|
||||||
} else {
|
} else {
|
||||||
max_reserved_snapshot = MAX(ls_.get_min_reserved_snapshot(), snapshot_info.snapshot_);
|
max_reserved_snapshot = MAX(ls_.get_min_reserved_snapshot(), snapshot_info.snapshot_);
|
||||||
}
|
}
|
||||||
@ -564,14 +564,14 @@ int ObMediumCompactionScheduleFunc::decide_medium_snapshot(
|
|||||||
LOG_WARN("failed to add dependent tablet", K(ret), KPC(this));
|
LOG_WARN("failed to add dependent tablet", K(ret), KPC(this));
|
||||||
} else {
|
} else {
|
||||||
const ObTabletID &tablet_id = tablet->get_tablet_meta().tablet_id_;
|
const ObTabletID &tablet_id = tablet->get_tablet_meta().tablet_id_;
|
||||||
LOG_TRACE("decide_medium_snapshot", K(ret), KPC(this), K(tablet_id));
|
LOG_TRACE("decide_medium_snapshot", K(ret), KPC(this), K(compat_version), K(tablet_id), K(max_sync_medium_scn), K(merge_reason));
|
||||||
int64_t max_reserved_snapshot = 0;
|
int64_t max_reserved_snapshot = 0;
|
||||||
int64_t schema_version = 0;
|
int64_t schema_version = 0;
|
||||||
ObGetMergeTablesResult result;
|
ObGetMergeTablesResult result;
|
||||||
ObMediumCompactionInfo medium_info;
|
ObMediumCompactionInfo medium_info;
|
||||||
|
|
||||||
if (OB_FAIL(medium_info.init_data_version())) {
|
if (OB_FAIL(medium_info.init_data_version(compat_version))) {
|
||||||
LOG_WARN("fail to set data version", K(ret));
|
LOG_WARN("fail to set data version", K(ret), K(tablet_id), K(compat_version));
|
||||||
} else if (is_user_request(merge_reason)) {
|
} else if (is_user_request(merge_reason)) {
|
||||||
if (OB_FAIL(choose_medium_scn_for_user_request(medium_info, result, schema_version))) {
|
if (OB_FAIL(choose_medium_scn_for_user_request(medium_info, result, schema_version))) {
|
||||||
LOG_WARN("failed to choose medium scn for user request", K(ret), KPC(this));
|
LOG_WARN("failed to choose medium scn for user request", K(ret), KPC(this));
|
||||||
|
|||||||
@ -79,11 +79,10 @@ public:
|
|||||||
const int64_t major_snapshot,
|
const int64_t major_snapshot,
|
||||||
const bool force_schedule);
|
const bool force_schedule);
|
||||||
|
|
||||||
int decide_medium_snapshot(
|
|
||||||
const ObAdaptiveMergePolicy::AdaptiveMergeReason merge_reason);
|
|
||||||
|
|
||||||
int64_t to_string(char* buf, const int64_t buf_len) const;
|
int64_t to_string(char* buf, const int64_t buf_len) const;
|
||||||
protected:
|
protected:
|
||||||
|
int decide_medium_snapshot(
|
||||||
|
const ObAdaptiveMergePolicy::AdaptiveMergeReason merge_reason);
|
||||||
static int get_status_from_inner_table(
|
static int get_status_from_inner_table(
|
||||||
const ObLSID &ls_id,
|
const ObLSID &ls_id,
|
||||||
const ObTabletID &tablet_id,
|
const ObTabletID &tablet_id,
|
||||||
|
|||||||
@ -351,16 +351,16 @@ const char *ObMediumCompactionInfo::ObCompactionTypeStr[] = {
|
|||||||
const char *ObMediumCompactionInfo::get_compaction_type_str(enum ObCompactionType type)
|
const char *ObMediumCompactionInfo::get_compaction_type_str(enum ObCompactionType type)
|
||||||
{
|
{
|
||||||
const char *str = "";
|
const char *str = "";
|
||||||
if (type >= COMPACTION_TYPE_MAX || type < MEDIUM_COMPACTION) {
|
if (is_valid_compaction_type(type)) {
|
||||||
str = "invalid_type";
|
|
||||||
} else {
|
|
||||||
str = ObCompactionTypeStr[type];
|
str = ObCompactionTypeStr[type];
|
||||||
|
} else {
|
||||||
|
str = "invalid_type";
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObMediumCompactionInfo::ObMediumCompactionInfo()
|
ObMediumCompactionInfo::ObMediumCompactionInfo()
|
||||||
: medium_compat_version_(MEDIUM_COMPAT_VERSION_V3),
|
: medium_compat_version_(MEDIUM_COMPAT_VERSION_V4),
|
||||||
compaction_type_(COMPACTION_TYPE_MAX),
|
compaction_type_(COMPACTION_TYPE_MAX),
|
||||||
contain_parallel_range_(false),
|
contain_parallel_range_(false),
|
||||||
medium_merge_reason_(ObAdaptiveMergePolicy::NONE),
|
medium_merge_reason_(ObAdaptiveMergePolicy::NONE),
|
||||||
@ -410,12 +410,12 @@ int ObMediumCompactionInfo::init(
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObMediumCompactionInfo::init_data_version()
|
int ObMediumCompactionInfo::init_data_version(const uint64_t compat_version)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
uint64_t compat_version = 0;
|
if (OB_UNLIKELY(compat_version <= 0)) {
|
||||||
if (OB_FAIL(GET_MIN_DATA_VERSION(MTL_ID(), compat_version))) {
|
ret = OB_INVALID_ARGUMENT;
|
||||||
LOG_WARN("fail to get data version", K(ret));
|
LOG_WARN("invalid input compat version", K(ret), K(compat_version));
|
||||||
} else if (OB_UNLIKELY(compat_version < DATA_VERSION_4_1_0_0)) {
|
} else if (OB_UNLIKELY(compat_version < DATA_VERSION_4_1_0_0)) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("invalid data version to schedule medium compaction", K(ret), K(compat_version));
|
LOG_WARN("invalid data version to schedule medium compaction", K(ret), K(compat_version));
|
||||||
@ -425,8 +425,10 @@ int ObMediumCompactionInfo::init_data_version()
|
|||||||
medium_compat_version_ = ObMediumCompactionInfo::MEDIUM_COMPAT_VERSION;
|
medium_compat_version_ = ObMediumCompactionInfo::MEDIUM_COMPAT_VERSION;
|
||||||
} else if (compat_version < DATA_VERSION_4_2_1_0) {
|
} else if (compat_version < DATA_VERSION_4_2_1_0) {
|
||||||
medium_compat_version_ = ObMediumCompactionInfo::MEDIUM_COMPAT_VERSION_V2;
|
medium_compat_version_ = ObMediumCompactionInfo::MEDIUM_COMPAT_VERSION_V2;
|
||||||
} else {
|
} else if (compat_version < DATA_VERSION_4_2_1_2) {
|
||||||
medium_compat_version_ = ObMediumCompactionInfo::MEDIUM_COMPAT_VERSION_V3;
|
medium_compat_version_ = ObMediumCompactionInfo::MEDIUM_COMPAT_VERSION_V3;
|
||||||
|
} else {
|
||||||
|
medium_compat_version_ = ObMediumCompactionInfo::MEDIUM_COMPAT_VERSION_V4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@ -180,7 +180,7 @@ public:
|
|||||||
|
|
||||||
int assign(ObIAllocator &allocator, const ObMediumCompactionInfo &medium_info);
|
int assign(ObIAllocator &allocator, const ObMediumCompactionInfo &medium_info);
|
||||||
int init(ObIAllocator &allocator, const ObMediumCompactionInfo &medium_info);
|
int init(ObIAllocator &allocator, const ObMediumCompactionInfo &medium_info);
|
||||||
int init_data_version();
|
int init_data_version(const uint64_t compat_version);
|
||||||
void set_basic_info(
|
void set_basic_info(
|
||||||
const ObCompactionType type,
|
const ObCompactionType type,
|
||||||
const ObAdaptiveMergePolicy::AdaptiveMergeReason merge_reason,
|
const ObAdaptiveMergePolicy::AdaptiveMergeReason merge_reason,
|
||||||
@ -222,6 +222,7 @@ public:
|
|||||||
static const int64_t MEDIUM_COMPAT_VERSION = 1;
|
static const int64_t MEDIUM_COMPAT_VERSION = 1;
|
||||||
static const int64_t MEDIUM_COMPAT_VERSION_V2 = 2; // for add last_medium_snapshot_
|
static const int64_t MEDIUM_COMPAT_VERSION_V2 = 2; // for add last_medium_snapshot_
|
||||||
static const int64_t MEDIUM_COMPAT_VERSION_V3 = 3; // for stanby tenant, not throw medium info
|
static const int64_t MEDIUM_COMPAT_VERSION_V3 = 3; // for stanby tenant, not throw medium info
|
||||||
|
static const int64_t MEDIUM_COMPAT_VERSION_V4 = 4; // after this version, use is_schema_changed on medium info
|
||||||
private:
|
private:
|
||||||
static const int32_t SCS_ONE_BIT = 1;
|
static const int32_t SCS_ONE_BIT = 1;
|
||||||
static const int32_t SCS_RESERVED_BITS = 32;
|
static const int32_t SCS_RESERVED_BITS = 32;
|
||||||
|
|||||||
@ -367,7 +367,6 @@ ObStorageSchema::ObStorageSchema()
|
|||||||
table_type_(ObTableType::MAX_TABLE_TYPE),
|
table_type_(ObTableType::MAX_TABLE_TYPE),
|
||||||
table_mode_(),
|
table_mode_(),
|
||||||
index_type_(ObIndexType::INDEX_TYPE_IS_NOT),
|
index_type_(ObIndexType::INDEX_TYPE_IS_NOT),
|
||||||
index_status_(ObIndexStatus::INDEX_STATUS_UNAVAILABLE),
|
|
||||||
row_store_type_(ObStoreFormat::get_default_row_store_type()),
|
row_store_type_(ObStoreFormat::get_default_row_store_type()),
|
||||||
schema_version_(OB_INVALID_VERSION),
|
schema_version_(OB_INVALID_VERSION),
|
||||||
column_cnt_(0),
|
column_cnt_(0),
|
||||||
@ -1533,7 +1532,6 @@ void ObStorageSchema::copy_from(const share::schema::ObMergeSchema &input_schema
|
|||||||
table_type_ = input_schema.get_table_type();
|
table_type_ = input_schema.get_table_type();
|
||||||
table_mode_ = input_schema.get_table_mode_struct();
|
table_mode_ = input_schema.get_table_mode_struct();
|
||||||
index_type_ = input_schema.get_index_type();
|
index_type_ = input_schema.get_index_type();
|
||||||
index_status_ = input_schema.get_index_status();
|
|
||||||
row_store_type_ = input_schema.get_row_store_type();
|
row_store_type_ = input_schema.get_row_store_type();
|
||||||
schema_version_ = input_schema.get_schema_version();
|
schema_version_ = input_schema.get_schema_version();
|
||||||
column_cnt_ = input_schema.get_column_count();
|
column_cnt_ = input_schema.get_column_count();
|
||||||
|
|||||||
@ -233,7 +233,6 @@ public:
|
|||||||
virtual inline share::schema::ObTableMode get_table_mode_struct() const override { return table_mode_; }
|
virtual inline share::schema::ObTableMode get_table_mode_struct() const override { return table_mode_; }
|
||||||
virtual inline share::schema::ObTableType get_table_type() const override { return table_type_; }
|
virtual inline share::schema::ObTableType get_table_type() const override { return table_type_; }
|
||||||
virtual inline share::schema::ObIndexType get_index_type() const override { return index_type_; }
|
virtual inline share::schema::ObIndexType get_index_type() const override { return index_type_; }
|
||||||
virtual inline share::schema::ObIndexStatus get_index_status() const override { return index_status_; }
|
|
||||||
const common::ObIArray<ObStorageColumnSchema> &get_store_column_schemas() const { return column_array_; }
|
const common::ObIArray<ObStorageColumnSchema> &get_store_column_schemas() const { return column_array_; }
|
||||||
const common::ObIArray<ObStorageColumnGroupSchema> &get_column_groups() const { return column_group_array_; }
|
const common::ObIArray<ObStorageColumnGroupSchema> &get_column_groups() const { return column_group_array_; }
|
||||||
virtual inline common::ObRowStoreType get_row_store_type() const override { return row_store_type_; }
|
virtual inline common::ObRowStoreType get_row_store_type() const override { return row_store_type_; }
|
||||||
@ -262,7 +261,7 @@ public:
|
|||||||
|
|
||||||
VIRTUAL_TO_STRING_KV(KP(this), K_(storage_schema_version), K_(version),
|
VIRTUAL_TO_STRING_KV(KP(this), K_(storage_schema_version), K_(version),
|
||||||
K_(is_use_bloomfilter), K_(column_info_simplified), K_(compat_mode), K_(table_type), K_(index_type),
|
K_(is_use_bloomfilter), K_(column_info_simplified), K_(compat_mode), K_(table_type), K_(index_type),
|
||||||
K_(index_status), K_(row_store_type), K_(schema_version),
|
K_(row_store_type), K_(schema_version),
|
||||||
K_(column_cnt), K_(store_column_cnt), K_(tablet_size), K_(pctfree), K_(block_size), K_(progressive_merge_round),
|
K_(column_cnt), K_(store_column_cnt), K_(tablet_size), K_(pctfree), K_(block_size), K_(progressive_merge_round),
|
||||||
K_(master_key_id), K_(compressor_type), K_(encryption), K_(encrypt_key),
|
K_(master_key_id), K_(compressor_type), K_(encryption), K_(encrypt_key),
|
||||||
"rowkey_cnt", rowkey_array_.count(), K_(rowkey_array), "column_cnt", column_array_.count(), K_(column_array),
|
"rowkey_cnt", rowkey_array_.count(), K_(rowkey_array), "column_cnt", column_array_.count(), K_(column_array),
|
||||||
@ -333,8 +332,6 @@ public:
|
|||||||
share::schema::ObTableType table_type_;
|
share::schema::ObTableType table_type_;
|
||||||
share::schema::ObTableMode table_mode_;
|
share::schema::ObTableMode table_mode_;
|
||||||
share::schema::ObIndexType index_type_;
|
share::schema::ObIndexType index_type_;
|
||||||
share::schema::ObIndexStatus index_status_;
|
|
||||||
|
|
||||||
ObRowStoreType row_store_type_;
|
ObRowStoreType row_store_type_;
|
||||||
int64_t schema_version_;
|
int64_t schema_version_;
|
||||||
int64_t column_cnt_; // include virtual generated column
|
int64_t column_cnt_; // include virtual generated column
|
||||||
|
|||||||
@ -1410,7 +1410,6 @@ int ObMigrationTabletParam::construct_placeholder_storage_schema_and_medium(
|
|||||||
storage_schema.table_type_ = ObTableType::USER_TABLE;
|
storage_schema.table_type_ = ObTableType::USER_TABLE;
|
||||||
//storage_schema.table_mode_
|
//storage_schema.table_mode_
|
||||||
storage_schema.index_type_ = ObIndexType::INDEX_TYPE_PRIMARY;
|
storage_schema.index_type_ = ObIndexType::INDEX_TYPE_PRIMARY;
|
||||||
storage_schema.index_status_ = ObIndexStatus::INDEX_STATUS_AVAILABLE;
|
|
||||||
storage_schema.row_store_type_ = ObRowStoreType::FLAT_ROW_STORE;
|
storage_schema.row_store_type_ = ObRowStoreType::FLAT_ROW_STORE;
|
||||||
storage_schema.schema_version_ = ObStorageSchema::STORAGE_SCHEMA_VERSION_V3;
|
storage_schema.schema_version_ = ObStorageSchema::STORAGE_SCHEMA_VERSION_V3;
|
||||||
storage_schema.column_cnt_ = 1;
|
storage_schema.column_cnt_ = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user