[CP] use optimizer_features_enable system variable and optimizer_features_enable hint to control optimizer behaviors

This commit is contained in:
chimyue
2024-01-17 11:12:35 +00:00
committed by ob-robot
parent 5fccff6b0e
commit fd6b7ed1c5
17 changed files with 153 additions and 108 deletions

View File

@ -137,12 +137,20 @@ struct ObGlobalHint {
void reset();
int assign(const ObGlobalHint &other);
// optimizer version define, move defines below to other file later
#define COMPAT_VERSION_4_0 (oceanbase::common::cal_version(4, 0, 0, 0))
#define COMPAT_VERSION_4_2_1 (oceanbase::common::cal_version(4, 2, 1, 0))
//#define COMPAT_VERSION_4_2_1_BP3 (oceanbase::common::cal_version(4, 2, 1, 3))
#define COMPAT_VERSION_4_2_2 (oceanbase::common::cal_version(4, 2, 2, 0))
#define COMPAT_VERSION_4_3_0 (oceanbase::common::cal_version(4, 3, 0, 0))
#define LASTED_COMPAT_VERSION COMPAT_VERSION_4_3_0
static bool is_valid_opt_features_version(uint64_t version)
{ return COMPAT_VERSION_4_0 <= version && LASTED_COMPAT_VERSION >= version; }
static const common::ObConsistencyLevel UNSET_CONSISTENCY = common::INVALID_CONSISTENCY;
static const int64_t UNSET_QUERY_TIMEOUT = -1;
static const int64_t UNSET_MAX_CONCURRENT = -1;
static const uint64_t UNSET_OPT_FEATURES_VERSION = 0;
static const uint64_t MIN_OUTLINE_ENABLE_VERSION = CLUSTER_VERSION_4_0_0_0;
static const uint64_t CURRENT_OUTLINE_ENABLE_VERSION = CLUSTER_VERSION_4_0_0_0;
static const int64_t DEFAULT_PARALLEL = 1;
static const int64_t UNSET_PARALLEL = 0;
static const int64_t SET_ENABLE_AUTO_DOP = -1;
@ -184,8 +192,6 @@ struct ObGlobalHint {
bool enable_manual_dop() const { return SET_ENABLE_MANUAL_DOP == parallel_; }
bool is_topk_specified() const { return topk_precision_ > 0 || sharding_minimum_row_count_ > 0; }
bool has_valid_opt_features_version() const { return is_valid_opt_features_version(opt_features_version_); }
static bool is_valid_opt_features_version(uint64_t version)
{ return MIN_OUTLINE_ENABLE_VERSION <= version && CLUSTER_CURRENT_VERSION >= version; }
bool disable_query_transform() const { return disable_transform_; }
bool disable_cost_based_transform() const { return disable_cost_based_transform_; }
inline bool has_dbms_stats_hint() const { return has_dbms_stats_hint_; }