1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 11.0-selectivity into 11.0

This commit is contained in:
Sergei Petrunia
2023-02-15 12:03:12 +03:00
739 changed files with 33079 additions and 13101 deletions

View File

@@ -661,7 +661,7 @@ typedef struct system_variables
char* dynamic_variables_ptr;
uint dynamic_variables_head; /* largest valid variable offset */
uint dynamic_variables_size; /* how many bytes are in use */
ulonglong max_heap_table_size;
ulonglong tmp_memory_table_size;
ulonglong tmp_disk_table_size;
@@ -669,7 +669,6 @@ typedef struct system_variables
ulonglong max_statement_time;
ulonglong optimizer_switch;
ulonglong optimizer_trace;
ulong optimizer_trace_max_mem_size;
sql_mode_t sql_mode; ///< which non-standard SQL behaviour should be enabled
sql_mode_t old_behavior; ///< which old SQL behaviour should be enabled
ulonglong option_bits; ///< OPTION_xxx constants, e.g. OPTION_PROFILING
@@ -683,6 +682,7 @@ typedef struct system_variables
ulonglong sortbuff_size;
ulonglong default_regex_flags;
ulonglong max_mem_used;
ulonglong max_rowid_filter_size;
/**
Place holders to store Multi-source variables in sys_var.cc during
@@ -691,10 +691,14 @@ typedef struct system_variables
ulonglong slave_skip_counter;
ulonglong max_relay_log_size;
double optimizer_where_cost, optimizer_scan_setup_cost;
double long_query_time_double, max_statement_time_double;
double sample_percentage;
ha_rows select_limit;
ha_rows max_join_size;
ha_rows expensive_subquery_limit;
ulong auto_increment_increment, auto_increment_offset;
#ifdef WITH_WSREP
/*
Stored values of the auto_increment_increment and auto_increment_offset
@@ -703,11 +707,12 @@ typedef struct system_variables
original values (which are set by the user) by calculated ones (which
are based on the cluster size):
*/
ulonglong wsrep_gtid_seq_no;
ulong saved_auto_increment_increment, saved_auto_increment_offset;
ulong saved_lock_wait_timeout;
ulonglong wsrep_gtid_seq_no;
#endif /* WITH_WSREP */
uint eq_range_index_dive_limit;
ulong auto_increment_increment, auto_increment_offset;
ulong column_compression_zlib_strategy;
ulong lock_wait_timeout;
ulong join_cache_level;
@@ -730,8 +735,8 @@ typedef struct system_variables
ulong optimizer_search_depth;
ulong optimizer_selectivity_sampling_limit;
ulong optimizer_use_condition_selectivity;
ulong optimizer_trace_max_mem_size;
ulong use_stat_tables;
double sample_percentage;
ulong histogram_size;
ulong histogram_type;
ulong preload_buff_size;
@@ -761,8 +766,16 @@ typedef struct system_variables
ulong tx_isolation;
ulong updatable_views_with_limit;
ulong alter_algorithm;
int max_user_connections;
ulong server_id;
ulong session_track_transaction_info;
ulong threadpool_priority;
ulong optimizer_max_sel_arg_weight;
ulong vers_alter_history;
/* deadlock detection */
ulong wt_timeout_short, wt_deadlock_search_depth_short;
ulong wt_timeout_long, wt_deadlock_search_depth_long;
/**
In slave thread we need to know in behalf of which
thread the query is being run to replicate temp tables properly
@@ -772,10 +785,18 @@ typedef struct system_variables
When replicating an event group with GTID, keep these values around so
slave binlog can receive the same GTID as the original.
*/
uint32 gtid_domain_id;
uint64 gtid_seq_no;
uint32 gtid_domain_id;
uint group_concat_max_len;
uint eq_range_index_dive_limit;
uint idle_transaction_timeout;
uint idle_readonly_transaction_timeout;
uint idle_write_transaction_timeout;
uint column_compression_threshold;
uint column_compression_zlib_level;
uint in_subquery_conversion_threshold;
int max_user_connections;
/**
Default transaction access mode. READ ONLY (true) or READ WRITE (false).
@@ -795,7 +816,17 @@ typedef struct system_variables
my_bool binlog_annotate_row_events;
my_bool binlog_direct_non_trans_update;
my_bool column_compression_zlib_wrap;
my_bool sysdate_is_now;
my_bool wsrep_on;
my_bool wsrep_causal_reads;
my_bool wsrep_dirty_reads;
my_bool pseudo_slave_mode;
my_bool session_track_schema;
my_bool session_track_state_change;
#ifdef USER_VAR_TRACKING
my_bool session_track_user_variables;
#endif // USER_VAR_TRACKING
my_bool tcp_nodelay;
plugin_ref table_plugin;
plugin_ref tmp_table_plugin;
plugin_ref enforced_table_plugin;
@@ -821,47 +852,16 @@ typedef struct system_variables
MY_LOCALE *lc_time_names;
Time_zone *time_zone;
char *session_track_system_variables;
my_bool sysdate_is_now;
/* deadlock detection */
ulong wt_timeout_short, wt_deadlock_search_depth_short;
ulong wt_timeout_long, wt_deadlock_search_depth_long;
my_bool wsrep_on;
my_bool wsrep_causal_reads;
uint wsrep_sync_wait;
ulong wsrep_retry_autocommit;
/* Some wsrep variables */
ulonglong wsrep_trx_fragment_size;
ulong wsrep_retry_autocommit;
ulong wsrep_trx_fragment_unit;
ulong wsrep_OSU_method;
my_bool wsrep_dirty_reads;
double long_query_time_double, max_statement_time_double;
my_bool pseudo_slave_mode;
char *session_track_system_variables;
ulong session_track_transaction_info;
my_bool session_track_schema;
my_bool session_track_state_change;
#ifdef USER_VAR_TRACKING
my_bool session_track_user_variables;
#endif // USER_VAR_TRACKING
my_bool tcp_nodelay;
ulong threadpool_priority;
uint idle_transaction_timeout;
uint idle_readonly_transaction_timeout;
uint idle_write_transaction_timeout;
uint column_compression_threshold;
uint column_compression_zlib_level;
uint in_subquery_conversion_threshold;
ulong optimizer_max_sel_arg_weight;
ulonglong max_rowid_filter_size;
uint wsrep_sync_wait;
vers_asof_timestamp_t vers_asof_timestamp;
ulong vers_alter_history;
my_bool binlog_alter_two_phase;
} SV;
@@ -952,19 +952,21 @@ typedef struct system_status_var
functions are used */
ulong feature_dynamic_columns; /* +1 when creating a dynamic column */
ulong feature_fulltext; /* +1 when MATCH is used */
ulong feature_gis; /* +1 opening a table with GIS features */
ulong feature_invisible_columns; /* +1 opening a table with invisible column */
ulong feature_json; /* +1 when JSON function appears in the statement */
ulong feature_gis; /* +1 opening table with GIS features */
ulong feature_invisible_columns; /* +1 opening table with invisible column */
ulong feature_json; /* +1 when JSON function is used */
ulong feature_locale; /* +1 when LOCALE is set */
ulong feature_subquery; /* +1 when subqueries are used */
ulong feature_system_versioning; /* +1 opening a table WITH SYSTEM VERSIONING */
ulong feature_system_versioning; /* +1 opening table WITH SYSTEM VERSIONING */
ulong feature_application_time_periods;
/* +1 opening a table with application-time period */
ulong feature_insert_returning; /* +1 when INSERT...RETURNING is used */
ulong feature_insert_returning; /* +1 when INSERT...RETURNING is used */
ulong feature_timezone; /* +1 when XPATH is used */
ulong feature_trigger; /* +1 opening a table with triggers */
ulong feature_xml; /* +1 when XPATH is used */
ulong feature_window_functions; /* +1 when window functions are used */
ulong feature_into_outfile; /* +1 when INTO OUTFILE is used */
ulong feature_into_variable; /* +1 when INTO VARIABLE is used */
/* From MASTER_GTID_WAIT usage */
ulong master_gtid_wait_timeouts; /* Number of timeouts */
@@ -2669,6 +2671,7 @@ public:
struct system_status_var org_status_var; // For user statistics
struct system_status_var *initial_status_var; /* used by show status */
THR_LOCK_INFO lock_info; // Locking info of this thread
/**
Protects THD data accessed from other threads:
- thd->query and thd->query_length (used by SHOW ENGINE
@@ -3399,7 +3402,7 @@ public:
Check if the number of rows accessed by a statement exceeded
LIMIT ROWS EXAMINED. If so, signal the query engine to stop execution.
*/
void check_limit_rows_examined()
inline void check_limit_rows_examined()
{
if (++accessed_rows_and_keys > lex->limit_rows_examined_cnt)
set_killed(ABORT_QUERY);
@@ -6244,6 +6247,7 @@ public:
Item **items_to_copy; /* Fields in tmp table */
TMP_ENGINE_COLUMNDEF *recinfo, *start_recinfo;
KEY *keyinfo;
ulong *rec_per_key;
ha_rows end_write_records;
/**
Number of normal fields in the query, including those referred to
@@ -6812,13 +6816,13 @@ public:
/*
Cost to materialize - execute the sub-join and write rows into temp.table
*/
Cost_estimate materialization_cost;
double materialization_cost;
/* Cost to make one lookup in the temptable */
Cost_estimate lookup_cost;
double lookup_cost;
/* Cost of scanning the materialized table */
Cost_estimate scan_cost;
double scan_cost;
/* --- Execution structures ---------- */
@@ -7407,11 +7411,38 @@ inline void handler::increment_statistics(ulong SSV::*offset) const
table->in_use->check_limit_rows_examined();
}
inline void handler::fast_increment_statistics(ulong SSV::*offset) const
{
status_var_increment(table->in_use->status_var.*offset);
}
inline void handler::decrement_statistics(ulong SSV::*offset) const
{
status_var_decrement(table->in_use->status_var.*offset);
}
/* Update references in the handler to the table */
inline void handler::set_table(TABLE* table_arg)
{
table= table_arg;
costs= &table_arg->s->optimizer_costs;
}
inline bool handler::pk_is_clustering_key(uint index) const
{
/*
We have to check for MAX_INDEX as table->s->primary_key can be
MAX_KEY in the case where there is no primary key.
*/
return index != MAX_KEY && is_clustering_key(index);
}
inline bool handler::is_clustering_key(uint index) const
{
DBUG_ASSERT(index != MAX_KEY);
return table->is_clustering_key(index);
}
inline int handler::ha_ft_read(uchar *buf)
{