diff --git a/src/share/parameter/ob_parameter_seed.ipp b/src/share/parameter/ob_parameter_seed.ipp index da293a10f4..08e1f517b3 100644 --- a/src/share/parameter/ob_parameter_seed.ipp +++ b/src/share/parameter/ob_parameter_seed.ipp @@ -1890,4 +1890,7 @@ DEF_STR_WITH_CHECKER(choose_migration_source_policy, OB_TENANT_PARAMETER, "idc", 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 + ObParameterAttr(Section::TENANT, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE)); +DEF_BOOL(_global_enable_rich_vector_format, OB_CLUSTER_PARAMETER, "True", + "Control whether use rich vector format in vectorization engine", + ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE)); diff --git a/src/sql/plan_cache/ob_plan_cache.cpp b/src/sql/plan_cache/ob_plan_cache.cpp index 07ff4dcb50..ed7ea1518f 100644 --- a/src/sql/plan_cache/ob_plan_cache.cpp +++ b/src/sql/plan_cache/ob_plan_cache.cpp @@ -2323,6 +2323,7 @@ OB_INLINE int ObPlanCache::construct_plan_cache_key(ObSQLSessionInfo &session, // added plan's key will be `true + other_info`, same as key constructed for getting plan. // if `use_rich_format()` is used as part of key, added plan's key will be `false + other_info`. pc_key.use_rich_vector_format_ = session.initial_use_rich_format(); + pc_key.config_use_rich_format_ = session.config_use_rich_format(); pc_key.is_weak_read_ = is_weak; return ret; } diff --git a/src/sql/plan_cache/ob_plan_cache_struct.h b/src/sql/plan_cache/ob_plan_cache_struct.h index 880a1d0973..fa82687f1e 100644 --- a/src/sql/plan_cache/ob_plan_cache_struct.h +++ b/src/sql/plan_cache/ob_plan_cache_struct.h @@ -166,7 +166,8 @@ struct ObPlanCacheKey : public ObILibCacheKey { uint16_t is_weak_read_ : 1; uint16_t use_rich_vector_format_ : 1; - uint16_t reserved_ : 14; // reserved + uint16_t config_use_rich_format_ : 1; + uint16_t reserved_ : 13; // reserved }; }; }; diff --git a/src/sql/resolver/ob_resolver.cpp b/src/sql/resolver/ob_resolver.cpp index c443de8306..2d68916348 100644 --- a/src/sql/resolver/ob_resolver.cpp +++ b/src/sql/resolver/ob_resolver.cpp @@ -1250,17 +1250,21 @@ int ObResolver::resolve(IsPrepared if_prepared, const ParseNode &parse_tree, ObS } if (OB_SUCC(ret)) { - bool has_rich_format_hint = false; - bool enable_rich_format = false; - ObOptParamHint &opt_hint = params_.query_ctx_->query_hint_.global_hint_.opt_params_; - if (OB_FAIL(opt_hint.check_and_get_bool_opt_param(ObOptParamHint::ENABLE_RICH_VECTOR_FORMAT, - has_rich_format_hint, - enable_rich_format))) { - LOG_WARN("check and get bool opt param failed", K(ret)); - } else if (has_rich_format_hint) { - params_.session_info_->set_force_rich_format( - enable_rich_format ? ObBasicSessionInfo::ForceRichFormatStatus::FORCE_ON : - ObBasicSessionInfo::ForceRichFormatStatus::FORCE_OFF); + if (params_.session_info_->is_force_off_rich_format()) { + // do nothing + } else { + bool has_rich_format_hint = false; + bool enable_rich_format = false; + ObOptParamHint &opt_hint = params_.query_ctx_->query_hint_.global_hint_.opt_params_; + if (OB_FAIL(opt_hint.check_and_get_bool_opt_param(ObOptParamHint::ENABLE_RICH_VECTOR_FORMAT, + has_rich_format_hint, + enable_rich_format))) { + LOG_WARN("check and get bool opt param failed", K(ret)); + } else if (has_rich_format_hint) { + params_.session_info_->set_force_rich_format( + enable_rich_format ? ObBasicSessionInfo::ForceRichFormatStatus::FORCE_ON : + ObBasicSessionInfo::ForceRichFormatStatus::FORCE_OFF); + } } } } diff --git a/src/sql/session/ob_basic_session_info.cpp b/src/sql/session/ob_basic_session_info.cpp index 7105379e17..0682371803 100644 --- a/src/sql/session/ob_basic_session_info.cpp +++ b/src/sql/session/ob_basic_session_info.cpp @@ -157,7 +157,8 @@ ObBasicSessionInfo::ObBasicSessionInfo(const uint64_t tenant_id) is_client_sessid_support_(false), use_rich_vector_format_(false), last_refresh_schema_version_(OB_INVALID_VERSION), - force_rich_vector_format_(ForceRichFormatStatus::Disable) + force_rich_vector_format_(ForceRichFormatStatus::Disable), + config_use_rich_format_(true) { thread_data_.reset(); MEMSET(sys_vars_, 0, sizeof(sys_vars_)); @@ -461,6 +462,7 @@ void ObBasicSessionInfo::reset(bool skip_sys_var) client_identifier_.reset(); last_refresh_schema_version_ = OB_INVALID_VERSION; proxy_user_id_ = OB_INVALID_ID; + config_use_rich_format_ = true; } int ObBasicSessionInfo::reset_timezone() diff --git a/src/sql/session/ob_basic_session_info.h b/src/sql/session/ob_basic_session_info.h index cfcc980f6a..a335415d6b 100644 --- a/src/sql/session/ob_basic_session_info.h +++ b/src/sql/session/ob_basic_session_info.h @@ -484,9 +484,18 @@ public: const bool need_check_valid /* true */); void init_use_rich_format() { - use_rich_vector_format_ = GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_3_0_0 - && sys_vars_cache_.get_enable_rich_vector_format(); - force_rich_vector_format_ = ForceRichFormatStatus::Disable; + config_use_rich_format_ = GCONF._global_enable_rich_vector_format; + if (!config_use_rich_format_) { + use_rich_vector_format_ = false; + force_rich_vector_format_ = ForceRichFormatStatus::FORCE_OFF; + } else { + use_rich_vector_format_ = GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_3_0_0 + && sys_vars_cache_.get_enable_rich_vector_format(); + force_rich_vector_format_ = ForceRichFormatStatus::Disable; + } + } + bool is_force_off_rich_format() { + return force_rich_vector_format_ == ForceRichFormatStatus::FORCE_OFF; } bool use_rich_format() const { if (force_rich_vector_format_ != ForceRichFormatStatus::Disable) { @@ -496,6 +505,8 @@ public: } } + bool config_use_rich_format() { return config_use_rich_format_; } + bool initial_use_rich_format() const { return use_rich_vector_format_; } @@ -2342,6 +2353,8 @@ private: // force_rich_vector_format_ == FORCE_OFF => use_rich_format() returns false // otherwise use_rich_format() returns use_rich_vector_format_ ForceRichFormatStatus force_rich_vector_format_; + // just used to plan cache key + bool config_use_rich_format_; }; 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 25d4b45b9b..0163a06b87 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 @@ -325,6 +325,7 @@ _force_hash_groupby_dump _force_hash_join_spill _force_malloc_for_absent_tenant _force_skip_encoding_partition_id +_global_enable_rich_vector_format _hash_area_size _hash_join_enabled _ha_rpc_timeout