Commit 6c7a278c 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 a1bb4afa
......@@ -506,7 +506,6 @@ char *mysqld_unix_port, *opt_mysql_tmpdir;
const char **errmesg; /* Error messages */
const char *myisam_recover_options_str="OFF";
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 */
const char *in_left_expr_name= "<left expr>";
......@@ -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_geometry, have_rtree_keys;
SHOW_COMP_OPTION have_crypt, have_compress, have_maria_db;
SHOW_COMP_OPTION have_crypt, have_compress;
/* Thread specific variables */
......@@ -5059,10 +5058,6 @@ enum options_mysqld
OPT_MYISAM_USE_MMAP, OPT_MYISAM_REPAIR_THREADS,
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_DIVISION_LIMIT, OPT_PAGECACHE_AGE_THRESHOLD,
......@@ -6046,40 +6041,6 @@ log and this option does nothing anymore.",
0
#endif
, 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 packetlength to send/receive from to server.",
(uchar**) &global_system_variables.max_allowed_packet,
......@@ -7194,7 +7155,7 @@ static void mysql_init_variables(void)
global_query_id= thread_id= 1L;
strmov(server_version, MYSQL_SERVER_VERSION);
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);
threads.empty();
thread_cache.empty();
......@@ -7257,7 +7218,6 @@ static void mysql_init_variables(void)
when collecting index statistics for MyISAM tables.
*/
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 */
#ifndef DBUG_OFF
......
......@@ -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_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_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_relay_log_size(THD *thd, enum_var_type type);
static void fix_max_connections(THD *thd, enum_var_type type);
......@@ -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_bool_ptr sys_myisam_use_mmap(&vars, "myisam_use_mmap",
&opt_myisam_use_mmap);
static sys_var_thd_enum sys_myisam_stats_method(&vars, "myisam_stats_method",
&SV::myisam_stats_method,
&myisam_stats_method_typelib,
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",
&SV::net_buffer_length);
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
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_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_variable sys_have_openssl(&vars, "have_openssl", &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)
(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
*/
......
......@@ -245,7 +245,6 @@ struct system_variables
uint dynamic_variables_size; /* how many bytes are in use */
ulonglong myisam_max_extra_sort_file_size;
ulonglong maria_max_sort_file_size;
ulonglong myisam_max_sort_file_size;
ulonglong max_heap_table_size;
ulonglong tmp_table_size;
......@@ -262,9 +261,6 @@ struct system_variables
ulong max_tmp_tables;
ulong max_insert_delayed_threads;
ulong min_examined_row_limit;
ulong maria_repair_threads;
ulong maria_sort_buff_size;
ulong maria_stats_method;
ulong multi_range_count;
ulong myisam_repair_threads;
ulong myisam_sort_buff_size;
......
......@@ -2168,9 +2168,11 @@ static st_bookmark *register_var(const char *plugin, const char *name,
size= sizeof(int);
break;
case PLUGIN_VAR_LONG:
case PLUGIN_VAR_ENUM:
size= sizeof(long);
break;
case PLUGIN_VAR_LONGLONG:
case PLUGIN_VAR_SET:
size= sizeof(ulonglong);
break;
case PLUGIN_VAR_STR:
......
......@@ -78,6 +78,32 @@ TYPELIB maria_stats_method_typelib=
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
......@@ -843,8 +869,7 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt)
param.db_name= table->s->db.str;
param.table_name= table->alias;
param.testflag= check_opt->flags | T_CHECK | T_SILENT;
param.stats_method= (enum_handler_stats_method) thd->variables.
maria_stats_method;
param.stats_method= (enum_handler_stats_method)THDVAR(thd,stats_method);
if (!(table->db_stat & HA_READ_ONLY))
param.testflag |= T_STATISTICS;
......@@ -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 |
T_DONT_CHECK_CHECKSUM);
param.using_global_keycache= 1;
param.stats_method= (enum_handler_stats_method) thd->variables.
maria_stats_method;
param.stats_method= (enum_handler_stats_method)THDVAR(thd,stats_method);
if (!(share->state.changed & STATE_NOT_ANALYZED))
return HA_ADMIN_ALREADY_DONE;
......@@ -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
statistics_done= 1;
/* 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)
{
char buf[40];
......@@ -1521,9 +1545,8 @@ int ha_maria::enable_indexes(uint mode)
param.testflag= (T_SILENT | T_REP_BY_SORT | T_QUICK |
T_CREATE_MISSING_KEYS);
param.myf_rw &= ~MY_WAIT_IF_FULL;
param.sort_buffer_length= thd->variables.maria_sort_buff_size;
param.stats_method=
(enum_handler_stats_method) thd->variables.maria_stats_method;
param.sort_buffer_length= THDVAR(thd,sort_buffer_size);
param.stats_method= (enum_handler_stats_method)THDVAR(thd,stats_method);
param.tmpdir= &mysql_tmpdir_list;
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,
}
#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=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
......@@ -2477,7 +2510,7 @@ mysql_declare_plugin(maria)
NULL, /* Plugin Deinit */
0x0100, /* 1.0 */
NULL, /* status variables */
NULL, /* system variables */
NULL /* config options */
system_variables, /* system variables */
NULL
}
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