Commit 58532a17 authored by unknown's avatar unknown

remove maria_* variables from the server, declare them in ha_maria.cc

note: this does *not* move pagecache* variables.


sql/mysqld.cc:
  remove maria_* variables from the server, declare them in ha_maria.cc
sql/set_var.cc:
  remove maria_* variables from the server, declare them in ha_maria.cc
sql/sql_class.h:
  remove maria_* variables from the server, declare them in ha_maria.cc
sql/sql_plugin.cc:
  bugfix: support for ENUM/SET thd local plugin variables
storage/maria/ha_maria.cc:
  remove maria_* variables from the server, declare them in ha_maria.cc
parent ee0e324c
...@@ -506,7 +506,6 @@ char *mysqld_unix_port, *opt_mysql_tmpdir; ...@@ -506,7 +506,6 @@ char *mysqld_unix_port, *opt_mysql_tmpdir;
const char **errmesg; /* Error messages */ const char **errmesg; /* Error messages */
const char *myisam_recover_options_str="OFF"; const char *myisam_recover_options_str="OFF";
const char *myisam_stats_method_str="nulls_unequal"; const char *myisam_stats_method_str="nulls_unequal";
const char *maria_stats_method_str="nulls_unequal";
/* name of reference on left espression in rewritten IN subquery */ /* name of reference on left espression in rewritten IN subquery */
const char *in_left_expr_name= "<left expr>"; const char *in_left_expr_name= "<left expr>";
...@@ -550,7 +549,7 @@ MY_LOCALE *my_default_lc_time_names; ...@@ -550,7 +549,7 @@ MY_LOCALE *my_default_lc_time_names;
SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen, have_query_cache; SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen, have_query_cache;
SHOW_COMP_OPTION have_geometry, have_rtree_keys; SHOW_COMP_OPTION have_geometry, have_rtree_keys;
SHOW_COMP_OPTION have_crypt, have_compress, have_maria_db; SHOW_COMP_OPTION have_crypt, have_compress;
/* Thread specific variables */ /* Thread specific variables */
...@@ -2208,7 +2207,7 @@ or misconfigured. This error can also be caused by malfunctioning hardware.\n", ...@@ -2208,7 +2207,7 @@ or misconfigured. This error can also be caused by malfunctioning hardware.\n",
We will try our best to scrape up some info that will hopefully help diagnose\n\ We will try our best to scrape up some info that will hopefully help diagnose\n\
the problem, but since we have already crashed, something is definitely wrong\n\ the problem, but since we have already crashed, something is definitely wrong\n\
and this may fail.\n\n"); and this may fail.\n\n");
fprintf(stderr, "key_buffer_size=%lu\n", fprintf(stderr, "key_buffer_size=%lu\n",
(ulong) dflt_key_cache->key_cache_mem_size); (ulong) dflt_key_cache->key_cache_mem_size);
#ifdef WITH_MARIA_STORAGE_ENGINE #ifdef WITH_MARIA_STORAGE_ENGINE
fprintf(stderr, "page_buffer_size=%lu\n", fprintf(stderr, "page_buffer_size=%lu\n",
...@@ -5059,10 +5058,6 @@ enum options_mysqld ...@@ -5059,10 +5058,6 @@ enum options_mysqld
OPT_MYISAM_USE_MMAP, OPT_MYISAM_REPAIR_THREADS, OPT_MYISAM_USE_MMAP, OPT_MYISAM_REPAIR_THREADS,
OPT_MYISAM_STATS_METHOD, OPT_MYISAM_STATS_METHOD,
OPT_MARIA_BLOCK_SIZE,
OPT_MARIA_MAX_SORT_FILE_SIZE, OPT_MARIA_SORT_BUFFER_SIZE,
OPT_MARIA_USE_MMAP, OPT_MARIA_REPAIR_THREADS,
OPT_MARIA_STATS_METHOD,
OPT_PAGECACHE_BUFFER_SIZE, OPT_PAGECACHE_BUFFER_SIZE,
OPT_PAGECACHE_DIVISION_LIMIT, OPT_PAGECACHE_AGE_THRESHOLD, OPT_PAGECACHE_DIVISION_LIMIT, OPT_PAGECACHE_AGE_THRESHOLD,
...@@ -5079,7 +5074,7 @@ enum options_mysqld ...@@ -5079,7 +5074,7 @@ enum options_mysqld
OPT_SORT_BUFFER, OPT_TABLE_OPEN_CACHE, OPT_TABLE_DEF_CACHE, OPT_SORT_BUFFER, OPT_TABLE_OPEN_CACHE, OPT_TABLE_DEF_CACHE,
OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE, OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE,
OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK, OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK,
OPT_WAIT_TIMEOUT, OPT_WAIT_TIMEOUT,
OPT_ERROR_LOG_FILE, OPT_ERROR_LOG_FILE,
OPT_DEFAULT_WEEK_FORMAT, OPT_DEFAULT_WEEK_FORMAT,
OPT_RANGE_ALLOC_BLOCK_SIZE, OPT_ALLOW_SUSPICIOUS_UDFS, OPT_RANGE_ALLOC_BLOCK_SIZE, OPT_ALLOW_SUSPICIOUS_UDFS,
...@@ -6046,40 +6041,6 @@ log and this option does nothing anymore.", ...@@ -6046,40 +6041,6 @@ log and this option does nothing anymore.",
0 0
#endif #endif
, 0, 2, 0, 1, 0}, , 0, 2, 0, 1, 0},
#ifdef WITH_MARIA_STORAGE_ENGINE
{"maria_block_size", OPT_MARIA_BLOCK_SIZE,
"Block size to be used for MARIA index pages.",
(uchar**) &maria_block_size,
(uchar**) &maria_block_size, 0, GET_ULONG, REQUIRED_ARG,
MARIA_KEY_BLOCK_LENGTH, MARIA_MIN_KEY_BLOCK_LENGTH,
MARIA_MAX_KEY_BLOCK_LENGTH,
0, MARIA_MIN_KEY_BLOCK_LENGTH, 0},
{"maria_max_sort_file_size", OPT_MARIA_MAX_SORT_FILE_SIZE,
"Don't use the fast sort index method to created index if the temporary "
"file would get bigger than this.",
(uchar**) &global_system_variables.maria_max_sort_file_size,
(uchar**) &max_system_variables.maria_max_sort_file_size, 0,
GET_ULL, REQUIRED_ARG, (longlong) LONG_MAX, 0, (ulonglong) MAX_FILE_SIZE,
0, 1024*1024, 0},
{"maria_repair_threads", OPT_MARIA_REPAIR_THREADS,
"Number of threads to use when repairing maria tables. The value of 1 "
"disables parallel repair.",
(uchar**) &global_system_variables.maria_repair_threads,
(uchar**) &max_system_variables.maria_repair_threads, 0,
GET_ULONG, REQUIRED_ARG, 1, 1, ~0L, 0, 1, 0},
{"maria_sort_buffer_size", OPT_MARIA_SORT_BUFFER_SIZE,
"The buffer that is allocated when sorting the index when doing a REPAIR "
"or when creating indexes with CREATE INDEX or ALTER TABLE.",
(uchar**) &global_system_variables.maria_sort_buff_size,
(uchar**) &max_system_variables.maria_sort_buff_size, 0,
GET_ULONG, REQUIRED_ARG, 8192*1024, 4, ~0L, 0, 1, 0},
{"maria_stats_method", OPT_MARIA_STATS_METHOD,
"Specifies how maria index statistics collection code should threat NULLs. "
"Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), "
"\"nulls_equal\" (emulate 4.0 behavior), and \"nulls_ignored\".",
(uchar**) &maria_stats_method_str, (uchar**) &maria_stats_method_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
"Max packetlength to send/receive from to server.", "Max packetlength to send/receive from to server.",
(uchar**) &global_system_variables.max_allowed_packet, (uchar**) &global_system_variables.max_allowed_packet,
...@@ -7194,7 +7155,7 @@ static void mysql_init_variables(void) ...@@ -7194,7 +7155,7 @@ static void mysql_init_variables(void)
global_query_id= thread_id= 1L; global_query_id= thread_id= 1L;
strmov(server_version, MYSQL_SERVER_VERSION); strmov(server_version, MYSQL_SERVER_VERSION);
myisam_recover_options_str= sql_mode_str= "OFF"; myisam_recover_options_str= sql_mode_str= "OFF";
myisam_stats_method_str= maria_stats_method_str= "nulls_unequal"; myisam_stats_method_str= "nulls_unequal";
my_bind_addr = htonl(INADDR_ANY); my_bind_addr = htonl(INADDR_ANY);
threads.empty(); threads.empty();
thread_cache.empty(); thread_cache.empty();
...@@ -7229,7 +7190,7 @@ static void mysql_init_variables(void) ...@@ -7229,7 +7190,7 @@ static void mysql_init_variables(void)
master_password= master_host= 0; master_password= master_host= 0;
master_info_file= (char*) "master.info", master_info_file= (char*) "master.info",
relay_log_info_file= (char*) "relay-log.info"; relay_log_info_file= (char*) "relay-log.info";
master_ssl_key= master_ssl_cert= master_ssl_ca= master_ssl_key= master_ssl_cert= master_ssl_ca=
master_ssl_capath= master_ssl_cipher= 0; master_ssl_capath= master_ssl_cipher= 0;
report_user= report_password = report_host= 0; /* TO BE DELETED */ report_user= report_password = report_host= 0; /* TO BE DELETED */
opt_relay_logname= opt_relaylog_index_name= 0; opt_relay_logname= opt_relaylog_index_name= 0;
...@@ -7257,7 +7218,6 @@ static void mysql_init_variables(void) ...@@ -7257,7 +7218,6 @@ static void mysql_init_variables(void)
when collecting index statistics for MyISAM tables. when collecting index statistics for MyISAM tables.
*/ */
global_system_variables.myisam_stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL; global_system_variables.myisam_stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL;
global_system_variables.maria_stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL;
/* Variables that depends on compile options */ /* Variables that depends on compile options */
#ifndef DBUG_OFF #ifndef DBUG_OFF
......
...@@ -116,7 +116,6 @@ static void fix_max_join_size(THD *thd, enum_var_type type); ...@@ -116,7 +116,6 @@ static void fix_max_join_size(THD *thd, enum_var_type type);
static void fix_query_cache_size(THD *thd, enum_var_type type); static void fix_query_cache_size(THD *thd, enum_var_type type);
static void fix_query_cache_min_res_unit(THD *thd, enum_var_type type); static void fix_query_cache_min_res_unit(THD *thd, enum_var_type type);
static void fix_myisam_max_sort_file_size(THD *thd, enum_var_type type); static void fix_myisam_max_sort_file_size(THD *thd, enum_var_type type);
static void fix_maria_max_sort_file_size(THD *thd, enum_var_type type);
static void fix_max_binlog_size(THD *thd, enum_var_type type); static void fix_max_binlog_size(THD *thd, enum_var_type type);
static void fix_max_relay_log_size(THD *thd, enum_var_type type); static void fix_max_relay_log_size(THD *thd, enum_var_type type);
static void fix_max_connections(THD *thd, enum_var_type type); static void fix_max_connections(THD *thd, enum_var_type type);
...@@ -258,7 +257,7 @@ static sys_var_bool_ptr sys_local_infile(&vars, "local_infile", ...@@ -258,7 +257,7 @@ static sys_var_bool_ptr sys_local_infile(&vars, "local_infile",
static sys_var_trust_routine_creators static sys_var_trust_routine_creators
sys_trust_routine_creators(&vars, "log_bin_trust_routine_creators", sys_trust_routine_creators(&vars, "log_bin_trust_routine_creators",
&trust_function_creators); &trust_function_creators);
static sys_var_bool_ptr static sys_var_bool_ptr
sys_trust_function_creators(&vars, "log_bin_trust_function_creators", sys_trust_function_creators(&vars, "log_bin_trust_function_creators",
&trust_function_creators); &trust_function_creators);
static sys_var_bool_ptr static sys_var_bool_ptr
...@@ -341,20 +340,10 @@ static sys_var_thd_ulong sys_myisam_repair_threads(&vars, "myisam_repair_t ...@@ -341,20 +340,10 @@ static sys_var_thd_ulong sys_myisam_repair_threads(&vars, "myisam_repair_t
static sys_var_thd_ulong sys_myisam_sort_buffer_size(&vars, "myisam_sort_buffer_size", &SV::myisam_sort_buff_size); static sys_var_thd_ulong sys_myisam_sort_buffer_size(&vars, "myisam_sort_buffer_size", &SV::myisam_sort_buff_size);
static sys_var_bool_ptr sys_myisam_use_mmap(&vars, "myisam_use_mmap", static sys_var_bool_ptr sys_myisam_use_mmap(&vars, "myisam_use_mmap",
&opt_myisam_use_mmap); &opt_myisam_use_mmap);
static sys_var_thd_enum sys_myisam_stats_method(&vars, "myisam_stats_method", static sys_var_thd_enum sys_myisam_stats_method(&vars, "myisam_stats_method",
&SV::myisam_stats_method, &SV::myisam_stats_method,
&myisam_stats_method_typelib, &myisam_stats_method_typelib,
NULL); NULL);
static sys_var_thd_ulonglong sys_maria_max_sort_file_size(&vars, "maria_max_sort_file_size", &SV::maria_max_sort_file_size, fix_maria_max_sort_file_size, 1);
static sys_var_thd_ulong sys_maria_repair_threads(&vars, "maria_repair_threads", &SV::maria_repair_threads);
static sys_var_thd_ulong sys_maria_sort_buffer_size(&vars, "maria_sort_buffer_size", &SV::maria_sort_buff_size);
static sys_var_thd_enum sys_maria_stats_method(&vars, "maria_stats_method",
&SV::maria_stats_method,
&myisam_stats_method_typelib,
NULL);
static sys_var_thd_ulong sys_net_buffer_length(&vars, "net_buffer_length", static sys_var_thd_ulong sys_net_buffer_length(&vars, "net_buffer_length",
&SV::net_buffer_length); &SV::net_buffer_length);
static sys_var_thd_ulong sys_net_read_timeout(&vars, "net_read_timeout", static sys_var_thd_ulong sys_net_read_timeout(&vars, "net_read_timeout",
...@@ -651,7 +640,7 @@ static sys_var_have_plugin sys_have_csv(&vars, "have_csv", C_STRING_WITH_LEN("cs ...@@ -651,7 +640,7 @@ static sys_var_have_plugin sys_have_csv(&vars, "have_csv", C_STRING_WITH_LEN("cs
static sys_var_have_variable sys_have_dlopen(&vars, "have_dynamic_loading", &have_dlopen); static sys_var_have_variable sys_have_dlopen(&vars, "have_dynamic_loading", &have_dlopen);
static sys_var_have_variable sys_have_geometry(&vars, "have_geometry", &have_geometry); static sys_var_have_variable sys_have_geometry(&vars, "have_geometry", &have_geometry);
static sys_var_have_plugin sys_have_innodb(&vars, "have_innodb", C_STRING_WITH_LEN("innodb"), MYSQL_STORAGE_ENGINE_PLUGIN); static sys_var_have_plugin sys_have_innodb(&vars, "have_innodb", C_STRING_WITH_LEN("innodb"), MYSQL_STORAGE_ENGINE_PLUGIN);
static sys_var_have_variable sys_have_maria_db(&vars, "have_maria", &have_maria_db); static sys_var_have_plugin sys_have_maria(&vars, "have_maria", C_STRING_WITH_LEN("maria"), MYSQL_STORAGE_ENGINE_PLUGIN);
static sys_var_have_plugin sys_have_ndbcluster(&vars, "have_ndbcluster", C_STRING_WITH_LEN("ndbcluster"), MYSQL_STORAGE_ENGINE_PLUGIN); static sys_var_have_plugin sys_have_ndbcluster(&vars, "have_ndbcluster", C_STRING_WITH_LEN("ndbcluster"), MYSQL_STORAGE_ENGINE_PLUGIN);
static sys_var_have_variable sys_have_openssl(&vars, "have_openssl", &have_ssl); static sys_var_have_variable sys_have_openssl(&vars, "have_openssl", &have_ssl);
static sys_var_have_variable sys_have_ssl(&vars, "have_ssl", &have_ssl); static sys_var_have_variable sys_have_ssl(&vars, "have_ssl", &have_ssl);
...@@ -867,16 +856,6 @@ fix_myisam_max_sort_file_size(THD *thd, enum_var_type type) ...@@ -867,16 +856,6 @@ fix_myisam_max_sort_file_size(THD *thd, enum_var_type type)
(my_off_t) global_system_variables.myisam_max_sort_file_size; (my_off_t) global_system_variables.myisam_max_sort_file_size;
} }
static void
fix_maria_max_sort_file_size(THD *thd, enum_var_type type)
{
#ifdef WITH_MARIA_STORAGE_ENGINE
maria_max_temp_length=
(my_off_t) global_system_variables.myisam_max_sort_file_size;
#endif
}
/* /*
Set the OPTION_BIG_SELECTS flag if max_join_size == HA_POS_ERROR Set the OPTION_BIG_SELECTS flag if max_join_size == HA_POS_ERROR
*/ */
......
...@@ -232,20 +232,19 @@ struct system_variables ...@@ -232,20 +232,19 @@ struct system_variables
{ {
/* /*
How dynamically allocated system variables are handled: How dynamically allocated system variables are handled:
The global_system_variables and max_system_variables are "authoritative" The global_system_variables and max_system_variables are "authoritative"
They both should have the same 'version' and 'size'. They both should have the same 'version' and 'size'.
When attempting to access a dynamic variable, if the session version When attempting to access a dynamic variable, if the session version
is out of date, then the session version is updated and realloced if is out of date, then the session version is updated and realloced if
neccessary and bytes copied from global to make up for missing data. neccessary and bytes copied from global to make up for missing data.
*/ */
ulong dynamic_variables_version; ulong dynamic_variables_version;
char* dynamic_variables_ptr; char* dynamic_variables_ptr;
uint dynamic_variables_head; /* largest valid variable offset */ uint dynamic_variables_head; /* largest valid variable offset */
uint dynamic_variables_size; /* how many bytes are in use */ uint dynamic_variables_size; /* how many bytes are in use */
ulonglong myisam_max_extra_sort_file_size; ulonglong myisam_max_extra_sort_file_size;
ulonglong maria_max_sort_file_size;
ulonglong myisam_max_sort_file_size; ulonglong myisam_max_sort_file_size;
ulonglong max_heap_table_size; ulonglong max_heap_table_size;
ulonglong tmp_table_size; ulonglong tmp_table_size;
...@@ -262,9 +261,6 @@ struct system_variables ...@@ -262,9 +261,6 @@ struct system_variables
ulong max_tmp_tables; ulong max_tmp_tables;
ulong max_insert_delayed_threads; ulong max_insert_delayed_threads;
ulong min_examined_row_limit; ulong min_examined_row_limit;
ulong maria_repair_threads;
ulong maria_sort_buff_size;
ulong maria_stats_method;
ulong multi_range_count; ulong multi_range_count;
ulong myisam_repair_threads; ulong myisam_repair_threads;
ulong myisam_sort_buff_size; ulong myisam_sort_buff_size;
...@@ -312,9 +308,9 @@ struct system_variables ...@@ -312,9 +308,9 @@ struct system_variables
my_bool low_priority_updates; my_bool low_priority_updates;
my_bool new_mode; my_bool new_mode;
/* /*
compatibility option: compatibility option:
- index usage hints (USE INDEX without a FOR clause) behave as in 5.0 - index usage hints (USE INDEX without a FOR clause) behave as in 5.0
*/ */
my_bool old_mode; my_bool old_mode;
my_bool query_cache_wlock_invalidate; my_bool query_cache_wlock_invalidate;
...@@ -538,7 +534,7 @@ class Server_side_cursor; ...@@ -538,7 +534,7 @@ class Server_side_cursor;
- prepared, that is, contain placeholders, - prepared, that is, contain placeholders,
- opened as cursors. We maintain 1 to 1 relationship between - opened as cursors. We maintain 1 to 1 relationship between
statement and cursor - if user wants to create another cursor for his statement and cursor - if user wants to create another cursor for his
query, we create another statement for it. query, we create another statement for it.
To perform some action with statement we reset THD part to the state of To perform some action with statement we reset THD part to the state of
that statement, do the action, and then save back modified state from THD that statement, do the action, and then save back modified state from THD
to the statement. It will be changed in near future, and Statement will to the statement. It will be changed in near future, and Statement will
...@@ -589,7 +585,7 @@ class Statement: public ilink, public Query_arena ...@@ -589,7 +585,7 @@ class Statement: public ilink, public Query_arena
it. We will see the query_length field as either 0, or the right value it. We will see the query_length field as either 0, or the right value
for it. for it.
Assuming that the write and read of an n-bit memory field in an n-bit Assuming that the write and read of an n-bit memory field in an n-bit
computer is atomic, we can avoid races in the above way. computer is atomic, we can avoid races in the above way.
This printing is needed at least in SHOW PROCESSLIST and SHOW INNODB This printing is needed at least in SHOW PROCESSLIST and SHOW INNODB
STATUS. STATUS.
*/ */
...@@ -741,7 +737,7 @@ class Security_context { ...@@ -741,7 +737,7 @@ class Security_context {
{ {
return (*priv_host ? priv_host : (char *)"%"); return (*priv_host ? priv_host : (char *)"%");
} }
bool set_user(char *user_arg); bool set_user(char *user_arg);
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
...@@ -1084,7 +1080,7 @@ class THD :public Statement, ...@@ -1084,7 +1080,7 @@ class THD :public Statement,
/* /*
One thread can hold up to one named user-level lock. This variable One thread can hold up to one named user-level lock. This variable
points to a lock object if the lock is present. See item_func.cc and points to a lock object if the lock is present. See item_func.cc and
chapter 'Miscellaneous functions', for functions GET_LOCK, RELEASE_LOCK. chapter 'Miscellaneous functions', for functions GET_LOCK, RELEASE_LOCK.
*/ */
User_level_lock *ull; User_level_lock *ull;
#ifndef DBUG_OFF #ifndef DBUG_OFF
...@@ -1103,7 +1099,7 @@ class THD :public Statement, ...@@ -1103,7 +1099,7 @@ class THD :public Statement,
time_t start_time, user_time; time_t start_time, user_time;
ulonglong connect_utime, thr_create_utime; // track down slow pthread_create ulonglong connect_utime, thr_create_utime; // track down slow pthread_create
ulonglong start_utime, utime_after_lock; ulonglong start_utime, utime_after_lock;
thr_lock_type update_lock_default; thr_lock_type update_lock_default;
Delayed_insert *di; Delayed_insert *di;
...@@ -1471,7 +1467,7 @@ class THD :public Statement, ...@@ -1471,7 +1467,7 @@ class THD :public Statement,
bool substitute_null_with_insert_id; bool substitute_null_with_insert_id;
bool in_lock_tables; bool in_lock_tables;
bool query_error, bootstrap, cleanup_done; bool query_error, bootstrap, cleanup_done;
/** is set if some thread specific value(s) used in a statement. */ /** is set if some thread specific value(s) used in a statement. */
bool thread_specific_used; bool thread_specific_used;
bool charset_is_system_charset, charset_is_collation_connection; bool charset_is_system_charset, charset_is_collation_connection;
...@@ -1503,10 +1499,10 @@ class THD :public Statement, ...@@ -1503,10 +1499,10 @@ class THD :public Statement,
ulong ulong_value; ulong ulong_value;
ulonglong ulonglong_value; ulonglong ulonglong_value;
} sys_var_tmp; } sys_var_tmp;
struct { struct {
/* /*
If true, mysql_bin_log::write(Log_event) call will not write events to If true, mysql_bin_log::write(Log_event) call will not write events to
binlog, and maintain 2 below variables instead (use binlog, and maintain 2 below variables instead (use
mysql_bin_log.start_union_events to turn this on) mysql_bin_log.start_union_events to turn this on)
*/ */
...@@ -1517,13 +1513,13 @@ class THD :public Statement, ...@@ -1517,13 +1513,13 @@ class THD :public Statement,
*/ */
bool unioned_events; bool unioned_events;
/* /*
If TRUE, at least one mysql_bin_log::write(Log_event e), where If TRUE, at least one mysql_bin_log::write(Log_event e), where
e.cache_stmt == TRUE call has been made after last e.cache_stmt == TRUE call has been made after last
mysql_bin_log.start_union_events() call. mysql_bin_log.start_union_events() call.
*/ */
bool unioned_events_trans; bool unioned_events_trans;
/* /*
'queries' (actually SP statements) that run under inside this binlog 'queries' (actually SP statements) that run under inside this binlog
union have thd->query_id >= first_query_id. union have thd->query_id >= first_query_id.
*/ */
...@@ -1554,7 +1550,7 @@ class THD :public Statement, ...@@ -1554,7 +1550,7 @@ class THD :public Statement,
killing mysqld) where it's vital to not allocate excessive and not used killing mysqld) where it's vital to not allocate excessive and not used
memory. Note, that we still don't return error from init_for_queries(): memory. Note, that we still don't return error from init_for_queries():
if preallocation fails, we should notice that at the first call to if preallocation fails, we should notice that at the first call to
alloc_root. alloc_root.
*/ */
void init_for_queries(); void init_for_queries();
void change_user(void); void change_user(void);
...@@ -1584,12 +1580,12 @@ class THD :public Statement, ...@@ -1584,12 +1580,12 @@ class THD :public Statement,
The query can be logged row-based or statement-based The query can be logged row-based or statement-based
*/ */
ROW_QUERY_TYPE, ROW_QUERY_TYPE,
/* /*
The query has to be logged statement-based The query has to be logged statement-based
*/ */
STMT_QUERY_TYPE, STMT_QUERY_TYPE,
/* /*
The query represents a change to a table in the "mysql" The query represents a change to a table in the "mysql"
database and is currently mapped to ROW_QUERY_TYPE. database and is currently mapped to ROW_QUERY_TYPE.
...@@ -1597,7 +1593,7 @@ class THD :public Statement, ...@@ -1597,7 +1593,7 @@ class THD :public Statement,
MYSQL_QUERY_TYPE, MYSQL_QUERY_TYPE,
QUERY_TYPE_COUNT QUERY_TYPE_COUNT
}; };
int binlog_query(enum_binlog_query_type qtype, int binlog_query(enum_binlog_query_type qtype,
char const *query, ulong query_len, char const *query, ulong query_len,
bool is_trans, bool suppress_use, bool is_trans, bool suppress_use,
...@@ -1819,7 +1815,7 @@ class THD :public Statement, ...@@ -1819,7 +1815,7 @@ class THD :public Statement,
if ((temporary_tables == NULL) && (in_sub_stmt == 0) && if ((temporary_tables == NULL) && (in_sub_stmt == 0) &&
(system_thread != SYSTEM_THREAD_NDBCLUSTER_BINLOG)) (system_thread != SYSTEM_THREAD_NDBCLUSTER_BINLOG))
{ {
current_stmt_binlog_row_based= current_stmt_binlog_row_based=
test(variables.binlog_format == BINLOG_FORMAT_ROW); test(variables.binlog_format == BINLOG_FORMAT_ROW);
} }
} }
...@@ -2165,8 +2161,8 @@ class select_create: public select_insert { ...@@ -2165,8 +2161,8 @@ class select_create: public select_insert {
#include <myisam.h> #include <myisam.h>
/* /*
Param to create temporary tables when doing SELECT:s Param to create temporary tables when doing SELECT:s
NOTE NOTE
This structure is copied using memcpy as a part of JOIN. This structure is copied using memcpy as a part of JOIN.
*/ */
...@@ -2194,8 +2190,8 @@ class TMP_TABLE_PARAM :public Sql_alloc ...@@ -2194,8 +2190,8 @@ class TMP_TABLE_PARAM :public Sql_alloc
uint quick_group; uint quick_group;
bool using_indirect_summary_function; bool using_indirect_summary_function;
/* If >0 convert all blob fields to varchar(convert_blob_length) */ /* If >0 convert all blob fields to varchar(convert_blob_length) */
uint convert_blob_length; uint convert_blob_length;
CHARSET_INFO *table_charset; CHARSET_INFO *table_charset;
bool schema_table; bool schema_table;
/* /*
True if GROUP BY and its aggregate functions are already computed True if GROUP BY and its aggregate functions are already computed
...@@ -2329,7 +2325,7 @@ class Table_ident :public Sql_alloc ...@@ -2329,7 +2325,7 @@ class Table_ident :public Sql_alloc
else else
db= db_arg; db= db_arg;
} }
inline Table_ident(LEX_STRING table_arg) inline Table_ident(LEX_STRING table_arg)
:table(table_arg), sel((SELECT_LEX_UNIT *)0) :table(table_arg), sel((SELECT_LEX_UNIT *)0)
{ {
db.str=0; db.str=0;
...@@ -2375,7 +2371,7 @@ class user_var_entry ...@@ -2375,7 +2371,7 @@ class user_var_entry
}; };
/* /*
Unique -- class for unique (removing of duplicates). Unique -- class for unique (removing of duplicates).
Puts all values to the TREE. If the tree becomes too big, Puts all values to the TREE. If the tree becomes too big,
it's dumped to the file. User can request sorted values, or it's dumped to the file. User can request sorted values, or
just iterate through them. In the last case tree merging is performed in just iterate through them. In the last case tree merging is performed in
...@@ -2409,9 +2405,9 @@ class Unique :public Sql_alloc ...@@ -2409,9 +2405,9 @@ class Unique :public Sql_alloc
} }
bool get(TABLE *table); bool get(TABLE *table);
static double get_use_cost(uint *buffer, uint nkeys, uint key_size, static double get_use_cost(uint *buffer, uint nkeys, uint key_size,
ulonglong max_in_memory_size); ulonglong max_in_memory_size);
inline static int get_cost_calc_buff_size(ulong nkeys, uint key_size, inline static int get_cost_calc_buff_size(ulong nkeys, uint key_size,
ulonglong max_in_memory_size) ulonglong max_in_memory_size)
{ {
register ulonglong max_elems_in_tree= register ulonglong max_elems_in_tree=
...@@ -2466,7 +2462,7 @@ class multi_update :public select_result_interceptor ...@@ -2466,7 +2462,7 @@ class multi_update :public select_result_interceptor
uint table_count; uint table_count;
/* /*
List of tables referenced in the CHECK OPTION condition of List of tables referenced in the CHECK OPTION condition of
the updated view excluding the updated table. the updated view excluding the updated table.
*/ */
List <TABLE> unupdated_check_opt_tables; List <TABLE> unupdated_check_opt_tables;
Copy_field *copy_field; Copy_field *copy_field;
......
...@@ -2168,9 +2168,11 @@ static st_bookmark *register_var(const char *plugin, const char *name, ...@@ -2168,9 +2168,11 @@ static st_bookmark *register_var(const char *plugin, const char *name,
size= sizeof(int); size= sizeof(int);
break; break;
case PLUGIN_VAR_LONG: case PLUGIN_VAR_LONG:
case PLUGIN_VAR_ENUM:
size= sizeof(long); size= sizeof(long);
break; break;
case PLUGIN_VAR_LONGLONG: case PLUGIN_VAR_LONGLONG:
case PLUGIN_VAR_SET:
size= sizeof(ulonglong); size= sizeof(ulonglong);
break; break;
case PLUGIN_VAR_STR: case PLUGIN_VAR_STR:
......
...@@ -78,6 +78,32 @@ TYPELIB maria_stats_method_typelib= ...@@ -78,6 +78,32 @@ TYPELIB maria_stats_method_typelib=
maria_stats_method_names, NULL maria_stats_method_names, NULL
}; };
static MYSQL_SYSVAR_ULONG(block_size, maria_block_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Block size to be used for MARIA index pages.", 0, 0,
MARIA_KEY_BLOCK_LENGTH, MARIA_MIN_KEY_BLOCK_LENGTH,
MARIA_MAX_KEY_BLOCK_LENGTH, MARIA_MIN_KEY_BLOCK_LENGTH);
static MYSQL_SYSVAR_ULONGLONG(max_sort_file_size,
maria_max_temp_length, PLUGIN_VAR_RQCMDARG,
"Don't use the fast sort index method to created index if the "
"temporary file would get bigger than this.",
0, 0, MAX_FILE_SIZE, 0, MAX_FILE_SIZE, 1024*1024);
static MYSQL_THDVAR_ULONG(repair_threads, PLUGIN_VAR_RQCMDARG,
"Number of threads to use when repairing maria tables. The value of 1 "
"disables parallel repair.",
0, 0, 1, 1, ~0L, 1);
static MYSQL_THDVAR_ULONG(sort_buffer_size, PLUGIN_VAR_RQCMDARG,
"The buffer that is allocated when sorting the index when doing a "
"REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE.",
0, 0, 8192*1024, 4, ~0L, 1);
static MYSQL_THDVAR_ENUM(stats_method, PLUGIN_VAR_RQCMDARG,
"Specifies how maria index statistics collection code should threat "
"NULLs. Possible values of name are \"nulls_unequal\", \"nulls_equal\", "
"and \"nulls_ignored\".", 0, 0, 0, &maria_stats_method_typelib);
/***************************************************************************** /*****************************************************************************
** MARIA tables ** MARIA tables
...@@ -843,8 +869,7 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt) ...@@ -843,8 +869,7 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt)
param.db_name= table->s->db.str; param.db_name= table->s->db.str;
param.table_name= table->alias; param.table_name= table->alias;
param.testflag= check_opt->flags | T_CHECK | T_SILENT; param.testflag= check_opt->flags | T_CHECK | T_SILENT;
param.stats_method= (enum_handler_stats_method) thd->variables. param.stats_method= (enum_handler_stats_method)THDVAR(thd,stats_method);
maria_stats_method;
if (!(table->db_stat & HA_READ_ONLY)) if (!(table->db_stat & HA_READ_ONLY))
param.testflag |= T_STATISTICS; param.testflag |= T_STATISTICS;
...@@ -935,8 +960,7 @@ int ha_maria::analyze(THD *thd, HA_CHECK_OPT * check_opt) ...@@ -935,8 +960,7 @@ int ha_maria::analyze(THD *thd, HA_CHECK_OPT * check_opt)
param.testflag= (T_FAST | T_CHECK | T_SILENT | T_STATISTICS | param.testflag= (T_FAST | T_CHECK | T_SILENT | T_STATISTICS |
T_DONT_CHECK_CHECKSUM); T_DONT_CHECK_CHECKSUM);
param.using_global_keycache= 1; param.using_global_keycache= 1;
param.stats_method= (enum_handler_stats_method) thd->variables. param.stats_method= (enum_handler_stats_method)THDVAR(thd,stats_method);
maria_stats_method;
if (!(share->state.changed & STATE_NOT_ANALYZED)) if (!(share->state.changed & STATE_NOT_ANALYZED))
return HA_ADMIN_ALREADY_DONE; return HA_ADMIN_ALREADY_DONE;
...@@ -1205,7 +1229,7 @@ int ha_maria::repair(THD *thd, HA_CHECK &param, bool do_optimize) ...@@ -1205,7 +1229,7 @@ int ha_maria::repair(THD *thd, HA_CHECK &param, bool do_optimize)
param.testflag |= T_STATISTICS; // We get this for free param.testflag |= T_STATISTICS; // We get this for free
statistics_done= 1; statistics_done= 1;
/* TODO: Remove BLOCK_RECORD test when parallel works with blocks */ /* TODO: Remove BLOCK_RECORD test when parallel works with blocks */
if (thd->variables.maria_repair_threads > 1 && if (THDVAR(thd,repair_threads) > 1 &&
file->s->data_file_type != BLOCK_RECORD) file->s->data_file_type != BLOCK_RECORD)
{ {
char buf[40]; char buf[40];
...@@ -1521,9 +1545,8 @@ int ha_maria::enable_indexes(uint mode) ...@@ -1521,9 +1545,8 @@ int ha_maria::enable_indexes(uint mode)
param.testflag= (T_SILENT | T_REP_BY_SORT | T_QUICK | param.testflag= (T_SILENT | T_REP_BY_SORT | T_QUICK |
T_CREATE_MISSING_KEYS); T_CREATE_MISSING_KEYS);
param.myf_rw &= ~MY_WAIT_IF_FULL; param.myf_rw &= ~MY_WAIT_IF_FULL;
param.sort_buffer_length= thd->variables.maria_sort_buff_size; param.sort_buffer_length= THDVAR(thd,sort_buffer_size);
param.stats_method= param.stats_method= (enum_handler_stats_method)THDVAR(thd,stats_method);
(enum_handler_stats_method) thd->variables.maria_stats_method;
param.tmpdir= &mysql_tmpdir_list; param.tmpdir= &mysql_tmpdir_list;
if ((error= (repair(thd, param, 0) != HA_ADMIN_OK)) && param.retry_repair) if ((error= (repair(thd, param, 0) != HA_ADMIN_OK)) && param.retry_repair)
{ {
...@@ -2461,6 +2484,16 @@ my_bool ha_maria::register_query_cache_table(THD *thd, char *table_name, ...@@ -2461,6 +2484,16 @@ my_bool ha_maria::register_query_cache_table(THD *thd, char *table_name,
} }
#endif #endif
static struct st_mysql_sys_var* system_variables[]= {
MYSQL_SYSVAR(block_size),
MYSQL_SYSVAR(max_sort_file_size),
MYSQL_SYSVAR(repair_threads),
MYSQL_SYSVAR(sort_buffer_size),
MYSQL_SYSVAR(stats_method),
NULL
};
struct st_mysql_storage_engine maria_storage_engine= struct st_mysql_storage_engine maria_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION }; { MYSQL_HANDLERTON_INTERFACE_VERSION };
...@@ -2473,11 +2506,11 @@ mysql_declare_plugin(maria) ...@@ -2473,11 +2506,11 @@ mysql_declare_plugin(maria)
"MySQL AB", "MySQL AB",
"Traditional transactional MySQL tables", "Traditional transactional MySQL tables",
PLUGIN_LICENSE_GPL, PLUGIN_LICENSE_GPL,
ha_maria_init, /* Plugin Init */ ha_maria_init, /* Plugin Init */
NULL, /* Plugin Deinit */ NULL, /* Plugin Deinit */
0x0100, /* 1.0 */ 0x0100, /* 1.0 */
NULL, /* status variables */ NULL, /* status variables */
NULL, /* system variables */ system_variables, /* system variables */
NULL /* config options */ NULL
} }
mysql_declare_plugin_end; mysql_declare_plugin_end;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment