diff --git a/src/share/config/ob_config_helper.cpp b/src/share/config/ob_config_helper.cpp index 79addc2723..e1582c832f 100644 --- a/src/share/config/ob_config_helper.cpp +++ b/src/share/config/ob_config_helper.cpp @@ -1149,5 +1149,12 @@ bool ObConfigTableStoreFormatChecker::check(const ObConfigItem &t) const { 0 == tmp_str.case_compare("COMPOUND"); } +bool ObConfigMigrationChooseSourceChecker::check(const ObConfigItem &t) const +{ + ObString v_str(t.str()); + return 0 == v_str.case_compare("idc") + || 0 == v_str.case_compare("region"); +} + } // end of namepace common } // end of namespace oceanbase diff --git a/src/share/config/ob_config_helper.h b/src/share/config/ob_config_helper.h index 2638e3847a..4ae974210b 100644 --- a/src/share/config/ob_config_helper.h +++ b/src/share/config/ob_config_helper.h @@ -731,6 +731,17 @@ private: DISALLOW_COPY_AND_ASSIGN(ObConfigTableStoreFormatChecker); }; +class ObConfigMigrationChooseSourceChecker + : public ObConfigChecker +{ +public: + ObConfigMigrationChooseSourceChecker() {} + virtual ~ObConfigMigrationChooseSourceChecker() {} + bool check(const ObConfigItem &t) const; +private: + DISALLOW_COPY_AND_ASSIGN(ObConfigMigrationChooseSourceChecker); +}; + typedef __ObConfigContainer ObConfigContainer; } // namespace common diff --git a/src/share/parameter/ob_parameter_seed.ipp b/src/share/parameter/ob_parameter_seed.ipp index e28b96663f..e16cefc59c 100644 --- a/src/share/parameter/ob_parameter_seed.ipp +++ b/src/share/parameter/ob_parameter_seed.ipp @@ -1871,3 +1871,12 @@ DEF_TIME(_faststack_min_interval, OB_CLUSTER_PARAMETER, "30m", "[1s,)", "Minimum interval for OBServer to automatically collect the obstack. " "Default: 30min. Range: [1s,+∞)", ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE)); +DEF_STR_WITH_CHECKER(choose_migration_source_policy, OB_TENANT_PARAMETER, "idc", + common::ObConfigMigrationChooseSourceChecker, + "the policy of choose source in migration and add replica. 'idc' means firstly choose follower replica of the same idc as source, " + "'region' means firstly choose follower replica of the same region as source", + ObParameterAttr(Section::TENANT, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE)); +DEF_BOOL(_enable_choose_migration_source_policy, OB_TENANT_PARAMETER, "True", + "Control whether to use chose_migration_source_policy. " + "If the value of configure is false, it will not use chose_migration_source_policy and choose replica with the largest checkpoint scn as the source.", + ObParameterAttr(Section::TENANT, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE)); \ No newline at end of file diff --git a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/all_virtual_sys_parameter_stat.result b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/all_virtual_sys_parameter_stat.result index 0f11eff344..45a2b03230 100644 --- a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/all_virtual_sys_parameter_stat.result +++ b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/all_virtual_sys_parameter_stat.result @@ -38,6 +38,7 @@ bf_cache_miss_count_threshold bf_cache_priority builtin_db_data_verify_cycle cache_wash_threshold +choose_migration_source_policy clog_sync_time_warn_threshold cluster cluster_id @@ -277,6 +278,7 @@ _enable_adaptive_merge_schedule _enable_backtrace_function _enable_balance_kill_transaction _enable_block_file_punch_hole +_enable_choose_migration_source_policy _enable_column_store _enable_compaction_diagnose _enable_convert_real_to_decimal