Below is the list of changes that have just been committed into a local
5.1 repository of antony. When antony does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2006-12-21 16:54:19-08:00, antony@stripped +23 -0
WL#2936
"Plugin Server Variables"
Second-cut implementation for review (relative to 5.1-engines tree)
include/my_getopt.h@stripped, 2006-12-21 16:54:07-08:00, antony@stripped +2 -1
change app_type to a long so its safe for pointers on 64bit arch.
new flag: my_getopt_skip_unknown
include/mysql/plugin.h@stripped, 2006-12-21 16:54:08-08:00, antony@stripped +250 -3
WL2936
Introduce new structures to declare server variables for plugins
mysql-test/mysql-test-run.pl@stripped, 2006-12-21 16:54:08-08:00, antony@stripped +11
-11
change to use plugin-safe command line options
mysys/my_getopt.c@stripped, 2006-12-21 16:54:08-08:00, antony@stripped +16 -0
when my_getopt_skip_unknown is set, handle_options will skip and
preserve unhandled options
sql/ha_ndbcluster.cc@stripped, 2006-12-21 16:54:09-08:00, antony@stripped +11 -24
use ha_statistic_increment where appropiate.
remove have_ndbcluster
sql/handler.cc@stripped, 2006-12-21 16:54:09-08:00, antony@stripped +1 -2
use ha_statistic_increment where appropiate
sql/mysql_priv.h@stripped, 2006-12-21 16:54:09-08:00, antony@stripped +1 -6
remove some unneccessary globals.
new func: reset_status_vars()
sql/mysqld.cc@stripped, 2006-12-21 16:54:09-08:00, antony@stripped +58 -399
WL2936
remove some unneccessary declarations
alter argument processing for plugins
sql/set_var.cc@stripped, 2006-12-21 16:54:09-08:00, antony@stripped +330 -639
WL2936
Remove some unneccessary declarations
change sys_var constructors to construct chain explicitly.
new functions enumerate_sys_vars(), set_var_init()
mysql_add_sys_var_chain(), mysql_del_sys_var_chain(),
mysql_append_static_vars()
sql/set_var.h@stripped, 2006-12-21 16:54:10-08:00, antony@stripped +171 -136
WL2936
change sys_var constructors to construct chain explicitly.
new functions enumerate_sys_vars(), set_var_init(),
mysql_add_sys_var_chain(), mysql_del_sys_var_chain(),
mysql_append_static_vars()
sql/sql_class.cc@stripped, 2006-12-21 16:54:10-08:00, antony@stripped +5 -0
WL2936
declarations for dynamic system variables
sql/sql_class.h@stripped, 2006-12-21 16:54:10-08:00, antony@stripped +13 -2
WL2936
declarations for dynamic system variables
sql/sql_parse.cc@stripped, 2006-12-21 16:54:10-08:00, antony@stripped +0 -1
remove redundant code
sql/sql_plugin.cc@stripped, 2006-12-21 16:54:10-08:00, antony@stripped +1359 -31
WL2936
declarations to implement plugin server variables
sql/sql_plugin.h@stripped, 2006-12-21 16:54:11-08:00, antony@stripped +18 -1
WL2936
declarations to implement plugin server variables
sql/sql_repl.cc@stripped, 2006-12-21 16:54:11-08:00, antony@stripped +142 -0
relocate some replication specific code from mysqld.cc
sql/sql_repl.h@stripped, 2006-12-21 16:54:11-08:00, antony@stripped +1 -0
relocate some replication specific code from mysqld.cc
sql/sql_show.cc@stripped, 2006-12-21 16:54:11-08:00, antony@stripped +15 -3
WL2936
new function reset_status_vars()
make use of new server variable enumeration function
storage/federated/ha_federated.cc@stripped, 2006-12-21 16:54:11-08:00, antony@stripped +4
-7
use ha_statistic_increment where appropiate
storage/heap/ha_heap.cc@stripped, 2006-12-21 16:54:12-08:00, antony@stripped +12 -21
use ha_statistic_increment where appropiate
storage/innobase/handler/ha_innodb.cc@stripped, 2006-12-21 16:54:12-08:00,
antony@stripped +227 -15
WL2936
use ha_statistic_increment where appropiate
declare innodb server variables (moved from mysqld.cc)
storage/myisam/ha_myisam.cc@stripped, 2006-12-21 16:54:12-08:00, antony@stripped +13 -23
use ha_statistic_increment where appropiate
storage/myisammrg/ha_myisammrg.cc@stripped, 2006-12-21 16:54:12-08:00, antony@stripped
+13 -23
use ha_statistic_increment where appropiate
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: antony
# Host: ppcg5.local
# Root: /Users/antony/Work/wl2936.6
--- 1.104/storage/heap/ha_heap.cc 2006-12-21 16:54:34 -08:00
+++ 1.105/storage/heap/ha_heap.cc 2006-12-21 16:54:34 -08:00
@@ -182,7 +182,7 @@
int ha_heap::write_row(byte * buf)
{
int res;
- statistic_increment(table->in_use->status_var.ha_write_count,&LOCK_status);
+ ha_statistic_increment(&SSV::ha_write_count);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time();
if (table->next_number_field && buf == table->record[0])
@@ -206,7 +206,7 @@
int ha_heap::update_row(const byte * old_data, byte * new_data)
{
int res;
- statistic_increment(table->in_use->status_var.ha_update_count,&LOCK_status);
+ ha_statistic_increment(&SSV::ha_update_count);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time();
res= heap_update(file,old_data,new_data);
@@ -225,7 +225,7 @@
int ha_heap::delete_row(const byte * buf)
{
int res;
- statistic_increment(table->in_use->status_var.ha_delete_count,&LOCK_status);
+ ha_statistic_increment(&SSV::ha_delete_count);
res= heap_delete(file,buf);
if (!res && table->s->tmp_table == NO_TMP_TABLE &&
++records_changed*HEAP_STATS_UPDATE_THRESHOLD > file->s->records)
@@ -243,8 +243,7 @@
enum ha_rkey_function find_flag)
{
DBUG_ASSERT(inited==INDEX);
- statistic_increment(table->in_use->status_var.ha_read_key_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_key_count);
int error = heap_rkey(file,buf,active_index, key, key_len, find_flag);
table->status = error ? STATUS_NOT_FOUND : 0;
return error;
@@ -253,8 +252,7 @@
int ha_heap::index_read_last(byte *buf, const byte *key, uint key_len)
{
DBUG_ASSERT(inited==INDEX);
- statistic_increment(table->in_use->status_var.ha_read_key_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_key_count);
int error= heap_rkey(file, buf, active_index, key, key_len,
HA_READ_PREFIX_LAST);
table->status= error ? STATUS_NOT_FOUND : 0;
@@ -264,8 +262,7 @@
int ha_heap::index_read_idx(byte * buf, uint index, const byte * key,
uint key_len, enum ha_rkey_function find_flag)
{
- statistic_increment(table->in_use->status_var.ha_read_key_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_key_count);
int error = heap_rkey(file, buf, index, key, key_len, find_flag);
table->status = error ? STATUS_NOT_FOUND : 0;
return error;
@@ -274,8 +271,7 @@
int ha_heap::index_next(byte * buf)
{
DBUG_ASSERT(inited==INDEX);
- statistic_increment(table->in_use->status_var.ha_read_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_next_count);
int error=heap_rnext(file,buf);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
@@ -284,8 +280,7 @@
int ha_heap::index_prev(byte * buf)
{
DBUG_ASSERT(inited==INDEX);
- statistic_increment(table->in_use->status_var.ha_read_prev_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_prev_count);
int error=heap_rprev(file,buf);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
@@ -294,8 +289,7 @@
int ha_heap::index_first(byte * buf)
{
DBUG_ASSERT(inited==INDEX);
- statistic_increment(table->in_use->status_var.ha_read_first_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_first_count);
int error=heap_rfirst(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
@@ -304,8 +298,7 @@
int ha_heap::index_last(byte * buf)
{
DBUG_ASSERT(inited==INDEX);
- statistic_increment(table->in_use->status_var.ha_read_last_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_last_count);
int error=heap_rlast(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
@@ -318,8 +311,7 @@
int ha_heap::rnd_next(byte *buf)
{
- statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_rnd_next_count);
int error=heap_scan(file, buf);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
@@ -329,8 +321,7 @@
{
int error;
HEAP_PTR position;
- statistic_increment(table->in_use->status_var.ha_read_rnd_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_rnd_count);
memcpy_fixed((char*) &position,pos,sizeof(HEAP_PTR));
error=heap_rrnd(file, buf, position);
table->status=error ? STATUS_NOT_FOUND: 0;
--- 1.202/storage/myisam/ha_myisam.cc 2006-12-21 16:54:34 -08:00
+++ 1.203/storage/myisam/ha_myisam.cc 2006-12-21 16:54:34 -08:00
@@ -334,7 +334,7 @@
int ha_myisam::write_row(byte * buf)
{
- statistic_increment(table->in_use->status_var.ha_write_count,&LOCK_status);
+ ha_statistic_increment(&SSV::ha_write_count);
/* If we have a timestamp column, update it to the current time */
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
@@ -1192,7 +1192,7 @@
int ha_myisam::update_row(const byte * old_data, byte * new_data)
{
- statistic_increment(table->in_use->status_var.ha_update_count,&LOCK_status);
+ ha_statistic_increment(&SSV::ha_update_count);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time();
return mi_update(file,old_data,new_data);
@@ -1200,7 +1200,7 @@
int ha_myisam::delete_row(const byte * buf)
{
- statistic_increment(table->in_use->status_var.ha_delete_count,&LOCK_status);
+ ha_statistic_increment(&SSV::ha_delete_count);
return mi_delete(file,buf);
}
@@ -1208,8 +1208,7 @@
uint key_len, enum ha_rkey_function find_flag)
{
DBUG_ASSERT(inited==INDEX);
- statistic_increment(table->in_use->status_var.ha_read_key_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_key_count);
int error=mi_rkey(file,buf,active_index, key, key_len, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
@@ -1218,8 +1217,7 @@
int ha_myisam::index_read_idx(byte * buf, uint index, const byte * key,
uint key_len, enum ha_rkey_function find_flag)
{
- statistic_increment(table->in_use->status_var.ha_read_key_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_key_count);
int error=mi_rkey(file,buf,index, key, key_len, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
@@ -1229,8 +1227,7 @@
{
DBUG_ENTER("ha_myisam::index_read_last");
DBUG_ASSERT(inited==INDEX);
- statistic_increment(table->in_use->status_var.ha_read_key_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_key_count);
int error=mi_rkey(file,buf,active_index, key, key_len, HA_READ_PREFIX_LAST);
table->status=error ? STATUS_NOT_FOUND: 0;
DBUG_RETURN(error);
@@ -1239,8 +1236,7 @@
int ha_myisam::index_next(byte * buf)
{
DBUG_ASSERT(inited==INDEX);
- statistic_increment(table->in_use->status_var.ha_read_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_next_count);
int error=mi_rnext(file,buf,active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
@@ -1249,8 +1245,7 @@
int ha_myisam::index_prev(byte * buf)
{
DBUG_ASSERT(inited==INDEX);
- statistic_increment(table->in_use->status_var.ha_read_prev_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_prev_count);
int error=mi_rprev(file,buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
@@ -1259,8 +1254,7 @@
int ha_myisam::index_first(byte * buf)
{
DBUG_ASSERT(inited==INDEX);
- statistic_increment(table->in_use->status_var.ha_read_first_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_first_count);
int error=mi_rfirst(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
@@ -1269,8 +1263,7 @@
int ha_myisam::index_last(byte * buf)
{
DBUG_ASSERT(inited==INDEX);
- statistic_increment(table->in_use->status_var.ha_read_last_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_last_count);
int error=mi_rlast(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
@@ -1281,8 +1274,7 @@
uint length __attribute__((unused)))
{
DBUG_ASSERT(inited==INDEX);
- statistic_increment(table->in_use->status_var.ha_read_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_next_count);
int error=mi_rnext_same(file,buf);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
@@ -1298,8 +1290,7 @@
int ha_myisam::rnd_next(byte *buf)
{
- statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_rnd_next_count);
int error=mi_scan(file, buf);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
@@ -1312,8 +1303,7 @@
int ha_myisam::rnd_pos(byte * buf, byte *pos)
{
- statistic_increment(table->in_use->status_var.ha_read_rnd_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_rnd_count);
int error=mi_rrnd(file, buf, my_get_ptr(pos,ref_length));
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
--- 1.109/storage/myisammrg/ha_myisammrg.cc 2006-12-21 16:54:34 -08:00
+++ 1.110/storage/myisammrg/ha_myisammrg.cc 2006-12-21 16:54:34 -08:00
@@ -115,7 +115,7 @@
int ha_myisammrg::write_row(byte * buf)
{
- statistic_increment(table->in_use->status_var.ha_write_count,&LOCK_status);
+ ha_statistic_increment(&SSV::ha_write_count);
if (file->merge_insert_method == MERGE_INSERT_DISABLED || !file->tables)
return (HA_ERR_TABLE_READONLY);
@@ -133,7 +133,7 @@
int ha_myisammrg::update_row(const byte * old_data, byte * new_data)
{
- statistic_increment(table->in_use->status_var.ha_update_count,&LOCK_status);
+ ha_statistic_increment(&SSV::ha_update_count);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time();
return myrg_update(file,old_data,new_data);
@@ -141,15 +141,14 @@
int ha_myisammrg::delete_row(const byte * buf)
{
- statistic_increment(table->in_use->status_var.ha_delete_count,&LOCK_status);
+ ha_statistic_increment(&SSV::ha_delete_count);
return myrg_delete(file,buf);
}
int ha_myisammrg::index_read(byte * buf, const byte * key,
uint key_len, enum ha_rkey_function find_flag)
{
- statistic_increment(table->in_use->status_var.ha_read_key_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_key_count);
int error=myrg_rkey(file,buf,active_index, key, key_len, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
@@ -158,8 +157,7 @@
int ha_myisammrg::index_read_idx(byte * buf, uint index, const byte * key,
uint key_len, enum ha_rkey_function find_flag)
{
- statistic_increment(table->in_use->status_var.ha_read_key_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_key_count);
int error=myrg_rkey(file,buf,index, key, key_len, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
@@ -167,8 +165,7 @@
int ha_myisammrg::index_read_last(byte * buf, const byte * key, uint key_len)
{
- statistic_increment(table->in_use->status_var.ha_read_key_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_key_count);
int error=myrg_rkey(file,buf,active_index, key, key_len,
HA_READ_PREFIX_LAST);
table->status=error ? STATUS_NOT_FOUND: 0;
@@ -177,8 +174,7 @@
int ha_myisammrg::index_next(byte * buf)
{
- statistic_increment(table->in_use->status_var.ha_read_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_next_count);
int error=myrg_rnext(file,buf,active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
@@ -186,8 +182,7 @@
int ha_myisammrg::index_prev(byte * buf)
{
- statistic_increment(table->in_use->status_var.ha_read_prev_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_prev_count);
int error=myrg_rprev(file,buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
@@ -195,8 +190,7 @@
int ha_myisammrg::index_first(byte * buf)
{
- statistic_increment(table->in_use->status_var.ha_read_first_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_first_count);
int error=myrg_rfirst(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
@@ -204,8 +198,7 @@
int ha_myisammrg::index_last(byte * buf)
{
- statistic_increment(table->in_use->status_var.ha_read_last_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_last_count);
int error=myrg_rlast(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
@@ -215,8 +208,7 @@
const byte *key __attribute__((unused)),
uint length __attribute__((unused)))
{
- statistic_increment(table->in_use->status_var.ha_read_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_next_count);
int error=myrg_rnext_same(file,buf);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
@@ -231,8 +223,7 @@
int ha_myisammrg::rnd_next(byte *buf)
{
- statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_rnd_next_count);
int error=myrg_rrnd(file, buf, HA_OFFSET_ERROR);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
@@ -241,8 +232,7 @@
int ha_myisammrg::rnd_pos(byte * buf, byte *pos)
{
- statistic_increment(table->in_use->status_var.ha_read_rnd_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_rnd_count);
int error=myrg_rrnd(file, buf, my_get_ptr(pos,ref_length));
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
--- 1.287/sql/handler.cc 2006-12-21 16:54:34 -08:00
+++ 1.288/sql/handler.cc 2006-12-21 16:54:34 -08:00
@@ -1564,8 +1564,7 @@
register int error;
DBUG_ENTER("handler::read_first_row");
- statistic_increment(table->in_use->status_var.ha_read_first_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_first_count);
/*
If there is very few deleted rows in the table, find the first row by
--- 1.464/sql/mysql_priv.h 2006-12-21 16:54:34 -08:00
+++ 1.465/sql/mysql_priv.h 2006-12-21 16:54:34 -08:00
@@ -1070,6 +1070,7 @@
void remove_status_vars(SHOW_VAR *list);
void init_status_vars();
void free_status_vars();
+void reset_status_vars();
/* information schema */
extern LEX_STRING information_schema_name;
@@ -1632,7 +1633,6 @@
extern MY_BITMAP temp_pool;
extern String my_empty_string;
extern const String my_null_string;
-extern SHOW_VAR init_vars[], status_vars[], internal_vars[];
extern struct system_variables global_system_variables;
extern struct system_variables max_system_variables;
extern struct system_status_var global_status_var;
@@ -1651,11 +1651,6 @@
extern TYPELIB log_output_typelib;
/* optional things, have_* variables */
-
-extern SHOW_COMP_OPTION have_innodb;
-extern SHOW_COMP_OPTION have_csv_db;
-extern SHOW_COMP_OPTION have_ndbcluster;
-extern SHOW_COMP_OPTION have_partition_db;
extern handlerton *partition_hton;
extern handlerton *myisam_hton;
--- 1.599/sql/mysqld.cc 2006-12-21 16:54:34 -08:00
+++ 1.600/sql/mysqld.cc 2006-12-21 16:54:34 -08:00
@@ -32,22 +32,13 @@
#include "rpl_injector.h"
#endif
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
-#define OPT_INNODB_DEFAULT 1
-#else
-#define OPT_INNODB_DEFAULT 0
-#endif
-#define OPT_BDB_DEFAULT 0
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
-#define OPT_NDBCLUSTER_DEFAULT 0
#if defined(NOT_ENOUGH_TESTED) \
&& defined(NDB_SHM_TRANSPORTER) && MYSQL_VERSION_ID >= 50000
#define OPT_NDB_SHM_DEFAULT 1
#else
#define OPT_NDB_SHM_DEFAULT 0
#endif
-#else
-#define OPT_NDBCLUSTER_DEFAULT 0
#endif
#include <thr_alarm.h>
@@ -316,7 +307,6 @@
static bool volatile select_thread_in_use, signal_thread_in_use;
static bool volatile ready_to_exit;
static my_bool opt_debugging= 0, opt_external_locking= 0, opt_console= 0;
-static my_bool opt_ndbcluster;
static my_bool opt_short_log_format= 0;
static uint kill_cached_threads, wake_thread;
static ulong killed_threads, thread_created;
@@ -359,51 +349,14 @@
my_bool opt_safe_user_create = 0, opt_no_mix_types = 0;
my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0;
my_bool opt_log_slave_updates= 0;
-my_bool opt_innodb;
/*
Legacy global handlerton. These will be removed (please do not add more).
*/
-handlerton *heap_hton;
-handlerton *myisam_hton;
-handlerton *partition_hton;
-
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
-extern ulong innobase_fast_shutdown;
-extern ulong innobase_large_page_size;
-extern char *innobase_home, *innobase_tmpdir, *innobase_logdir;
-extern long innobase_lock_scan_time;
-extern long innobase_mirrored_log_groups, innobase_log_files_in_group;
-extern longlong innobase_log_file_size;
-extern long innobase_log_buffer_size;
-extern longlong innobase_buffer_pool_size;
-extern long innobase_additional_mem_pool_size;
-extern long innobase_file_io_threads, innobase_lock_wait_timeout;
-extern long innobase_force_recovery;
-extern long innobase_open_files;
-extern char *innobase_data_home_dir, *innobase_data_file_path;
-extern char *innobase_log_group_home_dir, *innobase_log_arch_dir;
-extern char *innobase_unix_file_flush_method;
-/* The following variables have to be my_bool for SHOW VARIABLES to work */
-extern my_bool innobase_log_archive,
- innobase_use_doublewrite,
- innobase_use_checksums,
- innobase_use_large_pages,
- innobase_use_native_aio,
- innobase_file_per_table, innobase_locks_unsafe_for_binlog,
- innobase_create_status_file;
-extern "C" {
-extern ulong srv_max_buf_pool_modified_pct;
-extern ulong srv_max_purge_lag;
-extern ulong srv_auto_extend_increment;
-extern ulong srv_n_spin_wait_rounds;
-extern ulong srv_n_free_tickets_to_enter;
-extern ulong srv_thread_sleep_delay;
-extern ulong srv_thread_concurrency;
-extern ulong srv_commit_concurrency;
-extern ulong srv_flush_log_at_trx_commit;
-}
-#endif
+handlerton *heap_hton= NULL;
+handlerton *myisam_hton= NULL;
+handlerton *partition_hton= NULL;
+
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
const char *opt_ndbcluster_connectstring= 0;
@@ -702,10 +655,13 @@
/* Function declarations */
+static void usage(void);
+static int setup_status_vars(void);
static void start_signal_handler(void);
pthread_handler_t signal_hand(void *arg);
static void mysql_init_variables(void);
static void get_options(int argc,char **argv);
+static my_bool get_one_option(int, const struct my_option *, char *);
static void set_server_version(void);
static int init_thread_environment();
static char *get_relative_path(const char *path);
@@ -1143,6 +1099,8 @@
extern "C" void unireg_abort(int exit_code)
{
DBUG_ENTER("unireg_abort");
+ if (opt_help)
+ usage();
if (exit_code)
sql_print_error("Aborting\n");
clean_up(exit_code || !opt_bootstrap); /* purecov: inspected */
@@ -2654,7 +2612,7 @@
Later, in plugin_init, and mysql_install_plugin
new entries could be added to that list.
*/
- if (add_status_vars(status_vars))
+ if (setup_status_vars())
return 1; // an error was already reported
load_defaults(conf_file_name, groups, &argc, &argv);
@@ -2671,10 +2629,6 @@
{
my_use_large_pages= 1;
my_large_page_size= opt_large_page_size;
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
- innobase_use_large_pages= 1;
- innobase_large_page_size= opt_large_page_size;
-#endif
}
#endif /* HAVE_LARGE_PAGES */
@@ -2737,7 +2691,12 @@
if (item_create_init())
return 1;
item_init();
- set_var_init();
+ if (set_var_init())
+ return 1;
+#ifdef HAVE_REPLICATION
+ if (init_replication_sys_vars())
+ return 1;
+#endif
mysys_uses_curses=0;
#ifdef USE_REGEX
my_regex_init(&my_charset_latin1);
@@ -3225,10 +3184,22 @@
using_update_log=1;
}
- if (plugin_init(opt_bootstrap))
+ if (plugin_init(defaults_argv,
+ (opt_noacl ? PLUGIN_INIT_SKIP_PLUGIN_TABLE : 0) |
+ (opt_help ? PLUGIN_INIT_SKIP_INITIALIZATION : 0)))
{
sql_print_error("Failed to init plugins.");
- return 1;
+ unireg_abort(1);
+ }
+
+ if (opt_help)
+ unireg_abort(0);
+
+ /* we do want to exit if there are any other unknown options */
+ if (defaults_argv && defaults_argv[1]) /* position 0 is the program name */
+ {
+ fprintf(stderr, "%s: Too many arguments (first extra is '%s').\nUse --help to get a
list of available options\n", my_progname, defaults_argv[1]);
+ unireg_abort(1);
}
/* We have to initialize the storage engines before CSV logging */
@@ -3259,7 +3230,8 @@
else
{
/* fall back to the log files if tables are not present */
- if (have_csv_db == SHOW_OPTION_NO)
+ LEX_STRING csv_name={C_STRING_WITH_LEN("csv")};
+ if (!plugin_is_ready(&csv_name, MYSQL_STORAGE_ENGINE_PLUGIN))
{
/* purecov: begin inspected */
sql_print_error("CSV engine is not present, falling back to the "
@@ -4689,11 +4661,6 @@
OPT_STORAGE_ENGINE, OPT_INIT_FILE,
OPT_DELAY_KEY_WRITE_ALL, OPT_SLOW_QUERY_LOG,
OPT_DELAY_KEY_WRITE, OPT_CHARSETS_DIR,
- OPT_BDB_HOME, OPT_BDB_LOG,
- OPT_BDB_TMP, OPT_BDB_SYNC,
- OPT_BDB_LOCK, OPT_BDB,
- OPT_BDB_NO_RECOVER, OPT_BDB_SHARED,
- OPT_BDB_DATA_DIRECT, OPT_BDB_LOG_DIRECT,
OPT_MASTER_HOST, OPT_MASTER_USER,
OPT_MASTER_PASSWORD, OPT_MASTER_PORT,
OPT_MASTER_INFO_FILE, OPT_MASTER_CONNECT_RETRY,
@@ -4714,29 +4681,15 @@
OPT_WANT_CORE, OPT_CONCURRENT_INSERT,
OPT_MEMLOCK, OPT_MYISAM_RECOVER,
OPT_REPLICATE_REWRITE_DB, OPT_SERVER_ID,
- OPT_SKIP_SLAVE_START, OPT_SKIP_INNOBASE,
+ OPT_SKIP_SLAVE_START, OPT_SAFE_SHOW_DB,
OPT_SAFEMALLOC_MEM_LIMIT, OPT_REPLICATE_DO_TABLE,
OPT_REPLICATE_IGNORE_TABLE, OPT_REPLICATE_WILD_DO_TABLE,
OPT_REPLICATE_WILD_IGNORE_TABLE, OPT_REPLICATE_SAME_SERVER_ID,
OPT_DISCONNECT_SLAVE_EVENT_COUNT, OPT_TC_HEURISTIC_RECOVER,
OPT_ABORT_SLAVE_EVENT_COUNT,
- OPT_INNODB_DATA_HOME_DIR,
- OPT_INNODB_DATA_FILE_PATH,
- OPT_INNODB_LOG_GROUP_HOME_DIR,
- OPT_INNODB_LOG_ARCH_DIR,
- OPT_INNODB_LOG_ARCHIVE,
- OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT,
- OPT_INNODB_FLUSH_METHOD,
- OPT_INNODB_DOUBLEWRITE,
- OPT_INNODB_CHECKSUMS,
- OPT_INNODB_FAST_SHUTDOWN,
- OPT_INNODB_FILE_PER_TABLE, OPT_CRASH_BINLOG_INNODB,
- OPT_INNODB_LOCKS_UNSAFE_FOR_BINLOG,
OPT_LOG_BIN_TRUST_FUNCTION_CREATORS,
- OPT_SAFE_SHOW_DB, OPT_INNODB_SAFE_BINLOG,
- OPT_INNODB, OPT_ISAM,
OPT_ENGINE_CONDITION_PUSHDOWN,
- OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, OPT_NDB_USE_EXACT_COUNT,
+ OPT_NDB_CONNECTSTRING, OPT_NDB_USE_EXACT_COUNT,
OPT_NDB_FORCE_SEND, OPT_NDB_AUTOINCREMENT_PREFETCH_SZ,
OPT_NDB_SHM, OPT_NDB_OPTIMIZED_NODE_SELECTION, OPT_NDB_CACHE_CHECK_TIME,
OPT_NDB_MGMD, OPT_NDB_NODEID,
@@ -4798,33 +4751,6 @@
OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE,
OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK,
OPT_WAIT_TIMEOUT, OPT_MYISAM_REPAIR_THREADS,
- OPT_INNODB_MIRRORED_LOG_GROUPS,
- OPT_INNODB_LOG_FILES_IN_GROUP,
- OPT_INNODB_LOG_FILE_SIZE,
- OPT_INNODB_LOG_BUFFER_SIZE,
- OPT_INNODB_BUFFER_POOL_SIZE,
- OPT_INNODB_BUFFER_POOL_AWE_MEM_MB,
- OPT_INNODB_ADDITIONAL_MEM_POOL_SIZE,
- OPT_INNODB_MAX_PURGE_LAG,
- OPT_INNODB_FILE_IO_THREADS,
- OPT_INNODB_LOCK_WAIT_TIMEOUT,
- OPT_INNODB_THREAD_CONCURRENCY,
- OPT_INNODB_COMMIT_CONCURRENCY,
- OPT_INNODB_FORCE_RECOVERY,
- OPT_INNODB_STATUS_FILE,
- OPT_INNODB_MAX_DIRTY_PAGES_PCT,
- OPT_INNODB_TABLE_LOCKS,
- OPT_INNODB_SUPPORT_XA,
- OPT_INNODB_OPEN_FILES,
- OPT_INNODB_AUTOEXTEND_INCREMENT,
- OPT_INNODB_SYNC_SPIN_LOOPS,
- OPT_INNODB_CONCURRENCY_TICKETS,
- OPT_INNODB_THREAD_SLEEP_DELAY,
- OPT_BDB_CACHE_SIZE,
- OPT_BDB_CACHE_PARTS,
- OPT_BDB_LOG_BUFFER_SIZE,
- OPT_BDB_MAX_LOCK,
- OPT_BDB_REGION_SIZE,
OPT_ERROR_LOG_FILE,
OPT_DEFAULT_WEEK_FORMAT,
OPT_RANGE_ALLOC_BLOCK_SIZE, OPT_ALLOW_SUSPICIOUS_UDFS,
@@ -4834,7 +4760,6 @@
OPT_SYNC_REPLICATION,
OPT_SYNC_REPLICATION_SLAVE_ID,
OPT_SYNC_REPLICATION_TIMEOUT,
- OPT_BDB_NOSYNC,
OPT_ENABLE_SHARED_MEMORY,
OPT_SHARED_MEMORY_BASE_NAME,
OPT_OLD_PASSWORDS,
@@ -4864,12 +4789,12 @@
OPT_OLD_STYLE_USER_LIMITS,
OPT_LOG_SLOW_ADMIN_STATEMENTS,
OPT_TABLE_LOCK_WAIT_TIMEOUT,
+ OPT_PLUGIN_LOAD,
OPT_PLUGIN_DIR,
OPT_LOG_OUTPUT,
OPT_PORT_OPEN_TIMEOUT,
OPT_GENERAL_LOG,
OPT_SLOW_LOG,
- OPT_MERGE
};
@@ -5093,90 +5018,6 @@
{"init-slave", OPT_INIT_SLAVE, "Command(s) that are executed when a slave connects to
this master",
(gptr*) &opt_init_slave, (gptr*) &opt_init_slave, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"innodb", OPT_INNODB, "Enable InnoDB (if this version of MySQL supports it). \
-Disable with --skip-innodb (will save memory).",
- (gptr*) &opt_innodb, (gptr*) &opt_innodb, 0, GET_BOOL, NO_ARG,
OPT_INNODB_DEFAULT, 0, 0,
- 0, 0, 0},
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
- {"innodb_checksums", OPT_INNODB_CHECKSUMS, "Enable InnoDB checksums validation (enabled
by default). \
-Disable with --skip-innodb-checksums.", (gptr*) &innobase_use_checksums,
- (gptr*) &innobase_use_checksums, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
-#endif
- {"innodb_data_file_path", OPT_INNODB_DATA_FILE_PATH,
- "Path to individual files and their sizes.",
- 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
- {"innodb_data_home_dir", OPT_INNODB_DATA_HOME_DIR,
- "The common part for InnoDB table spaces.", (gptr*) &innobase_data_home_dir,
- (gptr*) &innobase_data_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0,
- 0},
- {"innodb_doublewrite", OPT_INNODB_DOUBLEWRITE, "Enable InnoDB doublewrite buffer
(enabled by default). \
-Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite,
- (gptr*) &innobase_use_doublewrite, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
- {"innodb_fast_shutdown", OPT_INNODB_FAST_SHUTDOWN,
- "Speeds up the shutdown process of the InnoDB storage engine. Possible "
- "values are 0, 1 (faster)"
- /*
- NetWare can't close unclosed files, can't automatically kill remaining
- threads, etc, so on this OS we disable the crash-like InnoDB shutdown.
- */
-#ifndef __NETWARE__
- " or 2 (fastest - crash-like)"
-#endif
- ".",
- (gptr*) &innobase_fast_shutdown,
- (gptr*) &innobase_fast_shutdown, 0, GET_ULONG, OPT_ARG, 1, 0,
- IF_NETWARE(1,2), 0, 0, 0},
- {"innodb_file_per_table", OPT_INNODB_FILE_PER_TABLE,
- "Stores each InnoDB table to an .ibd file in the database dir.",
- (gptr*) &innobase_file_per_table,
- (gptr*) &innobase_file_per_table, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"innodb_flush_log_at_trx_commit", OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT,
- "Set to 0 (write and flush once per second), 1 (write and flush at each commit) or 2
(write at commit, flush once per second).",
- (gptr*) &srv_flush_log_at_trx_commit,
- (gptr*) &srv_flush_log_at_trx_commit,
- 0, GET_ULONG, OPT_ARG, 1, 0, 2, 0, 0, 0},
- {"innodb_flush_method", OPT_INNODB_FLUSH_METHOD,
- "With which method to flush data.", (gptr*) &innobase_unix_file_flush_method,
- (gptr*) &innobase_unix_file_flush_method, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
- 0, 0, 0},
- {"innodb_locks_unsafe_for_binlog", OPT_INNODB_LOCKS_UNSAFE_FOR_BINLOG,
- "Force InnoDB to not use next-key locking, to use only row-level locking.",
- (gptr*) &innobase_locks_unsafe_for_binlog,
- (gptr*) &innobase_locks_unsafe_for_binlog, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"innodb_log_arch_dir", OPT_INNODB_LOG_ARCH_DIR,
- "Where full logs should be archived.", (gptr*) &innobase_log_arch_dir,
- (gptr*) &innobase_log_arch_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"innodb_log_archive", OPT_INNODB_LOG_ARCHIVE,
- "Set to 1 if you want to have logs archived.", 0, 0, 0, GET_LONG, OPT_ARG,
- 0, 0, 0, 0, 0, 0},
- {"innodb_log_group_home_dir", OPT_INNODB_LOG_GROUP_HOME_DIR,
- "Path to InnoDB log files.", (gptr*) &innobase_log_group_home_dir,
- (gptr*) &innobase_log_group_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
- 0, 0},
- {"innodb_max_dirty_pages_pct", OPT_INNODB_MAX_DIRTY_PAGES_PCT,
- "Percentage of dirty pages allowed in bufferpool.", (gptr*)
&srv_max_buf_pool_modified_pct,
- (gptr*) &srv_max_buf_pool_modified_pct, 0, GET_ULONG, REQUIRED_ARG, 90, 0, 100, 0,
0, 0},
- {"innodb_max_purge_lag", OPT_INNODB_MAX_PURGE_LAG,
- "Desired maximum length of the purge queue (0 = no limit)",
- (gptr*) &srv_max_purge_lag,
- (gptr*) &srv_max_purge_lag, 0, GET_LONG, REQUIRED_ARG, 0, 0, ~0L,
- 0, 1L, 0},
- {"innodb_status_file", OPT_INNODB_STATUS_FILE,
- "Enable SHOW INNODB STATUS output in the innodb_status.<pid> file",
- (gptr*) &innobase_create_status_file, (gptr*) &innobase_create_status_file,
- 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
- {"innodb_support_xa", OPT_INNODB_SUPPORT_XA,
- "Enable InnoDB support for the XA two-phase commit",
- (gptr*) &global_system_variables.innodb_support_xa,
- (gptr*) &global_system_variables.innodb_support_xa,
- 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
- {"innodb_table_locks", OPT_INNODB_TABLE_LOCKS,
- "Enable InnoDB locking in LOCK TABLES",
- (gptr*) &global_system_variables.innodb_table_locks,
- (gptr*) &global_system_variables.innodb_table_locks,
- 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
-#endif /* End WITH_INNOBASE_STORAGE_ENGINE */
{"language", 'L',
"Client error messages in given language. May be given as a full path.",
(gptr*) &language_ptr, (gptr*) &language_ptr, 0, GET_STR, REQUIRED_ARG,
@@ -5352,10 +5193,6 @@
"Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP,
FORCE or QUICK.",
(gptr*) &myisam_recover_options_str, (gptr*) &myisam_recover_options_str, 0,
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
- {"ndbcluster", OPT_NDBCLUSTER, "Enable NDB Cluster (if this version of MySQL supports
it). \
-Disable with --skip-ndbcluster (will save memory).",
- (gptr*) &opt_ndbcluster, (gptr*) &opt_ndbcluster, 0, GET_BOOL, NO_ARG,
- OPT_NDBCLUSTER_DEFAULT, 0, 0, 0, 0, 0},
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
{"ndb-connectstring", OPT_NDB_CONNECTSTRING,
"Connect string for ndbcluster.",
@@ -5795,84 +5632,6 @@
(gptr*) &global_system_variables.group_concat_max_len,
(gptr*) &max_system_variables.group_concat_max_len, 0, GET_ULONG,
REQUIRED_ARG, 1024, 4, (long) ~0, 0, 1, 0},
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
- {"innodb_additional_mem_pool_size", OPT_INNODB_ADDITIONAL_MEM_POOL_SIZE,
- "Size of a memory pool InnoDB uses to store data dictionary information and other
internal data structures.",
- (gptr*) &innobase_additional_mem_pool_size,
- (gptr*) &innobase_additional_mem_pool_size, 0, GET_LONG, REQUIRED_ARG,
- 1*1024*1024L, 512*1024L, ~0L, 0, 1024, 0},
- {"innodb_autoextend_increment", OPT_INNODB_AUTOEXTEND_INCREMENT,
- "Data file autoextend increment in megabytes",
- (gptr*) &srv_auto_extend_increment,
- (gptr*) &srv_auto_extend_increment,
- 0, GET_LONG, REQUIRED_ARG, 8L, 1L, 1000L, 0, 1L, 0},
- {"innodb_buffer_pool_size", OPT_INNODB_BUFFER_POOL_SIZE,
- "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
- (gptr*) &innobase_buffer_pool_size, (gptr*) &innobase_buffer_pool_size, 0,
- GET_LL, REQUIRED_ARG, 8*1024*1024L, 1024*1024L, LONGLONG_MAX, 0,
- 1024*1024L, 0},
- {"innodb_commit_concurrency", OPT_INNODB_COMMIT_CONCURRENCY,
- "Helps in performance tuning in heavily concurrent environments.",
- (gptr*) &srv_commit_concurrency, (gptr*) &srv_commit_concurrency,
- 0, GET_LONG, REQUIRED_ARG, 0, 0, 1000, 0, 1, 0},
- {"innodb_concurrency_tickets", OPT_INNODB_CONCURRENCY_TICKETS,
- "Number of times a thread is allowed to enter InnoDB within the same \
- SQL query after it has once got the ticket",
- (gptr*) &srv_n_free_tickets_to_enter,
- (gptr*) &srv_n_free_tickets_to_enter,
- 0, GET_LONG, REQUIRED_ARG, 500L, 1L, ~0L, 0, 1L, 0},
- {"innodb_file_io_threads", OPT_INNODB_FILE_IO_THREADS,
- "Number of file I/O threads in InnoDB.", (gptr*) &innobase_file_io_threads,
- (gptr*) &innobase_file_io_threads, 0, GET_LONG, REQUIRED_ARG, 4, 4, 64, 0,
- 1, 0},
- {"innodb_force_recovery", OPT_INNODB_FORCE_RECOVERY,
- "Helps to save your data in case the disk image of the database becomes corrupt.",
- (gptr*) &innobase_force_recovery, (gptr*) &innobase_force_recovery, 0,
- GET_LONG, REQUIRED_ARG, 0, 0, 6, 0, 1, 0},
- {"innodb_lock_wait_timeout", OPT_INNODB_LOCK_WAIT_TIMEOUT,
- "Timeout in seconds an InnoDB transaction may wait for a lock before being rolled
back.",
- (gptr*) &innobase_lock_wait_timeout, (gptr*) &innobase_lock_wait_timeout,
- 0, GET_LONG, REQUIRED_ARG, 50, 1, 1024 * 1024 * 1024, 0, 1, 0},
- {"innodb_log_buffer_size", OPT_INNODB_LOG_BUFFER_SIZE,
- "The size of the buffer which InnoDB uses to write log to the log files on disk.",
- (gptr*) &innobase_log_buffer_size, (gptr*) &innobase_log_buffer_size, 0,
- GET_LONG, REQUIRED_ARG, 1024*1024L, 256*1024L, ~0L, 0, 1024, 0},
- {"innodb_log_file_size", OPT_INNODB_LOG_FILE_SIZE,
- "Size of each log file in a log group.",
- (gptr*) &innobase_log_file_size, (gptr*) &innobase_log_file_size, 0,
- GET_LL, REQUIRED_ARG, 5*1024*1024L, 1*1024*1024L, LONGLONG_MAX, 0,
- 1024*1024L, 0},
- {"innodb_log_files_in_group", OPT_INNODB_LOG_FILES_IN_GROUP,
- "Number of log files in the log group. InnoDB writes to the files in a circular
fashion. Value 3 is recommended here.",
- (gptr*) &innobase_log_files_in_group, (gptr*) &innobase_log_files_in_group,
- 0, GET_LONG, REQUIRED_ARG, 2, 2, 100, 0, 1, 0},
- {"innodb_mirrored_log_groups", OPT_INNODB_MIRRORED_LOG_GROUPS,
- "Number of identical copies of log groups we keep for the database. Currently this
should be set to 1.",
- (gptr*) &innobase_mirrored_log_groups,
- (gptr*) &innobase_mirrored_log_groups, 0, GET_LONG, REQUIRED_ARG, 1, 1, 10,
- 0, 1, 0},
- {"innodb_open_files", OPT_INNODB_OPEN_FILES,
- "How many files at the maximum InnoDB keeps open at the same time.",
- (gptr*) &innobase_open_files, (gptr*) &innobase_open_files, 0,
- GET_LONG, REQUIRED_ARG, 300L, 10L, ~0L, 0, 1L, 0},
- {"innodb_sync_spin_loops", OPT_INNODB_SYNC_SPIN_LOOPS,
- "Count of spin-loop rounds in InnoDB mutexes",
- (gptr*) &srv_n_spin_wait_rounds,
- (gptr*) &srv_n_spin_wait_rounds,
- 0, GET_LONG, REQUIRED_ARG, 20L, 0L, ~0L, 0, 1L, 0},
- {"innodb_thread_concurrency", OPT_INNODB_THREAD_CONCURRENCY,
- "Helps in performance tuning in heavily concurrent environments. "
- "Sets the maximum number of threads allowed inside InnoDB. Value 0"
- " will disable the thread throttling.",
- (gptr*) &srv_thread_concurrency, (gptr*) &srv_thread_concurrency,
- 0, GET_LONG, REQUIRED_ARG, 8, 0, 1000, 0, 1, 0},
- {"innodb_thread_sleep_delay", OPT_INNODB_THREAD_SLEEP_DELAY,
- "Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0"
- " disable a sleep",
- (gptr*) &srv_thread_sleep_delay,
- (gptr*) &srv_thread_sleep_delay,
- 0, GET_LONG, REQUIRED_ARG, 10000L, 0L, ~0L, 0, 1L, 0},
-#endif /* WITH_INNOBASE_STORAGE_ENGINE */
{"interactive_timeout", OPT_INTERACTIVE_TIMEOUT,
"The number of seconds the server waits for activity on an interactive connection
before closing it.",
(gptr*) &global_system_variables.net_interactive_timeout,
@@ -6098,6 +5857,11 @@
"Directory for plugins.",
(gptr*) &opt_plugin_dir_ptr, (gptr*) &opt_plugin_dir_ptr, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"plugin_load", OPT_PLUGIN_LOAD,
+ "Optional colon seperated list of plugins to load, where each plugin is "
+ "identified by name and path to library seperated by an equals.",
+ (gptr*) &opt_plugin_load, (gptr*) &opt_plugin_load, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"preload_buffer_size", OPT_PRELOAD_BUFFER_SIZE,
"The size of the buffer that is allocated when preloading indexes",
(gptr*) &global_system_variables.preload_buff_size,
@@ -6613,7 +6377,7 @@
Variables shown by SHOW STATUS in alphabetical order
*/
-SHOW_VAR status_vars[]= {
+static SHOW_VAR status_vars[]= {
{"Aborted_clients", (char*) &aborted_threads, SHOW_LONG},
{"Aborted_connects", (char*) &aborted_connects, SHOW_LONG},
{"Binlog_cache_disk_use", (char*) &binlog_cache_disk_use, SHOW_LONG},
@@ -6887,8 +6651,8 @@
fix_paths();
set_ports();
- my_print_help(my_long_options);
- my_print_variables(my_long_options);
+ /* Print out all the options including plugin supplied options */
+ my_print_help_inc_plugins(my_long_options, sizeof(my_long_options)/sizeof(my_option));
puts("\n\
To see what values a running MySQL server is using, type\n\
@@ -7038,41 +6802,18 @@
"d:t:i:o,/tmp/mysqld.trace");
#endif
opt_error_log= IF_WIN(1,0);
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
- have_innodb= SHOW_OPTION_YES;
-#else
- have_innodb= SHOW_OPTION_NO;
-#endif
-#ifdef WITH_CSV_STORAGE_ENGINE
- have_csv_db= SHOW_OPTION_YES;
-#else
- have_csv_db= SHOW_OPTION_NO;
-#endif
-#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
- have_ndbcluster= SHOW_OPTION_DISABLED;
-#else
- have_ndbcluster= SHOW_OPTION_NO;
-#endif
-#ifdef WITH_PARTITION_STORAGE_ENGINE
- have_partition_db= SHOW_OPTION_YES;
-#else
- have_partition_db= SHOW_OPTION_NO;
-#endif
#ifdef HAVE_ROW_BASED_REPLICATION
have_row_based_replication= SHOW_OPTION_YES;
#else
have_row_based_replication= SHOW_OPTION_NO;
#endif
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
- have_ndbcluster=SHOW_OPTION_DISABLED;
global_system_variables.ndb_index_stat_enable=FALSE;
max_system_variables.ndb_index_stat_enable=TRUE;
global_system_variables.ndb_index_stat_cache_entries=32;
max_system_variables.ndb_index_stat_cache_entries=~0L;
global_system_variables.ndb_index_stat_update_freq=20;
max_system_variables.ndb_index_stat_update_freq=~0L;
-#else
- have_ndbcluster=SHOW_OPTION_NO;
#endif
#ifdef HAVE_OPENSSL
have_openssl=SHOW_OPTION_YES;
@@ -7544,17 +7285,6 @@
global_system_variables.tx_isolation= (type-1);
break;
}
- case OPT_MERGE:
- case OPT_BDB:
- break;
- case OPT_NDBCLUSTER:
-#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
- if (opt_ndbcluster)
- have_ndbcluster= SHOW_OPTION_YES;
- else
- have_ndbcluster= SHOW_OPTION_DISABLED;
-#endif
- break;
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
case OPT_NDB_MGMD:
case OPT_NDB_NODEID:
@@ -7602,24 +7332,6 @@
ndb_extra_logging= atoi(argument);
break;
#endif
- case OPT_INNODB:
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
- if (opt_innodb)
- have_innodb= SHOW_OPTION_YES;
- else
- have_innodb= SHOW_OPTION_DISABLED;
-#endif
- break;
- case OPT_INNODB_DATA_FILE_PATH:
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
- innobase_data_file_path= argument;
-#endif
- break;
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
- case OPT_INNODB_LOG_ARCHIVE:
- innobase_log_archive= argument ? test(atoi(argument)) : 1;
- break;
-#endif /* WITH_INNOBASE_STORAGE_ENGINE */
case OPT_MYISAM_RECOVER:
{
if (!argument || !argument[0])
@@ -7764,34 +7476,18 @@
strmake(def_ft_boolean_syntax, ft_boolean_syntax,
sizeof(ft_boolean_syntax)-1);
my_getopt_error_reporter= option_error_reporter;
+
+ /* Skip unknown options so that they may be processed later by plugins */
+ my_getopt_skip_unknown= TRUE;
+
if ((ho_error= handle_options(&argc, &argv, my_long_options,
get_one_option)))
exit(ho_error);
-#ifndef WITH_NDBCLUSTER_STORAGE_ENGINE
- if (opt_ndbcluster)
- sql_print_warning("this binary does not contain NDBCLUSTER storage engine");
-#endif
-#ifndef WITH_INNOBASE_STORAGE_ENGINE
- if (opt_innodb)
- sql_print_warning("this binary does not contain INNODB storage engine");
-#endif
if ((opt_log_slow_admin_statements || opt_log_queries_not_using_indexes) &&
!opt_slow_log)
sql_print_warning("options --log-slow-admin-statements and
--log-queries-not-using-indexes have no effect if --log-slow-queries is not set");
- if (argc > 0)
- {
- fprintf(stderr, "%s: Too many arguments (first extra is '%s').\nUse --help to get a
list of available options\n", my_progname, *argv);
- /* FIXME add EXIT_TOO_MANY_ARGUMENTS to "mysys_err.h" and return that code? */
- exit(1);
- }
-
- if (opt_help)
- {
- usage();
- exit(0);
- }
#if defined(HAVE_BROKEN_REALPATH)
my_use_symdir=0;
my_disable_symlinks=1;
@@ -8084,6 +7780,15 @@
}
+static int setup_status_vars(void)
+{
+ /*
+ eventually, this will have more, where specific status vars are moved
+ to relevent source files.
+ */
+ return add_status_vars(status_vars);
+}
+
/* Clear most status variables */
void refresh_status(THD *thd)
{
@@ -8096,12 +7801,7 @@
bzero((char*) &thd->status_var, sizeof(thd->status_var));
/* Reset some global variables */
- for (SHOW_VAR *ptr= status_vars; ptr->name; ptr++)
- {
- /* Note that SHOW_LONG_NOFLUSH variables are not reset */
- if (ptr->type == SHOW_LONG)
- *(ulong*) ptr->value= 0;
- }
+ reset_status_vars();
/* Reset the counters of all key caches (default and named). */
process_key_caches(reset_key_cache_counters);
@@ -8120,49 +7820,8 @@
/*****************************************************************************
- Instantiate have_xyx for missing storage engines
+ Instantiate variables for missing storage engines
*****************************************************************************/
-#undef have_innodb
-#undef have_ndbcluster
-#undef have_csv_db
-
-SHOW_COMP_OPTION have_innodb= SHOW_OPTION_NO;
-SHOW_COMP_OPTION have_ndbcluster= SHOW_OPTION_NO;
-SHOW_COMP_OPTION have_csv_db= SHOW_OPTION_NO;
-SHOW_COMP_OPTION have_partition_db= SHOW_OPTION_NO;
-
-#ifndef WITH_INNOBASE_STORAGE_ENGINE
-uint innobase_flush_log_at_trx_commit;
-ulong innobase_fast_shutdown;
-long innobase_mirrored_log_groups, innobase_log_files_in_group;
-longlong innobase_log_file_size;
-long innobase_log_buffer_size;
-longlong innobase_buffer_pool_size;
-long innobase_additional_mem_pool_size;
-long innobase_file_io_threads, innobase_lock_wait_timeout;
-long innobase_force_recovery;
-long innobase_open_files;
-char *innobase_data_home_dir, *innobase_data_file_path;
-char *innobase_log_group_home_dir, *innobase_log_arch_dir;
-char *innobase_unix_file_flush_method;
-my_bool innobase_log_archive,
- innobase_use_doublewrite,
- innobase_use_checksums,
- innobase_file_per_table,
- innobase_locks_unsafe_for_binlog;
-
-extern "C" {
-ulong srv_max_buf_pool_modified_pct;
-ulong srv_max_purge_lag;
-ulong srv_auto_extend_increment;
-ulong srv_n_spin_wait_rounds;
-ulong srv_n_free_tickets_to_enter;
-ulong srv_thread_sleep_delay;
-ulong srv_thread_concurrency;
-ulong srv_commit_concurrency;
-}
-
-#endif
#ifndef WITH_NDBCLUSTER_STORAGE_ENGINE
ulong ndb_cache_check_time;
--- 1.304/sql/sql_class.cc 2006-12-21 16:54:34 -08:00
+++ 1.305/sql/sql_class.cc 2006-12-21 16:54:34 -08:00
@@ -326,6 +326,10 @@
{
pthread_mutex_lock(&LOCK_global_system_variables);
variables= global_system_variables;
+ /* we are going to allocate these lazily */
+ variables.dynamic_variables_version= 0;
+ variables.dynamic_variables_size= 0;
+ variables.dynamic_variables_ptr= 0;
variables.time_format= date_time_format_copy((THD*) 0,
variables.time_format);
variables.date_format= date_time_format_copy((THD*) 0,
@@ -475,6 +479,7 @@
cleanup();
ha_close_connection(this);
+ mysql_pluginvar_cleanup(this);
DBUG_PRINT("info", ("freeing security context"));
main_security_ctx.destroy();
--- 1.332/sql/sql_class.h 2006-12-21 16:54:34 -08:00
+++ 1.333/sql/sql_class.h 2006-12-21 16:54:34 -08:00
@@ -181,6 +181,19 @@
struct system_variables
{
+ /*
+ How dynamically allocated system variables are handled:
+
+ The global_system_variables and max_system_variables are "authoritative"
+ They both should have the same 'version' and 'size'.
+ When attempting to access a dynamic variable, if the session version
+ 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.
+ */
+ ulong dynamic_variables_version;
+ char* dynamic_variables_ptr;
+ uint dynamic_variables_size;
+
ulonglong myisam_max_extra_sort_file_size;
ulonglong myisam_max_sort_file_size;
ulonglong max_heap_table_size;
@@ -242,8 +255,6 @@
my_bool new_mode;
my_bool query_cache_wlock_invalidate;
my_bool engine_condition_pushdown;
- my_bool innodb_table_locks;
- my_bool innodb_support_xa;
my_bool ndb_force_send;
my_bool ndb_use_copying_alter_table;
my_bool ndb_use_exact_count;
--- 1.612/sql/sql_parse.cc 2006-12-21 16:54:34 -08:00
+++ 1.613/sql/sql_parse.cc 2006-12-21 16:54:34 -08:00
@@ -1905,7 +1905,6 @@
TABLE_LIST table_list;
LEX_STRING conv_name;
/* Saved variable value */
- my_bool old_innodb_table_locks= thd->variables.innodb_table_locks;
uint dummy;
/* used as fields initializator */
--- 1.379/sql/sql_show.cc 2006-12-21 16:54:34 -08:00
+++ 1.380/sql/sql_show.cc 2006-12-21 16:54:34 -08:00
@@ -1936,6 +1936,18 @@
sort_dynamic(&all_status_vars, show_var_cmp);
}
+void reset_status_vars()
+{
+ SHOW_VAR *ptr= (SHOW_VAR*) all_status_vars.buffer;
+ SHOW_VAR *last= ptr + all_status_vars.elements;
+ for (; ptr < last; ptr++)
+ {
+ /* Note that SHOW_LONG_NOFLUSH variables are not reset */
+ if (ptr->type == SHOW_LONG)
+ *(ulong*) ptr->value= 0;
+ }
+}
+
/*
catch-all cleanup function, cleans up everything no matter what
@@ -4416,7 +4428,7 @@
LEX *lex= thd->lex;
const char *wild= lex->wild ? lex->wild->ptr() : NullS;
pthread_mutex_lock(&LOCK_global_system_variables);
- res= show_status_array(thd, wild, init_vars,
+ res= show_status_array(thd, wild, enumerate_sys_vars(thd, TRUE),
lex->option_type, 0, "", tables->table, 0);
pthread_mutex_unlock(&LOCK_global_system_variables);
DBUG_RETURN(res);
@@ -5187,7 +5199,7 @@
DBUG_ENTER("fill_schema_global_variables");
pthread_mutex_lock(&LOCK_global_system_variables);
- res= show_status_array(thd, "", init_vars, OPT_GLOBAL,
+ res= show_status_array(thd, "", enumerate_sys_vars(thd, FALSE), OPT_GLOBAL,
NULL, "", tables->table, 1);
pthread_mutex_unlock(&LOCK_global_system_variables);
@@ -5200,7 +5212,7 @@
DBUG_ENTER("fill_schema_session_variables");
pthread_mutex_lock(&LOCK_global_system_variables);
- res= show_status_array(thd, "", init_vars, OPT_SESSION,
+ res= show_status_array(thd, "", enumerate_sys_vars(thd, FALSE), OPT_SESSION,
NULL, "", tables->table, 1);
pthread_mutex_unlock(&LOCK_global_system_variables);
--- 1.17/include/my_getopt.h 2006-12-21 16:54:34 -08:00
+++ 1.18/include/my_getopt.h 2006-12-21 16:54:34 -08:00
@@ -51,7 +51,7 @@
longlong max_value; /* Max allowed value */
longlong sub_size; /* Subtract this from given value */
long block_size; /* Value should be a mult. of this */
- int app_type; /* To be used by an application */
+ long app_type; /* To be used by an application */
};
typedef my_bool (* my_get_one_option) (int, const struct my_option *, char * );
@@ -59,6 +59,7 @@
extern char *disabled_my_option;
extern my_bool my_getopt_print_errors;
+extern my_bool my_getopt_skip_unknown;
extern my_error_reporter my_getopt_error_reporter;
extern int handle_options (int *argc, char ***argv,
--- 1.59/mysys/my_getopt.c 2006-12-21 16:54:34 -08:00
+++ 1.60/mysys/my_getopt.c 2006-12-21 16:54:34 -08:00
@@ -59,6 +59,13 @@
my_bool my_getopt_print_errors= 1;
+/*
+ This is a flag that can be set in client programs. 1 neabs rgar
+ my_getopt will skip over options it does not know how to handle.
+*/
+
+my_bool my_getopt_skip_unknown= 0;
+
static void default_reporter(enum loglevel level,
const char *format, ...)
{
@@ -111,6 +118,7 @@
for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++)
{
+ char **first= pos;
char *cur_arg= *pos;
if (cur_arg[0] == '-' && cur_arg[1] && !end_of_options) /* must be
opt */
{
@@ -259,6 +267,14 @@
}
if (!opt_found)
{
+ if (my_getopt_skip_unknown)
+ {
+ /* preserve all the components of this unknown option */
+ do {
+ (*argv)[argvpos++]= *first++;
+ } while (first <= pos);
+ continue;
+ }
if (must_be_var)
{
if (my_getopt_print_errors)
--- 1.254/mysql-test/mysql-test-run.pl 2006-12-21 16:54:34 -08:00
+++ 1.255/mysql-test/mysql-test-run.pl 2006-12-21 16:54:34 -08:00
@@ -2850,8 +2850,8 @@
mtr_add_arg($args, "--skip-grant-tables");
mtr_add_arg($args, "--basedir=%s", $path_my_basedir);
mtr_add_arg($args, "--datadir=%s", $data_dir);
- mtr_add_arg($args, "--skip-innodb");
- mtr_add_arg($args, "--skip-ndbcluster");
+ mtr_add_arg($args, "--skip-plugin-innodb");
+ mtr_add_arg($args, "--skip-plugin-ndbcluster");
mtr_add_arg($args, "--tmpdir=.");
mtr_add_arg($args, "--core-file");
@@ -2950,8 +2950,8 @@
basedir = $path_my_basedir
server_id = $server_id
skip-stack-trace
-skip-innodb
-skip-ndbcluster
+skip-plugin-innodb
+skip-plugin-ndbcluster
EOF
;
if ( $mysql_version_id < 50100 )
@@ -3580,18 +3580,18 @@
if ( $idx > 0 or !$use_innodb)
{
- mtr_add_arg($args, "%s--skip-innodb", $prefix);
+ mtr_add_arg($args, "%s--skip-plugin-innodb", $prefix);
}
my $cluster= $clusters->[$master->[$idx]->{'cluster'}];
if ( $opt_skip_ndbcluster ||
!$cluster->{'pid'})
{
- mtr_add_arg($args, "%s--skip-ndbcluster", $prefix);
+ mtr_add_arg($args, "%s--skip-plugin-ndbcluster", $prefix);
}
else
{
- mtr_add_arg($args, "%s--ndbcluster", $prefix);
+ mtr_add_arg($args, "%s--enable-plugin-ndbcluster", $prefix);
mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
$cluster->{'connect_string'});
if ( $mysql_version_id >= 50100 )
@@ -3638,8 +3638,8 @@
mtr_add_arg($args, "%s--report-port=%d", $prefix,
$slave->[$idx]->{'port'});
mtr_add_arg($args, "%s--report-user=root", $prefix);
- mtr_add_arg($args, "%s--skip-innodb", $prefix);
- mtr_add_arg($args, "%s--skip-ndbcluster", $prefix);
+ mtr_add_arg($args, "%s--skip-plugin-innodb", $prefix);
+ mtr_add_arg($args, "%s--skip-plugin-ndbcluster", $prefix);
mtr_add_arg($args, "%s--skip-slave-start", $prefix);
# Directory where slaves find the dumps generated by "load data"
@@ -3675,11 +3675,11 @@
$slave->[$idx]->{'cluster'} == -1 ||
!$clusters->[$slave->[$idx]->{'cluster'}]->{'pid'} )
{
- mtr_add_arg($args, "%s--skip-ndbcluster", $prefix);
+ mtr_add_arg($args, "%s--skip-plugin-ndbcluster", $prefix);
}
else
{
- mtr_add_arg($args, "%s--ndbcluster", $prefix);
+ mtr_add_arg($args, "%s--enable-plugin-ndbcluster", $prefix);
mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
$clusters->[$slave->[$idx]->{'cluster'}]->{'connect_string'});
if ( $mysql_version_id >= 50100 )
--- 1.375/sql/ha_ndbcluster.cc 2006-12-21 16:54:34 -08:00
+++ 1.376/sql/ha_ndbcluster.cc 2006-12-21 16:54:34 -08:00
@@ -2633,7 +2633,7 @@
DBUG_RETURN(peek_res);
}
- statistic_increment(thd->status_var.ha_write_count, &LOCK_status);
+ ha_statistic_increment(&SSV::ha_write_count);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time();
@@ -2853,7 +2853,7 @@
DBUG_RETURN(peek_res);
}
- statistic_increment(thd->status_var.ha_update_count, &LOCK_status);
+ ha_statistic_increment(&SSV::ha_update_count);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
{
table->timestamp_field->set_time();
@@ -3020,7 +3020,7 @@
DBUG_ENTER("delete_row");
m_write_op= TRUE;
- statistic_increment(thd->status_var.ha_delete_count,&LOCK_status);
+ ha_statistic_increment(&SSV::ha_delete_count);
m_rows_changed++;
if (m_use_partition_function &&
@@ -3378,7 +3378,7 @@
const byte *key, uint key_len,
enum ha_rkey_function find_flag)
{
- statistic_increment(current_thd->status_var.ha_read_key_count, &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_key_count);
DBUG_ENTER("ha_ndbcluster::index_read_idx");
DBUG_PRINT("enter", ("index_no: %u, key_len: %u", index_no, key_len));
close_scan();
@@ -3390,8 +3390,7 @@
int ha_ndbcluster::index_next(byte *buf)
{
DBUG_ENTER("ha_ndbcluster::index_next");
- statistic_increment(current_thd->status_var.ha_read_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_next_count);
DBUG_RETURN(next_result(buf));
}
@@ -3399,8 +3398,7 @@
int ha_ndbcluster::index_prev(byte *buf)
{
DBUG_ENTER("ha_ndbcluster::index_prev");
- statistic_increment(current_thd->status_var.ha_read_prev_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_prev_count);
DBUG_RETURN(next_result(buf));
}
@@ -3408,8 +3406,7 @@
int ha_ndbcluster::index_first(byte *buf)
{
DBUG_ENTER("ha_ndbcluster::index_first");
- statistic_increment(current_thd->status_var.ha_read_first_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_first_count);
// Start the ordered index scan and fetch the first row
// Only HA_READ_ORDER indexes get called by index_first
@@ -3420,7 +3417,7 @@
int ha_ndbcluster::index_last(byte *buf)
{
DBUG_ENTER("ha_ndbcluster::index_last");
- statistic_increment(current_thd->status_var.ha_read_last_count,&LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_last_count);
DBUG_RETURN(ordered_index_scan(0, 0, TRUE, TRUE, buf, NULL));
}
@@ -3603,8 +3600,7 @@
int ha_ndbcluster::rnd_next(byte *buf)
{
DBUG_ENTER("rnd_next");
- statistic_increment(current_thd->status_var.ha_read_rnd_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_rnd_next_count);
if (!m_active_cursor)
DBUG_RETURN(full_table_scan(buf));
@@ -3622,8 +3618,7 @@
int ha_ndbcluster::rnd_pos(byte *buf, byte *pos)
{
DBUG_ENTER("rnd_pos");
- statistic_increment(current_thd->status_var.ha_read_rnd_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_rnd_count);
// The primary key for the record is stored in pos
// Perform a pk_read using primary key "index"
{
@@ -6600,7 +6595,7 @@
{
handlerton *h= ndbcluster_hton;
- h->state= have_ndbcluster;
+ h->state= SHOW_OPTION_YES;
h->db_type= DB_TYPE_NDBCLUSTER;
h->close_connection= ndbcluster_close_connection;
h->commit= ndbcluster_commit;
@@ -6622,9 +6617,6 @@
h->table_exists_in_engine= ndbcluster_table_exists_in_engine;
}
- if (have_ndbcluster != SHOW_OPTION_YES)
- DBUG_RETURN(0); // nothing else to do
-
// Initialize ndb interface
ndb_init_internal();
@@ -6727,7 +6719,6 @@
if (g_ndb_cluster_connection)
delete g_ndb_cluster_connection;
g_ndb_cluster_connection= NULL;
- have_ndbcluster= SHOW_OPTION_DISABLED; // If we couldn't use handler
ndbcluster_hton->state= SHOW_OPTION_DISABLED; // If we couldn't use
handler
DBUG_RETURN(TRUE);
@@ -9989,10 +9980,6 @@
uint buflen;
DBUG_ENTER("ndbcluster_show_status");
- if (have_ndbcluster != SHOW_OPTION_YES)
- {
- DBUG_RETURN(FALSE);
- }
if (stat_type != HA_ENGINE_STATUS)
{
DBUG_RETURN(FALSE);
--- 1.313/storage/innobase/handler/ha_innodb.cc 2006-12-21 16:54:34 -08:00
+++ 1.314/storage/innobase/handler/ha_innodb.cc 2006-12-21 16:54:34 -08:00
@@ -217,6 +217,17 @@
static const char innobase_hton_name[]= "InnoDB";
+
+static MYSQL_THDVAR_BOOL(support_xa, PLUGIN_VAR_OPCMDARG,
+ "Enable InnoDB support for the XA two-phase commit",
+ /* check_func */ NULL, /* update_func */ NULL,
+ /* default */ TRUE);
+
+static MYSQL_THDVAR_BOOL(table_locks, PLUGIN_VAR_OPCMDARG,
+ "Enable InnoDB locking in LOCK TABLES",
+ /* check_func */ NULL, /* update_func */ NULL,
+ /* default */ TRUE);
+
static handler *innobase_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root)
@@ -870,7 +881,7 @@
/* Update the info whether we should skip XA steps that eat
CPU time */
- trx->support_xa = (ibool)(thd->variables.innodb_support_xa);
+ trx->support_xa = THDVAR(thd, support_xa);
thd->ha_data[hton->slot] = trx;
} else {
@@ -1354,7 +1365,7 @@
handlerton *innobase_hton= (handlerton *)p;
legacy_innodb_hton= innobase_hton;
- innobase_hton->state=have_innodb;
+ innobase_hton->state= SHOW_OPTION_YES;
innobase_hton->db_type= DB_TYPE_INNODB;
innobase_hton->savepoint_offset=sizeof(trx_named_savept_t);
innobase_hton->close_connection=innobase_close_connection;
@@ -1379,8 +1390,13 @@
innobase_hton->flags=HTON_NO_FLAGS;
innobase_hton->release_temporary_latches=innobase_release_temporary_latches;
- if (have_innodb != SHOW_OPTION_YES)
- DBUG_RETURN(0); // nothing else to do
+#ifdef HAVE_LARGE_PAGES
+ if (my_use_large_pages)
+ {
+ innobase_use_large_pages= 1;
+ innobase_large_page_size= opt_large_page_size;
+ }
+#endif
ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR);
@@ -1619,7 +1635,6 @@
DBUG_RETURN(FALSE);
error:
- have_innodb= SHOW_OPTION_DISABLED; // If we couldn't use handler
DBUG_RETURN(TRUE);
}
@@ -1762,7 +1777,7 @@
trx = check_trx_exists(hton, thd);
/* Update the info whether we should skip XA steps that eat CPU time */
- trx->support_xa = (ibool)(thd->variables.innodb_support_xa);
+ trx->support_xa = THDVAR(thd, support_xa);
/* Release a possible FIFO ticket and search latch. Since we will
reserve the kernel mutex, we have to release the search system latch
@@ -1995,7 +2010,7 @@
trx = check_trx_exists(hton, thd);
/* Update the info whether we should skip XA steps that eat CPU time */
- trx->support_xa = (ibool)(thd->variables.innodb_support_xa);
+ trx->support_xa = THDVAR(thd, support_xa);
/* Release a possible FIFO ticket and search latch. Since we will
reserve the kernel mutex, we have to release the search system latch
@@ -6332,7 +6347,7 @@
if (thd->in_lock_tables &&
thd->lex->sql_command == SQLCOM_LOCK_TABLES &&
- thd->variables.innodb_table_locks &&
+ THDVAR(thd, table_locks) &&
(thd->options & OPTION_NOT_AUTOCOMMIT)) {
ulint error = row_lock_table_for_mysql(
@@ -6457,7 +6472,7 @@
trx->active_trans = 1;
}
- if (thd->in_lock_tables && thd->variables.innodb_table_locks) {
+ if (thd->in_lock_tables && THDVAR(thd, table_locks)) {
ulint error = DB_SUCCESS;
error = row_lock_table_for_mysql(prebuilt, NULL, 0);
@@ -6513,10 +6528,6 @@
DBUG_ENTER("innodb_show_status");
- if (have_innodb != SHOW_OPTION_YES) {
- DBUG_RETURN(FALSE);
- }
-
trx = check_trx_exists(hton, thd);
innobase_release_stat_resources(trx);
@@ -7424,7 +7435,7 @@
trx->active_trans = 2;
}
- if (!thd->variables.innodb_support_xa) {
+ if (!THDVAR(thd, support_xa)) {
return(0);
}
@@ -7634,6 +7645,207 @@
struct st_mysql_storage_engine innobase_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
+/* plugin options */
+static MYSQL_SYSVAR_BOOL_REF(checksums, innobase_use_checksums,
+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
+ "Enable InnoDB checksums validation (enabled by default). "
+ "Disable with --skip-innodb-checksums.",
+ NULL, NULL, TRUE);
+
+static MYSQL_SYSVAR_STR_REF(data_home_dir, innobase_data_home_dir,
+ PLUGIN_VAR_READONLY,
+ "The common part for InnoDB table spaces.",
+ NULL, NULL, NULL);
+
+static MYSQL_SYSVAR_BOOL_REF(doublewrite, innobase_use_doublewrite,
+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
+ "Enable InnoDB doublewrite buffer (enabled by default). "
+ "Disable with --skip-innodb-doublewrite.",
+ NULL, NULL, TRUE);
+
+static MYSQL_SYSVAR_ULONG_REF(fast_shutdown, innobase_fast_shutdown,
+ PLUGIN_VAR_OPCMDARG,
+ "Speeds up the shutdown process of the InnoDB storage engine. Possible "
+ "values are 0, 1 (faster)"
+ /*
+ NetWare can't close unclosed files, can't automatically kill remaining
+ threads, etc, so on this OS we disable the crash-like InnoDB shutdown.
+ */
+#ifndef __NETWARE__
+ " or 2 (fastest - crash-like)"
+#endif
+ ".",
+ NULL, NULL, 1, 0, IF_NETWARE(1,2), 0);
+
+static MYSQL_SYSVAR_BOOL_REF(file_per_table, innobase_file_per_table,
+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
+ "Stores each InnoDB table to an .ibd file in the database dir.",
+ NULL, NULL, FALSE);
+
+static MYSQL_SYSVAR_ULONG_REF(flush_log_at_trx_commit, srv_flush_log_at_trx_commit,
+ PLUGIN_VAR_OPCMDARG,
+ "Set to 0 (write and flush once per second), 1 (write and flush at each commit)\
+ or 2 (write at commit, flush once per second).",
+ NULL, NULL, 1, 0, 2, 0);
+
+static MYSQL_SYSVAR_STR_REF(flush_method, innobase_unix_file_flush_method,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "With which method to flush data.", NULL, NULL, NULL);
+
+static MYSQL_SYSVAR_BOOL_REF(locks_unsafe_for_binlog, innobase_locks_unsafe_for_binlog,
+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
+ "Force InnoDB to not use next-key locking, to use only row-level locking.",
+ NULL, NULL, FALSE);
+
+static MYSQL_SYSVAR_STR_REF(log_arch_dir, innobase_log_arch_dir,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "Where full logs should be archived.", NULL, NULL, NULL);
+
+static MYSQL_SYSVAR_BOOL_REF(log_archive, innobase_log_archive,
+ PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
+ "Set to 1 if you want to have logs archived.", NULL, NULL, FALSE);
+
+static MYSQL_SYSVAR_STR_REF(log_group_home_dir, innobase_log_group_home_dir,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "Path to InnoDB log files.", NULL, NULL, NULL);
+
+static MYSQL_SYSVAR_ULONG_REF(max_dirty_pages_pct, srv_max_buf_pool_modified_pct,
+ PLUGIN_VAR_RQCMDARG,
+ "Percentage of dirty pages allowed in bufferpool.",
+ NULL, NULL, 90, 0, 100, 0);
+
+static MYSQL_SYSVAR_ULONG_REF(max_purge_lag, srv_max_purge_lag,
+ PLUGIN_VAR_RQCMDARG,
+ "Desired maximum length of the purge queue (0 = no limit)",
+ NULL, NULL, 0, 0, ~0L, 0);
+
+static MYSQL_SYSVAR_BOOL_REF(status_file, innobase_create_status_file,
+ PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_NOSYSVAR,
+ "Enable SHOW INNODB STATUS output in the innodb_status.<pid> file",
+ NULL, NULL, FALSE);
+
+static MYSQL_SYSVAR_LONG_REF(additional_mem_pool_size, innobase_additional_mem_pool_size,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "Size of a memory pool InnoDB uses to store data dictionary information and other
internal data structures.",
+ NULL, NULL, 1*1024*1024L, 512*1024L, ~0L, 1024);
+
+static MYSQL_SYSVAR_ULONG_REF(autoextend_increment, srv_auto_extend_increment,
+ PLUGIN_VAR_RQCMDARG,
+ "Data file autoextend increment in megabytes",
+ NULL, NULL, 8L, 1L, 1000L, 0);
+
+static MYSQL_SYSVAR_LONGLONG_REF(buffer_pool_size, innobase_buffer_pool_size,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
+ NULL, NULL, 8*1024*1024L, 1024*1024L, LONGLONG_MAX, 1024*1024L);
+
+static MYSQL_SYSVAR_ULONG_REF(commit_concurrency, srv_commit_concurrency,
+ PLUGIN_VAR_RQCMDARG,
+ "Helps in performance tuning in heavily concurrent environments.",
+ NULL, NULL, 0, 0, 1000, 0);
+
+static MYSQL_SYSVAR_ULONG_REF(concurrency_tickets, srv_n_free_tickets_to_enter,
+ PLUGIN_VAR_RQCMDARG,
+ "Number of times a thread is allowed to enter InnoDB within the same SQL query after it
has once got the ticket",
+ NULL, NULL, 500L, 1L, ~0L, 0);
+
+static MYSQL_SYSVAR_LONG_REF(file_io_threads, innobase_file_io_threads,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "Number of file I/O threads in InnoDB.",
+ NULL, NULL, 4, 4, 64, 0);
+
+static MYSQL_SYSVAR_LONG_REF(force_recovery, innobase_force_recovery,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "Helps to save your data in case the disk image of the database becomes corrupt.",
+ NULL, NULL, 0, 0, 6, 0);
+
+static MYSQL_SYSVAR_LONG_REF(lock_wait_timeout, innobase_lock_wait_timeout,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "Timeout in seconds an InnoDB transaction may wait for a lock before being rolled
back.",
+ NULL, NULL, 50, 1, 1024 * 1024 * 1024, 0);
+
+static MYSQL_SYSVAR_LONG_REF(log_buffer_size, innobase_log_buffer_size,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "The size of the buffer which InnoDB uses to write log to the log files on disk.",
+ NULL, NULL, 1024*1024L, 256*1024L, ~0L, 1024);
+
+static MYSQL_SYSVAR_LONGLONG_REF(log_file_size, innobase_log_file_size,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "Size of each log file in a log group.",
+ NULL, NULL, 5*1024*1024L, 1*1024*1024L, LONGLONG_MAX, 1024*1024L);
+
+static MYSQL_SYSVAR_LONG_REF(log_files_in_group, innobase_log_files_in_group,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "Number of log files in the log group. InnoDB writes to the files in a circular
fashion. Value 3 is recommended here.",
+ NULL, NULL, 2, 2, 100, 0);
+
+static MYSQL_SYSVAR_LONG_REF(mirrored_log_groups, innobase_mirrored_log_groups,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "Number of identical copies of log groups we keep for the database. Currently this
should be set to 1.",
+ NULL, NULL, 1, 1, 10, 0);
+
+static MYSQL_SYSVAR_LONG_REF(open_files, innobase_open_files,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "How many files at the maximum InnoDB keeps open at the same time.",
+ NULL, NULL, 300L, 10L, ~0L, 0);
+
+static MYSQL_SYSVAR_ULONG_REF(sync_spin_loops, srv_n_spin_wait_rounds,
+ PLUGIN_VAR_RQCMDARG,
+ "Count of spin-loop rounds in InnoDB mutexes",
+ NULL, NULL, 20L, 0L, ~0L, 0);
+
+static MYSQL_SYSVAR_ULONG_REF(thread_concurrency, srv_thread_concurrency,
+ PLUGIN_VAR_RQCMDARG,
+ "Helps in performance tuning in heavily concurrent environments. Sets the maximum
number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.",
+ NULL, NULL, 8, 0, 1000, 0);
+
+static MYSQL_SYSVAR_ULONG_REF(thread_sleep_delay, srv_thread_sleep_delay,
+ PLUGIN_VAR_RQCMDARG,
+ "Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a
sleep",
+ NULL, NULL, 10000L, 0L, ~0L, 0);
+
+static MYSQL_SYSVAR_STR_REF(data_file_path, innobase_data_file_path,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "Path to individual files and their sizes.",
+ NULL, NULL, NULL);
+
+static struct st_mysql_sys_var* innobase_system_variables[]= {
+ MYSQL_SYSVAR(checksums),
+ MYSQL_SYSVAR(data_home_dir),
+ MYSQL_SYSVAR(doublewrite),
+ MYSQL_SYSVAR(fast_shutdown),
+ MYSQL_SYSVAR(file_per_table),
+ MYSQL_SYSVAR(flush_log_at_trx_commit),
+ MYSQL_SYSVAR(flush_method),
+ MYSQL_SYSVAR(locks_unsafe_for_binlog),
+ MYSQL_SYSVAR(log_arch_dir),
+ MYSQL_SYSVAR(log_archive),
+ MYSQL_SYSVAR(log_group_home_dir),
+ MYSQL_SYSVAR(max_dirty_pages_pct),
+ MYSQL_SYSVAR(max_purge_lag),
+ MYSQL_SYSVAR(status_file),
+ MYSQL_SYSVAR(support_xa),
+ MYSQL_SYSVAR(table_locks),
+ MYSQL_SYSVAR(additional_mem_pool_size),
+ MYSQL_SYSVAR(autoextend_increment),
+ MYSQL_SYSVAR(buffer_pool_size),
+ MYSQL_SYSVAR(commit_concurrency),
+ MYSQL_SYSVAR(concurrency_tickets),
+ MYSQL_SYSVAR(file_io_threads),
+ MYSQL_SYSVAR(force_recovery),
+ MYSQL_SYSVAR(lock_wait_timeout),
+ MYSQL_SYSVAR(log_buffer_size),
+ MYSQL_SYSVAR(log_file_size),
+ MYSQL_SYSVAR(log_files_in_group),
+ MYSQL_SYSVAR(mirrored_log_groups),
+ MYSQL_SYSVAR(open_files),
+ MYSQL_SYSVAR(sync_spin_loops),
+ MYSQL_SYSVAR(thread_concurrency),
+ MYSQL_SYSVAR(thread_sleep_delay),
+ MYSQL_SYSVAR(data_file_path),
+ NULL
+};
+
mysql_declare_plugin(innobase)
{
MYSQL_STORAGE_ENGINE_PLUGIN,
@@ -7646,7 +7858,7 @@
NULL, /* Plugin Deinit */
0x0100 /* 1.0 */,
innodb_status_variables_export,/* status variables */
- NULL, /* system variables */
+ innobase_system_variables, /* system variables */
NULL /* config options */
}
mysql_declare_plugin_end;
--- 1.206/sql/set_var.cc 2006-12-21 16:54:34 -08:00
+++ 1.207/sql/set_var.cc 2006-12-21 16:54:34 -08:00
@@ -59,38 +59,6 @@
#include "events.h"
-/* WITH_INNOBASE_STORAGE_ENGINE */
-extern uint innobase_flush_log_at_trx_commit;
-extern ulong innobase_fast_shutdown;
-extern long innobase_mirrored_log_groups, innobase_log_files_in_group;
-extern longlong innobase_log_file_size;
-extern long innobase_log_buffer_size;
-extern longlong innobase_buffer_pool_size;
-extern long innobase_additional_mem_pool_size;
-extern long innobase_file_io_threads, innobase_lock_wait_timeout;
-extern long innobase_force_recovery;
-extern long innobase_open_files;
-extern char *innobase_data_home_dir, *innobase_data_file_path;
-extern char *innobase_log_group_home_dir, *innobase_log_arch_dir;
-extern char *innobase_unix_file_flush_method;
-/* The following variables have to be my_bool for SHOW VARIABLES to work */
-extern my_bool innobase_log_archive,
- innobase_use_doublewrite,
- innobase_use_checksums,
- innobase_file_per_table,
- innobase_locks_unsafe_for_binlog;
-
-extern "C" {
-extern ulong srv_max_buf_pool_modified_pct;
-extern ulong srv_max_purge_lag;
-extern ulong srv_auto_extend_increment;
-extern ulong srv_n_spin_wait_rounds;
-extern ulong srv_n_free_tickets_to_enter;
-extern ulong srv_thread_sleep_delay;
-extern ulong srv_thread_concurrency;
-extern ulong srv_commit_concurrency;
-extern ulong srv_flush_log_at_trx_commit;
-}
/* WITH_NDBCLUSTER_STORAGE_ENGINE */
extern ulong ndb_cache_check_time;
@@ -100,8 +68,7 @@
extern ulong ndb_report_thresh_binlog_mem_usage;
#endif
-
-
+static DYNAMIC_ARRAY fixed_show_vars;
static HASH system_variable_hash;
const char *bool_type_names[]= { "OFF", "ON", NullS };
TYPELIB bool_typelib=
@@ -172,864 +139,534 @@
it in the constructor (see sys_var class for details).
*/
-sys_var *sys_var::first= NULL;
-uint sys_var::sys_vars= 0;
+static sys_var_chain vars = { NULL, NULL };
-sys_var_thd_ulong sys_auto_increment_increment("auto_increment_increment",
+static sys_var_thd_ulong sys_auto_increment_increment(vars, "auto_increment_increment",
&SV::auto_increment_increment);
-sys_var_thd_ulong sys_auto_increment_offset("auto_increment_offset",
+static sys_var_thd_ulong sys_auto_increment_offset(vars, "auto_increment_offset",
&SV::auto_increment_offset);
-sys_var_bool_ptr sys_automatic_sp_privileges("automatic_sp_privileges",
+static sys_var_bool_ptr sys_automatic_sp_privileges(vars, "automatic_sp_privileges",
&sp_automatic_privileges);
-sys_var_const_str sys_basedir("basedir", mysql_home);
-sys_var_long_ptr sys_binlog_cache_size("binlog_cache_size",
+static sys_var_const_str sys_basedir(vars, "basedir", mysql_home);
+static sys_var_long_ptr sys_binlog_cache_size(vars, "binlog_cache_size",
&binlog_cache_size);
-sys_var_thd_binlog_format sys_binlog_format("binlog_format",
+static sys_var_thd_binlog_format sys_binlog_format(vars, "binlog_format",
&SV::binlog_format);
-sys_var_thd_ulong sys_bulk_insert_buff_size("bulk_insert_buffer_size",
+static sys_var_thd_ulong sys_bulk_insert_buff_size(vars, "bulk_insert_buffer_size",
&SV::bulk_insert_buff_size);
-sys_var_character_set_server sys_character_set_server("character_set_server");
-sys_var_const_str sys_charset_system("character_set_system",
+static sys_var_character_set_server sys_character_set_server(vars,
"character_set_server");
+sys_var_const_str sys_charset_system(vars, "character_set_system",
(char *)my_charset_utf8_general_ci.name);
-sys_var_character_set_database sys_character_set_database("character_set_database");
-sys_var_character_set_client sys_character_set_client("character_set_client");
-sys_var_character_set_connection
sys_character_set_connection("character_set_connection");
-sys_var_character_set_results sys_character_set_results("character_set_results");
-sys_var_character_set_filesystem
sys_character_set_filesystem("character_set_filesystem");
-sys_var_thd_ulong sys_completion_type("completion_type",
+static sys_var_character_set_database sys_character_set_database(vars,
"character_set_database");
+static sys_var_character_set_client sys_character_set_client(vars,
"character_set_client");
+static sys_var_character_set_connection sys_character_set_connection(vars,
"character_set_connection");
+static sys_var_character_set_results sys_character_set_results(vars,
"character_set_results");
+static sys_var_character_set_filesystem sys_character_set_filesystem(vars,
"character_set_filesystem");
+static sys_var_thd_ulong sys_completion_type(vars, "completion_type",
&SV::completion_type,
check_completion_type,
fix_completion_type);
-sys_var_collation_connection sys_collation_connection("collation_connection");
-sys_var_collation_database sys_collation_database("collation_database");
-sys_var_collation_server sys_collation_server("collation_server");
-sys_var_long_ptr sys_concurrent_insert("concurrent_insert",
+static sys_var_collation_connection sys_collation_connection(vars,
"collation_connection");
+static sys_var_collation_database sys_collation_database(vars, "collation_database");
+static sys_var_collation_server sys_collation_server(vars, "collation_server");
+static sys_var_long_ptr sys_concurrent_insert(vars, "concurrent_insert",
&myisam_concurrent_insert);
-sys_var_long_ptr sys_connect_timeout("connect_timeout",
+static sys_var_long_ptr sys_connect_timeout(vars, "connect_timeout",
&connect_timeout);
-sys_var_const_str sys_datadir("datadir", mysql_real_data_home);
+static sys_var_const_str sys_datadir(vars, "datadir", mysql_real_data_home);
#ifndef DBUG_OFF
-sys_var_thd_dbug sys_dbug("debug");
+static sys_var_thd_dbug sys_dbug(vars, "debug");
#endif
-sys_var_enum sys_delay_key_write("delay_key_write",
+static sys_var_enum sys_delay_key_write(vars, "delay_key_write",
&delay_key_write_options,
&delay_key_write_typelib,
fix_delay_key_write);
-sys_var_long_ptr sys_delayed_insert_limit("delayed_insert_limit",
+static sys_var_long_ptr sys_delayed_insert_limit(vars, "delayed_insert_limit",
&delayed_insert_limit);
-sys_var_long_ptr sys_delayed_insert_timeout("delayed_insert_timeout",
+static sys_var_long_ptr sys_delayed_insert_timeout(vars, "delayed_insert_timeout",
&delayed_insert_timeout);
-sys_var_long_ptr sys_delayed_queue_size("delayed_queue_size",
+static sys_var_long_ptr sys_delayed_queue_size(vars, "delayed_queue_size",
&delayed_queue_size);
-sys_var_event_scheduler sys_event_scheduler("event_scheduler");
-sys_var_long_ptr sys_expire_logs_days("expire_logs_days",
+static sys_var_event_scheduler sys_event_scheduler(vars, "event_scheduler");
+static sys_var_long_ptr sys_expire_logs_days(vars, "expire_logs_days",
&expire_logs_days);
-sys_var_bool_ptr sys_flush("flush", &myisam_flush);
-sys_var_long_ptr sys_flush_time("flush_time", &flush_time);
-sys_var_str sys_ft_boolean_syntax("ft_boolean_syntax",
+static sys_var_bool_ptr sys_flush(vars, "flush", &myisam_flush);
+static sys_var_long_ptr sys_flush_time(vars, "flush_time", &flush_time);
+static sys_var_str sys_ft_boolean_syntax(vars, "ft_boolean_syntax",
sys_check_ftb_syntax,
sys_update_ftb_syntax,
sys_default_ftb_syntax,
ft_boolean_syntax);
-sys_var_str sys_init_connect("init_connect", 0,
+sys_var_str sys_init_connect(vars, "init_connect", 0,
sys_update_init_connect,
sys_default_init_connect,0);
-sys_var_str sys_init_slave("init_slave", 0,
+sys_var_str sys_init_slave(vars, "init_slave", 0,
sys_update_init_slave,
sys_default_init_slave,0);
-sys_var_thd_ulong sys_interactive_timeout("interactive_timeout",
+static sys_var_thd_ulong sys_interactive_timeout(vars, "interactive_timeout",
&SV::net_interactive_timeout);
-sys_var_thd_ulong sys_join_buffer_size("join_buffer_size",
+static sys_var_thd_ulong sys_join_buffer_size(vars, "join_buffer_size",
&SV::join_buff_size);
-sys_var_key_buffer_size sys_key_buffer_size("key_buffer_size");
-sys_var_key_cache_long sys_key_cache_block_size("key_cache_block_size",
+static sys_var_key_buffer_size sys_key_buffer_size(vars, "key_buffer_size");
+static sys_var_key_cache_long sys_key_cache_block_size(vars, "key_cache_block_size",
offsetof(KEY_CACHE,
param_block_size));
-sys_var_key_cache_long sys_key_cache_division_limit("key_cache_division_limit",
+static sys_var_key_cache_long sys_key_cache_division_limit(vars,
"key_cache_division_limit",
offsetof(KEY_CACHE,
param_division_limit));
-sys_var_key_cache_long sys_key_cache_age_threshold("key_cache_age_threshold",
+static sys_var_key_cache_long sys_key_cache_age_threshold(vars,
"key_cache_age_threshold",
offsetof(KEY_CACHE,
param_age_threshold));
-sys_var_bool_ptr sys_local_infile("local_infile",
+static sys_var_bool_ptr sys_local_infile(vars, "local_infile",
&opt_local_infile);
-sys_var_trust_routine_creators
-sys_trust_routine_creators("log_bin_trust_routine_creators",
+static sys_var_trust_routine_creators
+sys_trust_routine_creators(vars, "log_bin_trust_routine_creators",
&trust_function_creators);
-sys_var_bool_ptr
-sys_trust_function_creators("log_bin_trust_function_creators",
+static sys_var_bool_ptr
+sys_trust_function_creators(vars, "log_bin_trust_function_creators",
&trust_function_creators);
-sys_var_bool_ptr
- sys_log_queries_not_using_indexes("log_queries_not_using_indexes",
+static sys_var_bool_ptr
+ sys_log_queries_not_using_indexes(vars, "log_queries_not_using_indexes",
&opt_log_queries_not_using_indexes);
-sys_var_thd_ulong sys_log_warnings("log_warnings", &SV::log_warnings);
-sys_var_thd_ulong sys_long_query_time("long_query_time",
+static sys_var_thd_ulong sys_log_warnings(vars, "log_warnings", &SV::log_warnings);
+static sys_var_thd_ulong sys_long_query_time(vars, "long_query_time",
&SV::long_query_time);
-sys_var_thd_bool sys_low_priority_updates("low_priority_updates",
+static sys_var_thd_bool sys_low_priority_updates(vars, "low_priority_updates",
&SV::low_priority_updates,
fix_low_priority_updates);
#ifndef TO_BE_DELETED /* Alias for the low_priority_updates */
-sys_var_thd_bool sys_sql_low_priority_updates("sql_low_priority_updates",
+static sys_var_thd_bool sys_sql_low_priority_updates(vars, "sql_low_priority_updates",
&SV::low_priority_updates,
fix_low_priority_updates);
#endif
-sys_var_thd_ulong sys_max_allowed_packet("max_allowed_packet",
+static sys_var_thd_ulong sys_max_allowed_packet(vars, "max_allowed_packet",
&SV::max_allowed_packet);
-sys_var_long_ptr sys_max_binlog_cache_size("max_binlog_cache_size",
+static sys_var_long_ptr sys_max_binlog_cache_size(vars, "max_binlog_cache_size",
&max_binlog_cache_size);
-sys_var_long_ptr sys_max_binlog_size("max_binlog_size",
+static sys_var_long_ptr sys_max_binlog_size(vars, "max_binlog_size",
&max_binlog_size,
fix_max_binlog_size);
-sys_var_long_ptr sys_max_connections("max_connections",
+static sys_var_long_ptr sys_max_connections(vars, "max_connections",
&max_connections,
fix_max_connections);
-sys_var_long_ptr sys_max_connect_errors("max_connect_errors",
+static sys_var_long_ptr sys_max_connect_errors(vars, "max_connect_errors",
&max_connect_errors);
-sys_var_thd_ulong sys_max_insert_delayed_threads("max_insert_delayed_threads",
+static sys_var_thd_ulong sys_max_insert_delayed_threads(vars,
"max_insert_delayed_threads",
&SV::max_insert_delayed_threads,
check_max_delayed_threads,
fix_max_connections);
-sys_var_thd_ulong sys_max_delayed_threads("max_delayed_threads",
+static sys_var_thd_ulong sys_max_delayed_threads(vars, "max_delayed_threads",
&SV::max_insert_delayed_threads,
check_max_delayed_threads,
fix_max_connections);
-sys_var_thd_ulong sys_max_error_count("max_error_count",
+static sys_var_thd_ulong sys_max_error_count(vars, "max_error_count",
&SV::max_error_count);
-sys_var_thd_ulonglong sys_max_heap_table_size("max_heap_table_size",
+static sys_var_thd_ulonglong sys_max_heap_table_size(vars, "max_heap_table_size",
&SV::max_heap_table_size);
-sys_var_thd_ulong sys_pseudo_thread_id("pseudo_thread_id",
+static sys_var_thd_ulong sys_pseudo_thread_id(vars, "pseudo_thread_id",
&SV::pseudo_thread_id,
check_pseudo_thread_id, 0);
-sys_var_thd_ha_rows sys_max_join_size("max_join_size",
+static sys_var_thd_ha_rows sys_max_join_size(vars, "max_join_size",
&SV::max_join_size,
fix_max_join_size);
-sys_var_thd_ulong sys_max_seeks_for_key("max_seeks_for_key",
+static sys_var_thd_ulong sys_max_seeks_for_key(vars, "max_seeks_for_key",
&SV::max_seeks_for_key);
-sys_var_thd_ulong sys_max_length_for_sort_data("max_length_for_sort_data",
+static sys_var_thd_ulong sys_max_length_for_sort_data(vars, "max_length_for_sort_data",
&SV::max_length_for_sort_data);
#ifndef TO_BE_DELETED /* Alias for max_join_size */
-sys_var_thd_ha_rows sys_sql_max_join_size("sql_max_join_size",
+static sys_var_thd_ha_rows sys_sql_max_join_size(vars, "sql_max_join_size",
&SV::max_join_size,
fix_max_join_size);
#endif
static sys_var_long_ptr_global
-sys_max_prepared_stmt_count("max_prepared_stmt_count",
+sys_max_prepared_stmt_count(vars, "max_prepared_stmt_count",
&max_prepared_stmt_count,
&LOCK_prepared_stmt_count);
-sys_var_long_ptr sys_max_relay_log_size("max_relay_log_size",
+static sys_var_long_ptr sys_max_relay_log_size(vars, "max_relay_log_size",
&max_relay_log_size,
fix_max_relay_log_size);
-sys_var_thd_ulong sys_max_sort_length("max_sort_length",
+static sys_var_thd_ulong sys_max_sort_length(vars, "max_sort_length",
&SV::max_sort_length);
-sys_var_thd_ulong sys_max_sp_recursion_depth("max_sp_recursion_depth",
+static sys_var_thd_ulong sys_max_sp_recursion_depth(vars, "max_sp_recursion_depth",
&SV::max_sp_recursion_depth);
-sys_var_max_user_conn sys_max_user_connections("max_user_connections");
-sys_var_thd_ulong sys_max_tmp_tables("max_tmp_tables",
+static sys_var_max_user_conn sys_max_user_connections(vars, "max_user_connections");
+static sys_var_thd_ulong sys_max_tmp_tables(vars, "max_tmp_tables",
&SV::max_tmp_tables);
-sys_var_long_ptr sys_max_write_lock_count("max_write_lock_count",
+static sys_var_long_ptr sys_max_write_lock_count(vars, "max_write_lock_count",
&max_write_lock_count);
-sys_var_thd_ulong sys_multi_range_count("multi_range_count",
+static sys_var_thd_ulong sys_multi_range_count(vars, "multi_range_count",
&SV::multi_range_count);
-sys_var_long_ptr sys_myisam_data_pointer_size("myisam_data_pointer_size",
+static sys_var_long_ptr sys_myisam_data_pointer_size(vars, "myisam_data_pointer_size",
&myisam_data_pointer_size);
-sys_var_thd_ulonglong sys_myisam_max_sort_file_size("myisam_max_sort_file_size",
&SV::myisam_max_sort_file_size, fix_myisam_max_sort_file_size, 1);
-sys_var_thd_ulong sys_myisam_repair_threads("myisam_repair_threads",
&SV::myisam_repair_threads);
-sys_var_thd_ulong sys_myisam_sort_buffer_size("myisam_sort_buffer_size",
&SV::myisam_sort_buff_size);
-sys_var_bool_ptr sys_myisam_use_mmap("myisam_use_mmap",
+static sys_var_thd_ulonglong sys_myisam_max_sort_file_size(vars,
"myisam_max_sort_file_size", &SV::myisam_max_sort_file_size,
fix_myisam_max_sort_file_size, 1);
+static sys_var_thd_ulong sys_myisam_repair_threads(vars, "myisam_repair_threads",
&SV::myisam_repair_threads);
+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);
-sys_var_thd_enum sys_myisam_stats_method("myisam_stats_method",
+static sys_var_thd_enum sys_myisam_stats_method(vars, "myisam_stats_method",
&SV::myisam_stats_method,
&myisam_stats_method_typelib,
NULL);
-sys_var_thd_ulong sys_net_buffer_length("net_buffer_length",
+static sys_var_thd_ulong sys_net_buffer_length(vars, "net_buffer_length",
&SV::net_buffer_length);
-sys_var_thd_ulong sys_net_read_timeout("net_read_timeout",
+static sys_var_thd_ulong sys_net_read_timeout(vars, "net_read_timeout",
&SV::net_read_timeout,
0, fix_net_read_timeout);
-sys_var_thd_ulong sys_net_write_timeout("net_write_timeout",
+static sys_var_thd_ulong sys_net_write_timeout(vars, "net_write_timeout",
&SV::net_write_timeout,
0, fix_net_write_timeout);
-sys_var_thd_ulong sys_net_retry_count("net_retry_count",
+static sys_var_thd_ulong sys_net_retry_count(vars, "net_retry_count",
&SV::net_retry_count,
0, fix_net_retry_count);
-sys_var_thd_bool sys_new_mode("new", &SV::new_mode);
-sys_var_thd_bool sys_old_alter_table("old_alter_table",
+static sys_var_thd_bool sys_new_mode(vars, "new", &SV::new_mode);
+sys_var_thd_bool sys_old_alter_table(vars, "old_alter_table",
&SV::old_alter_table);
-sys_var_thd_bool sys_old_passwords("old_passwords", &SV::old_passwords);
-sys_var_thd_ulong sys_optimizer_prune_level("optimizer_prune_level",
+sys_var_thd_bool sys_old_passwords(vars, "old_passwords", &SV::old_passwords);
+static sys_var_thd_ulong sys_optimizer_prune_level(vars, "optimizer_prune_level",
&SV::optimizer_prune_level);
-sys_var_thd_ulong sys_optimizer_search_depth("optimizer_search_depth",
+static sys_var_thd_ulong sys_optimizer_search_depth(vars, "optimizer_search_depth",
&SV::optimizer_search_depth);
-sys_var_thd_ulong sys_preload_buff_size("preload_buffer_size",
+static sys_var_thd_ulong sys_preload_buff_size(vars, "preload_buffer_size",
&SV::preload_buff_size);
-sys_var_thd_ulong sys_read_buff_size("read_buffer_size",
+static sys_var_thd_ulong sys_read_buff_size(vars, "read_buffer_size",
&SV::read_buff_size);
-sys_var_bool_ptr sys_readonly("read_only", &opt_readonly);
-sys_var_thd_ulong sys_read_rnd_buff_size("read_rnd_buffer_size",
+static sys_var_bool_ptr sys_readonly(vars, "read_only", &opt_readonly);
+static sys_var_thd_ulong sys_read_rnd_buff_size(vars, "read_rnd_buffer_size",
&SV::read_rnd_buff_size);
-sys_var_thd_ulong sys_div_precincrement("div_precision_increment",
+static sys_var_thd_ulong sys_div_precincrement(vars, "div_precision_increment",
&SV::div_precincrement);
-#ifdef HAVE_REPLICATION
-sys_var_bool_ptr sys_relay_log_purge("relay_log_purge",
- &relay_log_purge);
-#endif
-sys_var_long_ptr sys_rpl_recovery_rank("rpl_recovery_rank",
+static sys_var_long_ptr sys_rpl_recovery_rank(vars, "rpl_recovery_rank",
&rpl_recovery_rank);
-sys_var_long_ptr sys_query_cache_size("query_cache_size",
+static sys_var_long_ptr sys_query_cache_size(vars, "query_cache_size",
&query_cache_size,
fix_query_cache_size);
-sys_var_thd_ulong sys_range_alloc_block_size("range_alloc_block_size",
+static sys_var_thd_ulong sys_range_alloc_block_size(vars, "range_alloc_block_size",
&SV::range_alloc_block_size);
-sys_var_thd_ulong sys_query_alloc_block_size("query_alloc_block_size",
+static sys_var_thd_ulong sys_query_alloc_block_size(vars, "query_alloc_block_size",
&SV::query_alloc_block_size,
0, fix_thd_mem_root);
-sys_var_thd_ulong sys_query_prealloc_size("query_prealloc_size",
+static sys_var_thd_ulong sys_query_prealloc_size(vars, "query_prealloc_size",
&SV::query_prealloc_size,
0, fix_thd_mem_root);
-sys_var_readonly sys_tmpdir("tmpdir", OPT_GLOBAL, SHOW_CHAR, get_tmpdir);
-sys_var_thd_ulong sys_trans_alloc_block_size("transaction_alloc_block_size",
+static sys_var_readonly sys_tmpdir(vars, "tmpdir", OPT_GLOBAL, SHOW_CHAR,
get_tmpdir);
+static sys_var_thd_ulong sys_trans_alloc_block_size(vars, "transaction_alloc_block_size",
&SV::trans_alloc_block_size,
0, fix_trans_mem_root);
-sys_var_thd_ulong sys_trans_prealloc_size("transaction_prealloc_size",
+static sys_var_thd_ulong sys_trans_prealloc_size(vars, "transaction_prealloc_size",
&SV::trans_prealloc_size,
0, fix_trans_mem_root);
#ifdef HAVE_QUERY_CACHE
-sys_var_long_ptr sys_query_cache_limit("query_cache_limit",
+static sys_var_long_ptr sys_query_cache_limit(vars, "query_cache_limit",
&query_cache.query_cache_limit);
-sys_var_long_ptr sys_query_cache_min_res_unit("query_cache_min_res_unit",
+static sys_var_long_ptr sys_query_cache_min_res_unit(vars,
"query_cache_min_res_unit",
&query_cache_min_res_unit,
fix_query_cache_min_res_unit);
-sys_var_thd_enum sys_query_cache_type("query_cache_type",
+static sys_var_thd_enum sys_query_cache_type(vars, "query_cache_type",
&SV::query_cache_type,
&query_cache_type_typelib);
-sys_var_thd_bool
-sys_query_cache_wlock_invalidate("query_cache_wlock_invalidate",
+static sys_var_thd_bool
+sys_query_cache_wlock_invalidate(vars, "query_cache_wlock_invalidate",
&SV::query_cache_wlock_invalidate);
#endif /* HAVE_QUERY_CACHE */
-sys_var_bool_ptr sys_secure_auth("secure_auth", &opt_secure_auth);
-sys_var_long_ptr sys_server_id("server_id", &server_id, fix_server_id);
-sys_var_bool_ptr sys_slave_compressed_protocol("slave_compressed_protocol",
+static sys_var_bool_ptr sys_secure_auth(vars, "secure_auth", &opt_secure_auth);
+static sys_var_long_ptr sys_server_id(vars, "server_id", &server_id, fix_server_id);
+static sys_var_bool_ptr sys_slave_compressed_protocol(vars, "slave_compressed_protocol",
&opt_slave_compressed_protocol);
-#ifdef HAVE_REPLICATION
-sys_var_long_ptr sys_slave_net_timeout("slave_net_timeout",
- &slave_net_timeout);
-sys_var_long_ptr sys_slave_trans_retries("slave_transaction_retries",
- &slave_trans_retries);
-#endif
-sys_var_long_ptr sys_slow_launch_time("slow_launch_time",
+static sys_var_long_ptr sys_slow_launch_time(vars, "slow_launch_time",
&slow_launch_time);
-sys_var_thd_ulong sys_sort_buffer("sort_buffer_size",
+static sys_var_thd_ulong sys_sort_buffer(vars, "sort_buffer_size",
&SV::sortbuff_size);
-sys_var_thd_sql_mode sys_sql_mode("sql_mode",
+static sys_var_thd_sql_mode sys_sql_mode(vars, "sql_mode",
&SV::sql_mode);
#ifdef HAVE_OPENSSL
extern char *opt_ssl_ca, *opt_ssl_capath, *opt_ssl_cert, *opt_ssl_cipher,
*opt_ssl_key;
-sys_var_const_str_ptr sys_ssl_ca("ssl_ca", &opt_ssl_ca);
-sys_var_const_str_ptr sys_ssl_capath("ssl_capath", &opt_ssl_capath);
-sys_var_const_str_ptr sys_ssl_cert("ssl_cert", &opt_ssl_cert);
-sys_var_const_str_ptr sys_ssl_cipher("ssl_cipher", &opt_ssl_cipher);
-sys_var_const_str_ptr sys_ssl_key("ssl_key", &opt_ssl_key);
+static sys_var_const_str_ptr sys_ssl_ca(vars, "ssl_ca", &opt_ssl_ca);
+static sys_var_const_str_ptr sys_ssl_capath(vars, "ssl_capath", &opt_ssl_capath);
+static sys_var_const_str_ptr sys_ssl_cert(vars, "ssl_cert", &opt_ssl_cert);
+static sys_var_const_str_ptr sys_ssl_cipher(vars, "ssl_cipher", &opt_ssl_cipher);
+static sys_var_const_str_ptr sys_ssl_key(vars, "ssl_key", &opt_ssl_key);
#else
-sys_var_const_str sys_ssl_ca("ssl_ca", NULL);
-sys_var_const_str sys_ssl_capath("ssl_capath", NULL);
-sys_var_const_str sys_ssl_cert("ssl_cert", NULL);
-sys_var_const_str sys_ssl_cipher("ssl_cipher", NULL);
-sys_var_const_str sys_ssl_key("ssl_key", NULL);
+static sys_var_const_str sys_ssl_ca(vars, "ssl_ca", NULL);
+static sys_var_const_str sys_ssl_capath(vars, "ssl_capath", NULL);
+static sys_var_const_str sys_ssl_cert(vars, "ssl_cert", NULL);
+static sys_var_const_str sys_ssl_cipher(vars, "ssl_cipher", NULL);
+static sys_var_const_str sys_ssl_key(vars, "ssl_key", NULL);
#endif
-sys_var_thd_enum
-sys_updatable_views_with_limit("updatable_views_with_limit",
+static sys_var_thd_enum
+sys_updatable_views_with_limit(vars, "updatable_views_with_limit",
&SV::updatable_views_with_limit,
&updatable_views_with_limit_typelib);
-sys_var_thd_table_type sys_table_type("table_type",
+static sys_var_thd_table_type sys_table_type(vars, "table_type",
&SV::table_type);
-sys_var_thd_storage_engine sys_storage_engine("storage_engine",
+static sys_var_thd_storage_engine sys_storage_engine(vars, "storage_engine",
&SV::table_type);
-#ifdef HAVE_REPLICATION
-sys_var_sync_binlog_period sys_sync_binlog_period("sync_binlog",
&sync_binlog_period);
-#endif
-sys_var_bool_ptr sys_sync_frm("sync_frm", &opt_sync_frm);
-sys_var_const_str sys_system_time_zone("system_time_zone",
+static sys_var_bool_ptr sys_sync_frm(vars, "sync_frm", &opt_sync_frm);
+static sys_var_const_str sys_system_time_zone(vars, "system_time_zone",
system_time_zone);
-sys_var_long_ptr sys_table_def_size("table_definition_cache",
+static sys_var_long_ptr sys_table_def_size(vars, "table_definition_cache",
&table_def_size);
-sys_var_long_ptr sys_table_cache_size("table_open_cache",
+static sys_var_long_ptr sys_table_cache_size(vars, "table_open_cache",
&table_cache_size);
-sys_var_long_ptr sys_table_lock_wait_timeout("table_lock_wait_timeout",
+static sys_var_long_ptr sys_table_lock_wait_timeout(vars, "table_lock_wait_timeout",
&table_lock_wait_timeout);
-sys_var_long_ptr sys_thread_cache_size("thread_cache_size",
+static sys_var_long_ptr sys_thread_cache_size(vars, "thread_cache_size",
&thread_cache_size);
-sys_var_thd_enum sys_tx_isolation("tx_isolation",
+static sys_var_thd_enum sys_tx_isolation(vars, "tx_isolation",
&SV::tx_isolation,
&tx_isolation_typelib,
fix_tx_isolation,
check_tx_isolation);
-sys_var_thd_ulonglong sys_tmp_table_size("tmp_table_size",
+static sys_var_thd_ulonglong sys_tmp_table_size(vars, "tmp_table_size",
&SV::tmp_table_size);
-sys_var_bool_ptr sys_timed_mutexes("timed_mutexes",
+static sys_var_bool_ptr sys_timed_mutexes(vars, "timed_mutexes",
&timed_mutexes);
-sys_var_const_str sys_version("version", server_version);
-sys_var_const_str sys_version_comment("version_comment",
+static sys_var_const_str sys_version(vars, "version", server_version);
+static sys_var_const_str sys_version_comment(vars, "version_comment",
MYSQL_COMPILATION_COMMENT);
-sys_var_const_str sys_version_compile_machine("version_compile_machine",
+static sys_var_const_str sys_version_compile_machine(vars, "version_compile_machine",
MACHINE_TYPE);
-sys_var_const_str sys_version_compile_os("version_compile_os",
+static sys_var_const_str sys_version_compile_os(vars, "version_compile_os",
SYSTEM_TYPE);
-sys_var_thd_ulong sys_net_wait_timeout("wait_timeout",
+static sys_var_thd_ulong sys_net_wait_timeout(vars, "wait_timeout",
&SV::net_wait_timeout);
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
-sys_var_long_ptr sys_innodb_fast_shutdown("innodb_fast_shutdown",
- &innobase_fast_shutdown);
-sys_var_long_ptr sys_innodb_max_dirty_pages_pct("innodb_max_dirty_pages_pct",
-
&srv_max_buf_pool_modified_pct);
-sys_var_long_ptr sys_innodb_max_purge_lag("innodb_max_purge_lag",
- &srv_max_purge_lag);
-sys_var_thd_bool sys_innodb_table_locks("innodb_table_locks",
- &SV::innodb_table_locks);
-sys_var_thd_bool sys_innodb_support_xa("innodb_support_xa",
- &SV::innodb_support_xa);
-sys_var_long_ptr sys_innodb_autoextend_increment("innodb_autoextend_increment",
- &srv_auto_extend_increment);
-sys_var_long_ptr sys_innodb_sync_spin_loops("innodb_sync_spin_loops",
- &srv_n_spin_wait_rounds);
-sys_var_long_ptr sys_innodb_concurrency_tickets("innodb_concurrency_tickets",
- &srv_n_free_tickets_to_enter);
-sys_var_long_ptr sys_innodb_thread_sleep_delay("innodb_thread_sleep_delay",
- &srv_thread_sleep_delay);
-sys_var_long_ptr sys_innodb_thread_concurrency("innodb_thread_concurrency",
- &srv_thread_concurrency);
-sys_var_long_ptr sys_innodb_commit_concurrency("innodb_commit_concurrency",
- &srv_commit_concurrency);
-sys_var_long_ptr sys_innodb_flush_log_at_trx_commit(
- "innodb_flush_log_at_trx_commit",
- &srv_flush_log_at_trx_commit);
-#endif
+
/* Condition pushdown to storage engine */
-sys_var_thd_bool
-sys_engine_condition_pushdown("engine_condition_pushdown",
+static sys_var_thd_bool
+sys_engine_condition_pushdown(vars, "engine_condition_pushdown",
&SV::engine_condition_pushdown);
/* ndb thread specific variable settings */
-sys_var_thd_ulong
-sys_ndb_autoincrement_prefetch_sz("ndb_autoincrement_prefetch_sz",
+static sys_var_thd_ulong
+sys_ndb_autoincrement_prefetch_sz(vars, "ndb_autoincrement_prefetch_sz",
&SV::ndb_autoincrement_prefetch_sz);
-sys_var_thd_bool
-sys_ndb_force_send("ndb_force_send", &SV::ndb_force_send);
+static sys_var_thd_bool
+sys_ndb_force_send(vars, "ndb_force_send", &SV::ndb_force_send);
#ifdef HAVE_NDB_BINLOG
-sys_var_long_ptr
-sys_ndb_report_thresh_binlog_epoch_slip("ndb_report_thresh_binlog_epoch_slip",
+static sys_var_long_ptr
+sys_ndb_report_thresh_binlog_epoch_slip(vars, "ndb_report_thresh_binlog_epoch_slip",
&ndb_report_thresh_binlog_epoch_slip);
-sys_var_long_ptr
-sys_ndb_report_thresh_binlog_mem_usage("ndb_report_thresh_binlog_mem_usage",
+static sys_var_long_ptr
+sys_ndb_report_thresh_binlog_mem_usage(vars, "ndb_report_thresh_binlog_mem_usage",
&ndb_report_thresh_binlog_mem_usage);
#endif
-sys_var_thd_bool
-sys_ndb_use_exact_count("ndb_use_exact_count", &SV::ndb_use_exact_count);
-sys_var_thd_bool
-sys_ndb_use_transactions("ndb_use_transactions", &SV::ndb_use_transactions);
-sys_var_long_ptr
-sys_ndb_cache_check_time("ndb_cache_check_time", &ndb_cache_check_time);
-sys_var_thd_bool
-sys_ndb_index_stat_enable("ndb_index_stat_enable",
+static sys_var_thd_bool
+sys_ndb_use_exact_count(vars, "ndb_use_exact_count", &SV::ndb_use_exact_count);
+static sys_var_thd_bool
+sys_ndb_use_transactions(vars, "ndb_use_transactions", &SV::ndb_use_transactions);
+static sys_var_long_ptr
+sys_ndb_cache_check_time(vars, "ndb_cache_check_time", &ndb_cache_check_time);
+static sys_var_thd_bool
+sys_ndb_index_stat_enable(vars, "ndb_index_stat_enable",
&SV::ndb_index_stat_enable);
-sys_var_thd_ulong
-sys_ndb_index_stat_cache_entries("ndb_index_stat_cache_entries",
+static sys_var_thd_ulong
+sys_ndb_index_stat_cache_entries(vars, "ndb_index_stat_cache_entries",
&SV::ndb_index_stat_cache_entries);
-sys_var_thd_ulong
-sys_ndb_index_stat_update_freq("ndb_index_stat_update_freq",
+static sys_var_thd_ulong
+sys_ndb_index_stat_update_freq(vars, "ndb_index_stat_update_freq",
&SV::ndb_index_stat_update_freq);
-sys_var_long_ptr
-sys_ndb_extra_logging("ndb_extra_logging", &ndb_extra_logging);
-sys_var_thd_bool
-sys_ndb_use_copying_alter_table("ndb_use_copying_alter_table",
&SV::ndb_use_copying_alter_table);
+static sys_var_long_ptr
+sys_ndb_extra_logging(vars, "ndb_extra_logging", &ndb_extra_logging);
+static sys_var_thd_bool
+sys_ndb_use_copying_alter_table(vars, "ndb_use_copying_alter_table",
&SV::ndb_use_copying_alter_table);
/* Time/date/datetime formats */
-sys_var_thd_date_time_format sys_time_format("time_format",
+static sys_var_thd_date_time_format sys_time_format(vars, "time_format",
&SV::time_format,
MYSQL_TIMESTAMP_TIME);
-sys_var_thd_date_time_format sys_date_format("date_format",
+static sys_var_thd_date_time_format sys_date_format(vars, "date_format",
&SV::date_format,
MYSQL_TIMESTAMP_DATE);
-sys_var_thd_date_time_format sys_datetime_format("datetime_format",
+static sys_var_thd_date_time_format sys_datetime_format(vars, "datetime_format",
&SV::datetime_format,
MYSQL_TIMESTAMP_DATETIME);
/* Variables that are bits in THD */
-sys_var_thd_bit sys_autocommit("autocommit", 0,
+sys_var_thd_bit sys_autocommit(vars, "autocommit", 0,
set_option_autocommit,
OPTION_NOT_AUTOCOMMIT,
1);
-static sys_var_thd_bit sys_big_tables("big_tables", 0,
+static sys_var_thd_bit sys_big_tables(vars, "big_tables", 0,
set_option_bit,
OPTION_BIG_TABLES);
#ifndef TO_BE_DELETED /* Alias for big_tables */
-static sys_var_thd_bit sys_sql_big_tables("sql_big_tables", 0,
+static sys_var_thd_bit sys_sql_big_tables(vars, "sql_big_tables", 0,
set_option_bit,
OPTION_BIG_TABLES);
#endif
-static sys_var_thd_bit sys_big_selects("sql_big_selects", 0,
+static sys_var_thd_bit sys_big_selects(vars, "sql_big_selects", 0,
set_option_bit,
OPTION_BIG_SELECTS);
-static sys_var_thd_bit sys_log_off("sql_log_off",
+static sys_var_thd_bit sys_log_off(vars, "sql_log_off",
check_log_update,
set_option_bit,
OPTION_LOG_OFF);
-static sys_var_thd_bit sys_log_update("sql_log_update",
+static sys_var_thd_bit sys_log_update(vars, "sql_log_update",
check_log_update,
set_log_update,
OPTION_BIN_LOG);
-static sys_var_thd_bit sys_log_binlog("sql_log_bin",
+static sys_var_thd_bit sys_log_binlog(vars, "sql_log_bin",
check_log_update,
set_option_bit,
OPTION_BIN_LOG);
-static sys_var_thd_bit sys_sql_warnings("sql_warnings", 0,
+static sys_var_thd_bit sys_sql_warnings(vars, "sql_warnings", 0,
set_option_bit,
OPTION_WARNINGS);
-static sys_var_thd_bit sys_sql_notes("sql_notes", 0,
+static sys_var_thd_bit sys_sql_notes(vars, "sql_notes", 0,
set_option_bit,
OPTION_SQL_NOTES);
-static sys_var_thd_bit sys_auto_is_null("sql_auto_is_null", 0,
+static sys_var_thd_bit sys_auto_is_null(vars, "sql_auto_is_null", 0,
set_option_bit,
OPTION_AUTO_IS_NULL);
-static sys_var_thd_bit sys_safe_updates("sql_safe_updates", 0,
+static sys_var_thd_bit sys_safe_updates(vars, "sql_safe_updates", 0,
set_option_bit,
OPTION_SAFE_UPDATES);
-static sys_var_thd_bit sys_buffer_results("sql_buffer_result", 0,
+static sys_var_thd_bit sys_buffer_results(vars, "sql_buffer_result", 0,
set_option_bit,
OPTION_BUFFER_RESULT);
-static sys_var_thd_bit sys_quote_show_create("sql_quote_show_create", 0,
+static sys_var_thd_bit sys_quote_show_create(vars, "sql_quote_show_create", 0,
set_option_bit,
OPTION_QUOTE_SHOW_CREATE);
-static sys_var_thd_bit sys_foreign_key_checks("foreign_key_checks", 0,
+static sys_var_thd_bit sys_foreign_key_checks(vars, "foreign_key_checks", 0,
set_option_bit,
OPTION_NO_FOREIGN_KEY_CHECKS,
1);
-static sys_var_thd_bit sys_unique_checks("unique_checks", 0,
+static sys_var_thd_bit sys_unique_checks(vars, "unique_checks", 0,
set_option_bit,
OPTION_RELAXED_UNIQUE_CHECKS,
1);
/* Local state variables */
-static sys_var_thd_ha_rows sys_select_limit("sql_select_limit",
+static sys_var_thd_ha_rows sys_select_limit(vars, "sql_select_limit",
&SV::select_limit);
-static sys_var_timestamp sys_timestamp("timestamp");
-static sys_var_last_insert_id sys_last_insert_id("last_insert_id");
-static sys_var_last_insert_id sys_identity("identity");
+static sys_var_timestamp sys_timestamp(vars, "timestamp");
+static sys_var_last_insert_id sys_last_insert_id(vars, "last_insert_id");
+static sys_var_last_insert_id sys_identity(vars, "identity");
-static sys_var_thd_lc_time_names sys_lc_time_names("lc_time_names");
+static sys_var_thd_lc_time_names sys_lc_time_names(vars, "lc_time_names");
-static sys_var_insert_id sys_insert_id("insert_id");
-static sys_var_readonly sys_error_count("error_count",
+static sys_var_insert_id sys_insert_id(vars, "insert_id");
+static sys_var_readonly sys_error_count(vars, "error_count",
OPT_SESSION,
SHOW_LONG,
get_error_count);
-static sys_var_readonly sys_warning_count("warning_count",
+static sys_var_readonly sys_warning_count(vars, "warning_count",
OPT_SESSION,
SHOW_LONG,
get_warning_count);
/* alias for last_insert_id() to be compatible with Sybase */
-#ifdef HAVE_REPLICATION
-static sys_var_slave_skip_counter sys_slave_skip_counter("sql_slave_skip_counter");
-#endif
-static sys_var_rand_seed1 sys_rand_seed1("rand_seed1");
-static sys_var_rand_seed2 sys_rand_seed2("rand_seed2");
+static sys_var_rand_seed1 sys_rand_seed1(vars, "rand_seed1");
+static sys_var_rand_seed2 sys_rand_seed2(vars, "rand_seed2");
-static sys_var_thd_ulong sys_default_week_format("default_week_format",
+static sys_var_thd_ulong sys_default_week_format(vars, "default_week_format",
&SV::default_week_format);
-sys_var_thd_ulong sys_group_concat_max_len("group_concat_max_len",
+sys_var_thd_ulong sys_group_concat_max_len(vars, "group_concat_max_len",
&SV::group_concat_max_len);
-sys_var_thd_time_zone sys_time_zone("time_zone");
+sys_var_thd_time_zone sys_time_zone(vars, "time_zone");
/* Read only variables */
-sys_var_have_variable sys_have_compress("have_compress", &have_compress);
-sys_var_have_variable sys_have_crypt("have_crypt", &have_crypt);
-sys_var_have_variable sys_have_csv_db("have_csv", &have_csv_db);
-sys_var_have_variable sys_have_dlopen("have_dynamic_loading", &have_dlopen);
-sys_var_have_variable sys_have_geometry("have_geometry", &have_geometry);
-sys_var_have_variable sys_have_innodb("have_innodb", &have_innodb);
-sys_var_have_variable sys_have_ndbcluster("have_ndbcluster", &have_ndbcluster);
-sys_var_have_variable sys_have_openssl("have_openssl", &have_openssl);
-sys_var_have_variable sys_have_partition_db("have_partitioning",
- &have_partition_db);
-sys_var_have_variable sys_have_query_cache("have_query_cache",
+static sys_var_have_variable sys_have_compress(vars, "have_compress",
&have_compress);
+static sys_var_have_variable sys_have_crypt(vars, "have_crypt", &have_crypt);
+static LEX_STRING csv_name= {C_STRING_WITH_LEN("csv")};
+static sys_var_have_plugin sys_have_csv(vars, "have_csv", &csv_name,
MYSQL_STORAGE_ENGINE_PLUGIN);
+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_openssl(vars, "have_openssl", &have_openssl);
+static sys_var_have_variable sys_have_query_cache(vars, "have_query_cache",
&have_query_cache);
-sys_var_have_variable sys_have_rtree_keys("have_rtree_keys", &have_rtree_keys);
-sys_var_have_variable sys_have_symlink("have_symlink", &have_symlink);
-sys_var_have_variable
sys_have_row_based_replication("have_row_based_replication",&have_row_based_replication);
+static sys_var_have_variable sys_have_rtree_keys(vars, "have_rtree_keys",
&have_rtree_keys);
+static sys_var_have_variable sys_have_symlink(vars, "have_symlink", &have_symlink);
+static sys_var_have_variable sys_have_row_based_replication(vars,
"have_row_based_replication",&have_row_based_replication);
/* Global read-only variable describing server license */
-sys_var_const_str sys_license("license", STRINGIFY_ARG(LICENSE));
+static sys_var_const_str sys_license(vars, "license", STRINGIFY_ARG(LICENSE));
/* Global variables which enable|disable logging */
-sys_var_log_state sys_var_general_log("general_log", &opt_log,
+static sys_var_log_state sys_var_general_log(vars, "general_log", &opt_log,
QUERY_LOG_GENERAL);
-sys_var_log_state sys_var_slow_query_log("slow_query_log", &opt_slow_log,
+static sys_var_log_state sys_var_slow_query_log(vars, "slow_query_log",
&opt_slow_log,
QUERY_LOG_SLOW);
-sys_var_str sys_var_general_log_path("general_log_file", sys_check_log_path,
+sys_var_str sys_var_general_log_path(vars, "general_log_file", sys_check_log_path,
sys_update_general_log_path,
sys_default_general_log_path,
opt_logname);
-sys_var_str sys_var_slow_log_path("slow_query_log_file", sys_check_log_path,
+sys_var_str sys_var_slow_log_path(vars, "slow_query_log_file", sys_check_log_path,
sys_update_slow_log_path,
sys_default_slow_log_path,
opt_slow_logname);
-sys_var_log_output sys_var_log_output_state("log_output", &log_output_options,
+static sys_var_log_output sys_var_log_output_state(vars, "log_output",
&log_output_options,
&log_output_typelib, 0);
-#ifdef HAVE_REPLICATION
-static int show_slave_skip_errors(THD *thd, SHOW_VAR *var, char *buff)
-{
- var->type=SHOW_CHAR;
- var->value= buff;
- if (!use_slave_mask || bitmap_is_clear_all(&slave_error_mask))
- {
- var->value= const_cast<char *>("OFF");
- }
- else if (bitmap_is_set_all(&slave_error_mask))
- {
- var->value= const_cast<char *>("ALL");
- }
- else
- {
- /* 10 is enough assuming errors are max 4 digits */
- int i;
- var->value= buff;
- for (i= 1;
- i < MAX_SLAVE_ERROR &&
- (buff - var->value) < SHOW_VAR_FUNC_BUFF_SIZE;
- i++)
- {
- if (bitmap_is_set(&slave_error_mask, i))
- {
- buff= int10_to_str(i, buff, 10);
- *buff++= ',';
- }
- }
- if (var->value != buff)
- buff--; // Remove last ','
- if (i < MAX_SLAVE_ERROR)
- buff= strmov(buff, "..."); // Couldn't show all errors
- *buff=0;
- }
- return 0;
-}
-#endif /* HAVE_REPLICATION */
/*
- Variables shown by SHOW VARIABLES in alphabetical order
+ Additional variables shown by SHOW VARIABLES
+ order is unimportant as it will be sorted.
*/
-SHOW_VAR init_vars[]= {
- {"auto_increment_increment", (char*) &sys_auto_increment_increment, SHOW_SYS},
- {"auto_increment_offset", (char*) &sys_auto_increment_offset, SHOW_SYS},
- {sys_automatic_sp_privileges.name,(char*) &sys_automatic_sp_privileges,
SHOW_SYS},
+static SHOW_VAR fixed_vars[]= {
{"back_log", (char*) &back_log, SHOW_LONG},
- {sys_basedir.name, (char*) &sys_basedir, SHOW_SYS},
- {sys_binlog_cache_size.name,(char*) &sys_binlog_cache_size, SHOW_SYS},
- {sys_binlog_format.name, (char*) &sys_binlog_format, SHOW_SYS},
- {sys_bulk_insert_buff_size.name,(char*) &sys_bulk_insert_buff_size,SHOW_SYS},
- {sys_character_set_client.name,(char*) &sys_character_set_client, SHOW_SYS},
- {sys_character_set_connection.name,(char*) &sys_character_set_connection,SHOW_SYS},
- {sys_character_set_database.name, (char*) &sys_character_set_database,SHOW_SYS},
- {sys_character_set_filesystem.name,(char*) &sys_character_set_filesystem,
SHOW_SYS},
- {sys_character_set_results.name,(char*) &sys_character_set_results, SHOW_SYS},
- {sys_character_set_server.name, (char*) &sys_character_set_server,SHOW_SYS},
- {sys_charset_system.name, (char*) &sys_charset_system, SHOW_SYS},
{"character_sets_dir", mysql_charsets_dir, SHOW_CHAR},
- {sys_collation_connection.name,(char*) &sys_collation_connection, SHOW_SYS},
- {sys_collation_database.name,(char*) &sys_collation_database, SHOW_SYS},
- {sys_collation_server.name,(char*) &sys_collation_server, SHOW_SYS},
- {sys_completion_type.name, (char*) &sys_completion_type, SHOW_SYS},
- {sys_concurrent_insert.name,(char*) &sys_concurrent_insert, SHOW_SYS},
- {sys_connect_timeout.name, (char*) &sys_connect_timeout, SHOW_SYS},
- {sys_datadir.name, (char*) &sys_datadir, SHOW_SYS},
- {sys_date_format.name, (char*) &sys_date_format, SHOW_SYS},
- {sys_datetime_format.name, (char*) &sys_datetime_format, SHOW_SYS},
-#ifndef DBUG_OFF
- {sys_dbug.name, (char*) &sys_dbug, SHOW_SYS},
-#endif
- {sys_default_week_format.name, (char*) &sys_default_week_format, SHOW_SYS},
- {sys_delay_key_write.name, (char*) &sys_delay_key_write, SHOW_SYS},
- {sys_delayed_insert_limit.name, (char*) &sys_delayed_insert_limit,SHOW_SYS},
- {sys_delayed_insert_timeout.name, (char*) &sys_delayed_insert_timeout, SHOW_SYS},
- {sys_delayed_queue_size.name,(char*) &sys_delayed_queue_size, SHOW_SYS},
- {sys_div_precincrement.name,(char*) &sys_div_precincrement,SHOW_SYS},
- {sys_engine_condition_pushdown.name,
- (char*) &sys_engine_condition_pushdown, SHOW_SYS},
- {sys_event_scheduler.name, (char*) &sys_event_scheduler, SHOW_SYS},
- {sys_expire_logs_days.name, (char*) &sys_expire_logs_days, SHOW_SYS},
- {sys_flush.name, (char*) &sys_flush, SHOW_SYS},
- {sys_flush_time.name, (char*) &sys_flush_time, SHOW_SYS},
- {sys_ft_boolean_syntax.name,(char*) &ft_boolean_syntax, SHOW_CHAR},
{"ft_max_word_len", (char*) &ft_max_word_len, SHOW_LONG},
{"ft_min_word_len", (char*) &ft_min_word_len, SHOW_LONG},
{"ft_query_expansion_limit",(char*) &ft_query_expansion_limit, SHOW_LONG},
{"ft_stopword_file", (char*) &ft_stopword_file, SHOW_CHAR_PTR},
- {sys_var_general_log.name, (char*) &opt_log, SHOW_MY_BOOL},
- {sys_var_general_log_path.name, (char*) &sys_var_general_log_path, SHOW_SYS},
- {sys_group_concat_max_len.name, (char*) &sys_group_concat_max_len, SHOW_SYS},
- {sys_have_compress.name, (char*) &have_compress, SHOW_HAVE},
- {sys_have_crypt.name, (char*) &have_crypt, SHOW_HAVE},
- {sys_have_csv_db.name, (char*) &have_csv_db, SHOW_HAVE},
- {sys_have_dlopen.name, (char*) &have_dlopen, SHOW_HAVE},
- {sys_have_geometry.name, (char*) &have_geometry, SHOW_HAVE},
- {sys_have_innodb.name, (char*) &have_innodb, SHOW_HAVE},
- {sys_have_ndbcluster.name, (char*) &have_ndbcluster, SHOW_HAVE},
- {sys_have_openssl.name, (char*) &have_openssl, SHOW_HAVE},
- {sys_have_partition_db.name,(char*) &have_partition_db, SHOW_HAVE},
- {sys_have_query_cache.name, (char*) &have_query_cache, SHOW_HAVE},
- {sys_have_row_based_replication.name, (char*) &have_row_based_replication,
SHOW_HAVE},
- {sys_have_rtree_keys.name, (char*) &have_rtree_keys, SHOW_HAVE},
- {sys_have_symlink.name, (char*) &have_symlink, SHOW_HAVE},
- {"init_connect", (char*) &sys_init_connect, SHOW_SYS},
{"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR},
- {"init_slave", (char*) &sys_init_slave, SHOW_SYS},
-#ifdef WITH_INNOBASE_STORAGE_ENGINE
- {"innodb_additional_mem_pool_size", (char*) &innobase_additional_mem_pool_size,
SHOW_LONG },
- {sys_innodb_autoextend_increment.name, (char*) &sys_innodb_autoextend_increment,
SHOW_SYS},
- {"innodb_buffer_pool_size", (char*) &innobase_buffer_pool_size, SHOW_LONGLONG },
- {"innodb_checksums", (char*) &innobase_use_checksums, SHOW_MY_BOOL},
- {sys_innodb_commit_concurrency.name, (char*) &sys_innodb_commit_concurrency,
SHOW_SYS},
- {sys_innodb_concurrency_tickets.name, (char*) &sys_innodb_concurrency_tickets,
SHOW_SYS},
- {"innodb_data_file_path", (char*) &innobase_data_file_path, SHOW_CHAR_PTR},
- {"innodb_data_home_dir", (char*) &innobase_data_home_dir, SHOW_CHAR_PTR},
- {"innodb_doublewrite", (char*) &innobase_use_doublewrite, SHOW_MY_BOOL},
- {sys_innodb_fast_shutdown.name,(char*) &sys_innodb_fast_shutdown, SHOW_SYS},
- {"innodb_file_io_threads", (char*) &innobase_file_io_threads, SHOW_LONG },
- {"innodb_file_per_table", (char*) &innobase_file_per_table, SHOW_MY_BOOL},
- {"innodb_flush_method", (char*) &innobase_unix_file_flush_method,
SHOW_CHAR_PTR},
- {"innodb_force_recovery", (char*) &innobase_force_recovery, SHOW_LONG },
- {"innodb_lock_wait_timeout", (char*) &innobase_lock_wait_timeout, SHOW_LONG },
- {"innodb_locks_unsafe_for_binlog", (char*) &innobase_locks_unsafe_for_binlog,
SHOW_MY_BOOL},
- {"innodb_log_arch_dir", (char*) &innobase_log_arch_dir, SHOW_CHAR_PTR},
- {"innodb_log_archive", (char*) &innobase_log_archive, SHOW_MY_BOOL},
- {"innodb_log_buffer_size", (char*) &innobase_log_buffer_size, SHOW_LONG },
- {"innodb_log_file_size", (char*) &innobase_log_file_size, SHOW_LONGLONG},
- {"innodb_log_files_in_group", (char*) &innobase_log_files_in_group, SHOW_LONG},
- {"innodb_log_group_home_dir", (char*) &innobase_log_group_home_dir, SHOW_CHAR_PTR},
- {sys_innodb_max_dirty_pages_pct.name, (char*) &sys_innodb_max_dirty_pages_pct,
SHOW_SYS},
- {sys_innodb_max_purge_lag.name, (char*) &sys_innodb_max_purge_lag, SHOW_SYS},
- {"innodb_mirrored_log_groups", (char*) &innobase_mirrored_log_groups, SHOW_LONG},
- {"innodb_open_files", (char*) &innobase_open_files, SHOW_LONG },
- {sys_innodb_support_xa.name, (char*) &sys_innodb_support_xa, SHOW_SYS},
- {sys_innodb_sync_spin_loops.name, (char*) &sys_innodb_sync_spin_loops, SHOW_SYS},
- {sys_innodb_table_locks.name, (char*) &sys_innodb_table_locks, SHOW_SYS},
- {sys_innodb_thread_concurrency.name, (char*) &sys_innodb_thread_concurrency,
SHOW_SYS},
- {sys_innodb_thread_sleep_delay.name, (char*) &sys_innodb_thread_sleep_delay,
SHOW_SYS},
- {sys_innodb_flush_log_at_trx_commit.name, (char*)
&sys_innodb_flush_log_at_trx_commit, SHOW_SYS},
-#endif
- {sys_interactive_timeout.name,(char*) &sys_interactive_timeout, SHOW_SYS},
- {sys_join_buffer_size.name, (char*) &sys_join_buffer_size, SHOW_SYS},
- {sys_key_buffer_size.name, (char*) &sys_key_buffer_size, SHOW_SYS},
- {sys_key_cache_age_threshold.name, (char*) &sys_key_cache_age_threshold,
- SHOW_SYS},
- {sys_key_cache_block_size.name, (char*) &sys_key_cache_block_size,
- SHOW_SYS},
- {sys_key_cache_division_limit.name, (char*) &sys_key_cache_division_limit,
- SHOW_SYS},
{"language", language, SHOW_CHAR},
{"large_files_support", (char*) &opt_large_files, SHOW_BOOL},
{"large_page_size", (char*) &opt_large_page_size, SHOW_INT},
{"large_pages", (char*) &opt_large_pages, SHOW_MY_BOOL},
- {sys_lc_time_names.name, (char*) &sys_lc_time_names, SHOW_SYS},
- {sys_license.name, (char*) &sys_license, SHOW_SYS},
- {sys_local_infile.name, (char*) &sys_local_infile, SHOW_SYS},
#ifdef HAVE_MLOCKALL
{"locked_in_memory", (char*) &locked_in_memory, SHOW_BOOL},
#endif
{"log", (char*) &opt_log, SHOW_BOOL},
{"log_bin", (char*) &opt_bin_log, SHOW_BOOL},
- {sys_trust_function_creators.name,(char*) &sys_trust_function_creators, SHOW_SYS},
{"log_error", (char*) log_error_file, SHOW_CHAR},
- {sys_var_log_output_state.name, (char*) &sys_var_log_output_state, SHOW_SYS},
- {sys_log_queries_not_using_indexes.name,
- (char*) &sys_log_queries_not_using_indexes, SHOW_SYS},
-#ifdef HAVE_REPLICATION
- {"log_slave_updates", (char*) &opt_log_slave_updates, SHOW_MY_BOOL},
-#endif
{"log_slow_queries", (char*) &opt_slow_log, SHOW_BOOL},
- {sys_log_warnings.name, (char*) &sys_log_warnings, SHOW_SYS},
- {sys_long_query_time.name, (char*) &sys_long_query_time, SHOW_SYS},
- {sys_low_priority_updates.name, (char*) &sys_low_priority_updates, SHOW_SYS},
{"lower_case_file_system", (char*) &lower_case_file_system, SHOW_MY_BOOL},
{"lower_case_table_names", (char*) &lower_case_table_names, SHOW_INT},
- {sys_max_allowed_packet.name,(char*) &sys_max_allowed_packet, SHOW_SYS},
- {sys_max_binlog_cache_size.name,(char*) &sys_max_binlog_cache_size, SHOW_SYS},
- {sys_max_binlog_size.name, (char*) &sys_max_binlog_size, SHOW_SYS},
- {sys_max_connect_errors.name, (char*) &sys_max_connect_errors, SHOW_SYS},
- {sys_max_connections.name, (char*) &sys_max_connections, SHOW_SYS},
- {sys_max_delayed_threads.name,(char*) &sys_max_delayed_threads, SHOW_SYS},
- {sys_max_error_count.name, (char*) &sys_max_error_count, SHOW_SYS},
- {sys_max_heap_table_size.name,(char*) &sys_max_heap_table_size, SHOW_SYS},
- {sys_max_insert_delayed_threads.name,
- (char*) &sys_max_insert_delayed_threads, SHOW_SYS},
- {sys_max_join_size.name, (char*) &sys_max_join_size, SHOW_SYS},
- {sys_max_length_for_sort_data.name, (char*) &sys_max_length_for_sort_data,
- SHOW_SYS},
- {sys_max_prepared_stmt_count.name, (char*) &sys_max_prepared_stmt_count,
- SHOW_SYS},
- {sys_max_relay_log_size.name, (char*) &sys_max_relay_log_size, SHOW_SYS},
- {sys_max_seeks_for_key.name, (char*) &sys_max_seeks_for_key, SHOW_SYS},
- {sys_max_sort_length.name, (char*) &sys_max_sort_length, SHOW_SYS},
- {sys_max_sp_recursion_depth.name,
- (char*) &sys_max_sp_recursion_depth, SHOW_SYS},
- {sys_max_tmp_tables.name, (char*) &sys_max_tmp_tables, SHOW_SYS},
- {sys_max_user_connections.name,(char*) &sys_max_user_connections, SHOW_SYS},
- {sys_max_write_lock_count.name, (char*) &sys_max_write_lock_count,SHOW_SYS},
- {sys_multi_range_count.name, (char*) &sys_multi_range_count, SHOW_SYS},
- {sys_myisam_data_pointer_size.name, (char*) &sys_myisam_data_pointer_size,
SHOW_SYS},
- {sys_myisam_max_sort_file_size.name, (char*) &sys_myisam_max_sort_file_size,
- SHOW_SYS},
{"myisam_recover_options", (char*) &myisam_recover_options_str, SHOW_CHAR_PTR},
- {sys_myisam_repair_threads.name, (char*) &sys_myisam_repair_threads,
- SHOW_SYS},
- {sys_myisam_sort_buffer_size.name, (char*) &sys_myisam_sort_buffer_size, SHOW_SYS},
-
- {sys_myisam_stats_method.name, (char*) &sys_myisam_stats_method, SHOW_SYS},
- {sys_myisam_use_mmap.name, (char*) &sys_myisam_use_mmap, SHOW_SYS},
-
#ifdef __NT__
{"named_pipe", (char*) &opt_enable_named_pipe, SHOW_MY_BOOL},
#endif
- {sys_ndb_autoincrement_prefetch_sz.name,
- (char*) &sys_ndb_autoincrement_prefetch_sz, SHOW_SYS},
- {sys_ndb_cache_check_time.name,(char*) &sys_ndb_cache_check_time, SHOW_SYS},
- {sys_ndb_extra_logging.name,(char*) &sys_ndb_extra_logging, SHOW_SYS},
- {sys_ndb_force_send.name, (char*) &sys_ndb_force_send, SHOW_SYS},
- {sys_ndb_index_stat_cache_entries.name, (char*) &sys_ndb_index_stat_cache_entries,
SHOW_SYS},
- {sys_ndb_index_stat_enable.name, (char*) &sys_ndb_index_stat_enable, SHOW_SYS},
- {sys_ndb_index_stat_update_freq.name, (char*) &sys_ndb_index_stat_update_freq,
SHOW_SYS},
-#ifdef HAVE_NDB_BINLOG
- {sys_ndb_report_thresh_binlog_epoch_slip.name,
- (char*) &sys_ndb_report_thresh_binlog_epoch_slip, SHOW_SYS},
- {sys_ndb_report_thresh_binlog_mem_usage.name,
- (char*) &sys_ndb_report_thresh_binlog_mem_usage, SHOW_SYS},
-#endif
- {sys_ndb_use_copying_alter_table.name,
- (char*) &sys_ndb_use_copying_alter_table, SHOW_SYS},
- {sys_ndb_use_exact_count.name,(char*) &sys_ndb_use_exact_count, SHOW_SYS},
- {sys_ndb_use_transactions.name,(char*) &sys_ndb_use_transactions, SHOW_SYS},
- {sys_net_buffer_length.name,(char*) &sys_net_buffer_length, SHOW_SYS},
- {sys_net_read_timeout.name, (char*) &sys_net_read_timeout, SHOW_SYS},
- {sys_net_retry_count.name, (char*) &sys_net_retry_count, SHOW_SYS},
- {sys_net_write_timeout.name,(char*) &sys_net_write_timeout, SHOW_SYS},
- {sys_new_mode.name, (char*) &sys_new_mode, SHOW_SYS},
- {sys_old_alter_table.name, (char*) &sys_old_alter_table, SHOW_SYS},
- {sys_old_passwords.name, (char*) &sys_old_passwords, SHOW_SYS},
{"open_files_limit", (char*) &open_files_limit, SHOW_LONG},
- {sys_optimizer_prune_level.name, (char*) &sys_optimizer_prune_level,
- SHOW_SYS},
- {sys_optimizer_search_depth.name,(char*) &sys_optimizer_search_depth,
- SHOW_SYS},
{"pid_file", (char*) pidfile_name, SHOW_CHAR},
{"plugin_dir", (char*) opt_plugin_dir, SHOW_CHAR},
{"port", (char*) &mysqld_port, SHOW_INT},
- {sys_preload_buff_size.name, (char*) &sys_preload_buff_size, SHOW_SYS},
{"protocol_version", (char*) &protocol_version, SHOW_INT},
- {sys_query_alloc_block_size.name, (char*) &sys_query_alloc_block_size,
- SHOW_SYS},
-#ifdef HAVE_QUERY_CACHE
- {sys_query_cache_limit.name,(char*) &sys_query_cache_limit, SHOW_SYS},
- {sys_query_cache_min_res_unit.name, (char*) &sys_query_cache_min_res_unit,
- SHOW_SYS},
- {sys_query_cache_size.name, (char*) &sys_query_cache_size, SHOW_SYS},
- {sys_query_cache_type.name, (char*) &sys_query_cache_type, SHOW_SYS},
- {sys_query_cache_wlock_invalidate.name,
- (char *) &sys_query_cache_wlock_invalidate, SHOW_SYS},
-#endif /* HAVE_QUERY_CACHE */
- {sys_query_prealloc_size.name, (char*) &sys_query_prealloc_size, SHOW_SYS},
- {sys_range_alloc_block_size.name, (char*) &sys_range_alloc_block_size,
- SHOW_SYS},
- {sys_read_buff_size.name, (char*) &sys_read_buff_size, SHOW_SYS},
- {sys_readonly.name, (char*) &sys_readonly, SHOW_SYS},
- {sys_read_rnd_buff_size.name,(char*) &sys_read_rnd_buff_size, SHOW_SYS},
-#ifdef HAVE_REPLICATION
- {sys_relay_log_purge.name, (char*) &sys_relay_log_purge, SHOW_SYS},
- {"relay_log_space_limit", (char*) &relay_log_space_limit, SHOW_LONGLONG},
-#endif
- {sys_rpl_recovery_rank.name,(char*) &sys_rpl_recovery_rank, SHOW_SYS},
- {"secure_auth", (char*) &sys_secure_auth, SHOW_SYS},
#ifdef HAVE_SMEM
{"shared_memory", (char*) &opt_enable_shared_memory, SHOW_MY_BOOL},
{"shared_memory_base_name", (char*) &shared_memory_base_name, SHOW_CHAR_PTR},
#endif
- {sys_server_id.name, (char*) &sys_server_id, SHOW_SYS},
{"skip_external_locking", (char*) &my_disable_locking, SHOW_MY_BOOL},
{"skip_networking", (char*) &opt_disable_networking, SHOW_BOOL},
{"skip_show_database", (char*) &opt_skip_show_db, SHOW_BOOL},
-#ifdef HAVE_REPLICATION
- {sys_slave_compressed_protocol.name,
- (char*) &sys_slave_compressed_protocol, SHOW_SYS},
- {"slave_load_tmpdir", (char*) &slave_load_tmpdir, SHOW_CHAR_PTR},
- {sys_slave_net_timeout.name,(char*) &sys_slave_net_timeout, SHOW_SYS},
- {"slave_skip_errors", (char*) &show_slave_skip_errors, SHOW_FUNC},
- {sys_slave_trans_retries.name,(char*) &sys_slave_trans_retries, SHOW_SYS},
-#endif
- {sys_slow_launch_time.name, (char*) &sys_slow_launch_time, SHOW_SYS},
- {sys_var_slow_query_log.name, (char*) &opt_slow_log, SHOW_MY_BOOL},
- {sys_var_slow_log_path.name, (char*) &sys_var_slow_log_path, SHOW_SYS},
#ifdef HAVE_SYS_UN_H
{"socket", (char*) &mysqld_unix_port, SHOW_CHAR_PTR},
#endif
- {sys_sort_buffer.name, (char*) &sys_sort_buffer, SHOW_SYS},
- {sys_big_selects.name, (char*) &sys_big_selects, SHOW_SYS},
- {sys_sql_mode.name, (char*) &sys_sql_mode, SHOW_SYS},
- {"sql_notes", (char*) &sys_sql_notes, SHOW_SYS},
- {"sql_warnings", (char*) &sys_sql_warnings, SHOW_SYS},
- {sys_ssl_ca.name, (char*) &sys_ssl_ca, SHOW_SYS},
- {sys_ssl_capath.name, (char*) &sys_ssl_capath, SHOW_SYS},
- {sys_ssl_cert.name, (char*) &sys_ssl_cert, SHOW_SYS},
- {sys_ssl_cipher.name, (char*) &sys_ssl_cipher, SHOW_SYS},
- {sys_ssl_key.name, (char*) &sys_ssl_key, SHOW_SYS},
- {sys_storage_engine.name, (char*) &sys_storage_engine, SHOW_SYS},
-#ifdef HAVE_REPLICATION
- {sys_sync_binlog_period.name,(char*) &sys_sync_binlog_period, SHOW_SYS},
-#endif
- {sys_sync_frm.name, (char*) &sys_sync_frm, SHOW_SYS},
#ifdef HAVE_TZNAME
{"system_time_zone", system_time_zone, SHOW_CHAR},
#endif
{"table_definition_cache", (char*) &table_def_size, SHOW_LONG},
{"table_lock_wait_timeout", (char*) &table_lock_wait_timeout, SHOW_LONG },
{"table_open_cache", (char*) &table_cache_size, SHOW_LONG},
- {sys_table_type.name, (char*) &sys_table_type, SHOW_SYS},
- {sys_thread_cache_size.name,(char*) &sys_thread_cache_size, SHOW_SYS},
#ifdef HAVE_THR_SETCONCURRENCY
{"thread_concurrency", (char*) &concurrency, SHOW_LONG},
#endif
{"thread_stack", (char*) &thread_stack, SHOW_LONG},
- {sys_time_format.name, (char*) &sys_time_format, SHOW_SYS},
- {"time_zone", (char*) &sys_time_zone, SHOW_SYS},
- {sys_timed_mutexes.name, (char*) &sys_timed_mutexes, SHOW_SYS},
- {sys_tmp_table_size.name, (char*) &sys_tmp_table_size, SHOW_SYS},
- {sys_tmpdir.name, (char*) &sys_tmpdir, SHOW_SYS},
- {sys_trans_alloc_block_size.name, (char*) &sys_trans_alloc_block_size,
- SHOW_SYS},
- {sys_trans_prealloc_size.name, (char*) &sys_trans_prealloc_size, SHOW_SYS},
- {sys_tx_isolation.name, (char*) &sys_tx_isolation, SHOW_SYS},
- {sys_updatable_views_with_limit.name,
- (char*) &sys_updatable_views_with_limit,SHOW_SYS},
- {sys_version.name, (char*) &sys_version, SHOW_SYS},
- {sys_version_comment.name, (char*) &sys_version_comment, SHOW_SYS},
- {sys_version_compile_machine.name, (char*) &sys_version_compile_machine,
- SHOW_SYS},
- {sys_version_compile_os.name, (char*) &sys_version_compile_os, SHOW_SYS},
- {sys_net_wait_timeout.name, (char*) &sys_net_wait_timeout, SHOW_SYS},
- {NullS, NullS, SHOW_LONG}
};
@@ -1328,7 +965,8 @@
/*
Cluster does not support changing the binlog format on the fly yet.
*/
- if (opt_bin_log && (have_ndbcluster == SHOW_OPTION_YES))
+ LEX_STRING ndb_name= {(char*)STRING_WITH_LEN("ndbcluster")};
+ if (opt_bin_log && plugin_is_ready(&ndb_name, MYSQL_STORAGE_ENGINE_PLUGIN))
{
my_error(ER_NDB_CANT_SWITCH_BINLOG_FORMAT, MYF(0));
return 1;
@@ -1422,9 +1060,9 @@
sys_var_long_ptr::
-sys_var_long_ptr(const char *name_arg, ulong *value_ptr,
+sys_var_long_ptr(sys_var_chain &chain, const char *name_arg, ulong *value_ptr,
sys_after_update_func after_update_arg)
- :sys_var_long_ptr_global(name_arg, value_ptr,
+ :sys_var_long_ptr_global(chain, name_arg, value_ptr,
&LOCK_global_system_variables, after_update_arg)
{}
@@ -2803,52 +2441,6 @@
}
-#ifdef HAVE_REPLICATION
-bool sys_var_slave_skip_counter::check(THD *thd, set_var *var)
-{
- int result= 0;
- pthread_mutex_lock(&LOCK_active_mi);
- pthread_mutex_lock(&active_mi->rli.run_lock);
- if (active_mi->rli.slave_running)
- {
- my_message(ER_SLAVE_MUST_STOP, ER(ER_SLAVE_MUST_STOP), MYF(0));
- result=1;
- }
- pthread_mutex_unlock(&active_mi->rli.run_lock);
- pthread_mutex_unlock(&LOCK_active_mi);
- var->save_result.ulong_value= (ulong) var->value->val_int();
- return result;
-}
-
-
-bool sys_var_slave_skip_counter::update(THD *thd, set_var *var)
-{
- pthread_mutex_lock(&LOCK_active_mi);
- pthread_mutex_lock(&active_mi->rli.run_lock);
- /*
- The following test should normally never be true as we test this
- in the check function; To be safe against multiple
- SQL_SLAVE_SKIP_COUNTER request, we do the check anyway
- */
- if (!active_mi->rli.slave_running)
- {
- pthread_mutex_lock(&active_mi->rli.data_lock);
- active_mi->rli.slave_skip_counter= var->save_result.ulong_value;
- pthread_mutex_unlock(&active_mi->rli.data_lock);
- }
- pthread_mutex_unlock(&active_mi->rli.run_lock);
- pthread_mutex_unlock(&LOCK_active_mi);
- return 0;
-}
-
-
-bool sys_var_sync_binlog_period::update(THD *thd, set_var *var)
-{
- sync_binlog_period= (ulong) var->save_result.ulonglong_value;
- return 0;
-}
-#endif /* HAVE_REPLICATION */
-
bool sys_var_rand_seed1::update(THD *thd, set_var *var)
{
thd->rand.seed1= (ulong) var->save_result.ulonglong_value;
@@ -2862,6 +2454,12 @@
}
+byte *sys_var_have_plugin::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
+{
+ return (byte*) show_comp_option_name[plugin_status(plugin_name, plugin_type)];
+}
+
+
bool sys_var_thd_time_zone::check(THD *thd, set_var *var)
{
char buff[MAX_TIME_ZONE_NAME_LENGTH];
@@ -3214,19 +2812,96 @@
Initialises sys variables and put them in system_variable_hash
*/
+int mysql_add_sys_var_chain(sys_var *first, struct my_option *long_options)
+{
+ for (sys_var *var= first; var; var= var->next)
+ {
+ var->name_length= strlen(var->name);
+ /* check if conflicting variable already exists */
+ if (hash_search(&system_variable_hash, var->name, var->name_length))
+ goto error;
+ var->option_limits= find_option(long_options, var->name);
+ if (my_hash_insert(&system_variable_hash, (byte*) var))
+ goto error;
+ }
+ return 0;
+error:
+ for (sys_var *var= first; var; var= var->next)
+ if (hash_delete(&system_variable_hash, (byte*) var))
+ break;
+ return 1;
+}
+
-void set_var_init()
+int mysql_del_sys_var_chain(sys_var *first)
{
- sys_var *var;
+ int result= 0;
+ for (sys_var *var= first; var; var= var->next)
+ if (hash_delete(&system_variable_hash, (byte*) var))
+ result= 1;
+ return result;
+}
- hash_init(&system_variable_hash, system_charset_info, sys_var::sys_vars, 0,
- 0, (hash_get_key) get_sys_var_length, 0, 0);
- for (var= sys_var::first; var; var= var->next)
+
+static int show_cmp(SHOW_VAR *a, SHOW_VAR *b)
+{
+ return strcmp(a->name, b->name);
+}
+
+SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted)
+{
+ int count= system_variable_hash.records, i;
+ int fixed_count= fixed_show_vars.elements;
+ int size= sizeof(SHOW_VAR) * (count + fixed_count + 1);
+ SHOW_VAR *result= (SHOW_VAR*) thd->alloc(size);
+ if (result)
{
- var->name_length= strlen(var->name);
- var->option_limits= find_option(my_long_options, var->name);
- my_hash_insert(&system_variable_hash, (byte*) var);
+ SHOW_VAR *show= result + fixed_count;
+ memcpy(result, fixed_show_vars.buffer, fixed_count * sizeof(SHOW_VAR));
+
+ for (i= 0; i < count; i++)
+ {
+ sys_var *var= (sys_var*) hash_element(&system_variable_hash, i);
+ show->name= var->name;
+ show->value= (char*) var;
+ show->type= SHOW_SYS;
+ show++;
+ }
+
+ /* sort into order */
+ if (sorted)
+ qsort(result, count + fixed_count, sizeof(SHOW_VAR), (qsort_cmp)show_cmp);
+
+ /* make last element empty */
+ bzero(show, sizeof(SHOW_VAR));
}
+ return result;
+}
+
+
+int set_var_init()
+{
+ sys_var *var;
+ uint count= 0;
+ DBUG_ENTER("set_var_init");
+
+ for (sys_var *var=vars.first; var; var= var->next, count++);
+
+ if (my_init_dynamic_array(&fixed_show_vars, sizeof(SHOW_VAR),
+ sizeof(fixed_vars) / sizeof(SHOW_VAR) + 64, 64))
+ goto error;
+
+ fixed_show_vars.elements= sizeof(fixed_vars) / sizeof(SHOW_VAR);
+ memcpy(fixed_show_vars.buffer, fixed_vars, sizeof(fixed_vars));
+
+ if (hash_init(&system_variable_hash, system_charset_info, count, 0,
+ 0, (hash_get_key) get_sys_var_length, 0, 0))
+ goto error;
+
+ vars.last->next= NULL;
+ if (mysql_add_sys_var_chain(vars.first, my_long_options))
+ goto error;
+
/*
Special cases
Needed because MySQL can't find the limits for a variable it it has
@@ -3234,12 +2909,28 @@
As these variables are deprecated, this code will disappear soon...
*/
sys_sql_max_join_size.option_limits= sys_max_join_size.option_limits;
+ DBUG_RETURN(0);
+
+error:
+ fprintf(stderr, "failed to initialize system variables");
+ unireg_abort(1);
+ DBUG_RETURN(1); /* unreachable */
}
void set_var_free()
{
hash_free(&system_variable_hash);
+ delete_dynamic(&fixed_show_vars);
+}
+
+
+int mysql_append_static_vars(const SHOW_VAR *show_vars, uint count)
+{
+ for (; count > 0; count--, show_vars++)
+ if (insert_dynamic(&fixed_show_vars, (char*) show_vars))
+ return 1;
+ return 0;
}
--- 1.93/sql/set_var.h 2006-12-21 16:54:34 -08:00
+++ 1.94/sql/set_var.h 2006-12-21 16:54:34 -08:00
@@ -27,6 +27,7 @@
class sys_var;
class set_var;
+class sys_var_pluginvar; /* opaque */
typedef struct system_variables SV;
typedef struct my_locale_st MY_LOCALE;
@@ -38,11 +39,15 @@
typedef void (*sys_set_default_func)(THD *, enum_var_type);
typedef byte *(*sys_value_ptr_func)(THD *thd);
+struct sys_var_chain
+{
+ sys_var *first;
+ sys_var *last;
+};
+
class sys_var
{
public:
- static sys_var *first;
- static uint sys_vars;
sys_var *next;
struct my_option *option_limits; /* Updated by by set_var_init() */
uint name_length; /* Updated by by set_var_init() */
@@ -50,17 +55,17 @@
sys_after_update_func after_update;
bool no_support_one_shot;
- sys_var(const char *name_arg,sys_after_update_func func= NULL)
+ sys_var(sys_var_chain &chain, const char *name_arg,sys_after_update_func func=
NULL)
:name(name_arg), after_update(func)
, no_support_one_shot(1)
- { add_sys_var(); }
- virtual ~sys_var() {}
- void add_sys_var()
{
- next= first;
- first= this;
- sys_vars++;
+ if (chain.last)
+ chain.last->next= this;
+ else
+ chain.first= this;
+ chain.last= this;
}
+ virtual ~sys_var() {}
virtual bool check(THD *thd, set_var *var);
bool check_enum(THD *thd, set_var *var, TYPELIB *enum_names);
bool check_set(THD *thd, set_var *var, TYPELIB *enum_names);
@@ -78,6 +83,7 @@
Item *item(THD *thd, enum_var_type type, LEX_STRING *base);
virtual bool is_struct() { return 0; }
virtual bool is_readonly() const { return 0; }
+ virtual sys_var_pluginvar *cast_pluginvar() { return 0; }
};
@@ -91,9 +97,10 @@
protected:
pthread_mutex_t *guard;
public:
- sys_var_global(const char *name_arg, sys_after_update_func after_update_arg,
+ sys_var_global(sys_var_chain &chain, const char *name_arg,
+ sys_after_update_func after_update_arg,
pthread_mutex_t *guard_arg)
- :sys_var(name_arg, after_update_arg), guard(guard_arg) {}
+ :sys_var(chain, name_arg, after_update_arg), guard(guard_arg) {}
};
@@ -106,10 +113,11 @@
{
public:
ulong *value;
- sys_var_long_ptr_global(const char *name_arg, ulong *value_ptr,
+ sys_var_long_ptr_global(sys_var_chain &chain, const char *name_arg, ulong
*value_ptr,
pthread_mutex_t *guard_arg,
sys_after_update_func after_update_arg= NULL)
- :sys_var_global(name_arg, after_update_arg, guard_arg), value(value_ptr) {}
+ :sys_var_global(chain, name_arg, after_update_arg, guard_arg),
+ value(value_ptr) {}
bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
@@ -126,7 +134,7 @@
class sys_var_long_ptr :public sys_var_long_ptr_global
{
public:
- sys_var_long_ptr(const char *name_arg, ulong *value_ptr,
+ sys_var_long_ptr(sys_var_chain &chain, const char *name_arg, ulong *value_ptr,
sys_after_update_func after_update_arg= NULL);
};
@@ -135,11 +143,13 @@
{
public:
ulonglong *value;
- sys_var_ulonglong_ptr(const char *name_arg, ulonglong *value_ptr)
- :sys_var(name_arg),value(value_ptr) {}
- sys_var_ulonglong_ptr(const char *name_arg, ulonglong *value_ptr,
+ sys_var_ulonglong_ptr(sys_var_chain &chain, const char *name_arg,
+ ulonglong *value_ptr)
+ :sys_var(chain, name_arg),value(value_ptr) {}
+ sys_var_ulonglong_ptr(sys_var_chain &chain, const char *name_arg,
+ ulonglong *value_ptr,
sys_after_update_func func)
- :sys_var(name_arg,func), value(value_ptr) {}
+ :sys_var(chain, name_arg,func), value(value_ptr) {}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
SHOW_TYPE type() { return SHOW_LONGLONG; }
@@ -152,8 +162,8 @@
{
public:
my_bool *value;
- sys_var_bool_ptr(const char *name_arg, my_bool *value_arg)
- :sys_var(name_arg),value(value_arg)
+ sys_var_bool_ptr(sys_var_chain &chain, const char *name_arg, my_bool *value_arg)
+ :sys_var(chain, name_arg),value(value_arg)
{}
bool check(THD *thd, set_var *var)
{
@@ -176,12 +186,12 @@
sys_check_func check_func;
sys_update_func update_func;
sys_set_default_func set_default_func;
- sys_var_str(const char *name_arg,
+ sys_var_str(sys_var_chain &chain, const char *name_arg,
sys_check_func check_func_arg,
sys_update_func update_func_arg,
sys_set_default_func set_default_func_arg,
char *value_arg)
- :sys_var(name_arg), value(value_arg), check_func(check_func_arg),
+ :sys_var(chain, name_arg), value(value_arg), check_func(check_func_arg),
update_func(update_func_arg),set_default_func(set_default_func_arg)
{}
bool check(THD *thd, set_var *var);
@@ -208,8 +218,8 @@
{
public:
char *value; // Pointer to const value
- sys_var_const_str(const char *name_arg, const char *value_arg)
- :sys_var(name_arg),value((char*) value_arg)
+ sys_var_const_str(sys_var_chain &chain, const char *name_arg, const char
*value_arg)
+ :sys_var(chain, name_arg),value((char*) value_arg)
{}
bool check(THD *thd, set_var *var)
{
@@ -237,8 +247,8 @@
{
public:
char **value; // Pointer to const value
- sys_var_const_str_ptr(const char *name_arg, char **value_arg)
- :sys_var(name_arg),value(value_arg)
+ sys_var_const_str_ptr(sys_var_chain &chain, const char *name_arg, char **value_arg)
+ :sys_var(chain, name_arg),value(value_arg)
{}
bool check(THD *thd, set_var *var)
{
@@ -267,9 +277,9 @@
uint *value;
TYPELIB *enum_names;
public:
- sys_var_enum(const char *name_arg, uint *value_arg,
+ sys_var_enum(sys_var_chain &chain, const char *name_arg, uint *value_arg,
TYPELIB *typelib, sys_after_update_func func)
- :sys_var(name_arg,func), value(value_arg), enum_names(typelib)
+ :sys_var(chain, name_arg,func), value(value_arg), enum_names(typelib)
{}
bool check(THD *thd, set_var *var)
{
@@ -285,8 +295,9 @@
class sys_var_thd :public sys_var
{
public:
- sys_var_thd(const char *name_arg, sys_after_update_func func= NULL)
- :sys_var(name_arg,func)
+ sys_var_thd(sys_var_chain &chain, const char *name_arg,
+ sys_after_update_func func= NULL)
+ :sys_var(chain, name_arg,func)
{}
bool check_type(enum_var_type type) { return 0; }
bool check_default(enum_var_type type)
@@ -301,12 +312,12 @@
sys_check_func check_func;
public:
ulong SV::*offset;
- sys_var_thd_ulong(const char *name_arg, ulong SV::*offset_arg)
- :sys_var_thd(name_arg), check_func(0), offset(offset_arg)
+ sys_var_thd_ulong(sys_var_chain &chain, const char *name_arg, ulong
SV::*offset_arg)
+ :sys_var_thd(chain, name_arg), check_func(0), offset(offset_arg)
{}
- sys_var_thd_ulong(const char *name_arg, ulong SV::*offset_arg,
+ sys_var_thd_ulong(sys_var_chain &chain, const char *name_arg, ulong
SV::*offset_arg,
sys_check_func c_func, sys_after_update_func au_func)
- :sys_var_thd(name_arg,au_func), check_func(c_func), offset(offset_arg)
+ :sys_var_thd(chain, name_arg,au_func), check_func(c_func), offset(offset_arg)
{}
bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var);
@@ -320,12 +331,14 @@
{
public:
ha_rows SV::*offset;
- sys_var_thd_ha_rows(const char *name_arg, ha_rows SV::*offset_arg)
- :sys_var_thd(name_arg), offset(offset_arg)
+ sys_var_thd_ha_rows(sys_var_chain &chain, const char *name_arg,
+ ha_rows SV::*offset_arg)
+ :sys_var_thd(chain, name_arg), offset(offset_arg)
{}
- sys_var_thd_ha_rows(const char *name_arg, ha_rows SV::*offset_arg,
+ sys_var_thd_ha_rows(sys_var_chain &chain, const char *name_arg,
+ ha_rows SV::*offset_arg,
sys_after_update_func func)
- :sys_var_thd(name_arg,func), offset(offset_arg)
+ :sys_var_thd(chain, name_arg,func), offset(offset_arg)
{}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
@@ -339,12 +352,14 @@
public:
ulonglong SV::*offset;
bool only_global;
- sys_var_thd_ulonglong(const char *name_arg, ulonglong SV::*offset_arg)
- :sys_var_thd(name_arg), offset(offset_arg)
+ sys_var_thd_ulonglong(sys_var_chain &chain, const char *name_arg,
+ ulonglong SV::*offset_arg)
+ :sys_var_thd(chain, name_arg), offset(offset_arg)
{}
- sys_var_thd_ulonglong(const char *name_arg, ulonglong SV::*offset_arg,
+ sys_var_thd_ulonglong(sys_var_chain &chain, const char *name_arg,
+ ulonglong SV::*offset_arg,
sys_after_update_func func, bool only_global_arg)
- :sys_var_thd(name_arg, func), offset(offset_arg),
+ :sys_var_thd(chain, name_arg, func), offset(offset_arg),
only_global(only_global_arg)
{}
bool update(THD *thd, set_var *var);
@@ -366,12 +381,12 @@
{
public:
my_bool SV::*offset;
- sys_var_thd_bool(const char *name_arg, my_bool SV::*offset_arg)
- :sys_var_thd(name_arg), offset(offset_arg)
+ sys_var_thd_bool(sys_var_chain &chain, const char *name_arg, my_bool
SV::*offset_arg)
+ :sys_var_thd(chain, name_arg), offset(offset_arg)
{}
- sys_var_thd_bool(const char *name_arg, my_bool SV::*offset_arg,
+ sys_var_thd_bool(sys_var_chain &chain, const char *name_arg, my_bool
SV::*offset_arg,
sys_after_update_func func)
- :sys_var_thd(name_arg,func), offset(offset_arg)
+ :sys_var_thd(chain, name_arg,func), offset(offset_arg)
{}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
@@ -392,21 +407,21 @@
TYPELIB *enum_names;
sys_check_func check_func;
public:
- sys_var_thd_enum(const char *name_arg, ulong SV::*offset_arg,
+ sys_var_thd_enum(sys_var_chain &chain, const char *name_arg, ulong SV::*offset_arg,
TYPELIB *typelib)
- :sys_var_thd(name_arg), offset(offset_arg), enum_names(typelib),
+ :sys_var_thd(chain, name_arg), offset(offset_arg), enum_names(typelib),
check_func(0)
{}
- sys_var_thd_enum(const char *name_arg, ulong SV::*offset_arg,
+ sys_var_thd_enum(sys_var_chain &chain, const char *name_arg, ulong SV::*offset_arg,
TYPELIB *typelib,
sys_after_update_func func)
- :sys_var_thd(name_arg,func), offset(offset_arg), enum_names(typelib),
+ :sys_var_thd(chain, name_arg,func), offset(offset_arg), enum_names(typelib),
check_func(0)
{}
- sys_var_thd_enum(const char *name_arg, ulong SV::*offset_arg,
+ sys_var_thd_enum(sys_var_chain &chain, const char *name_arg, ulong SV::*offset_arg,
TYPELIB *typelib, sys_after_update_func func,
sys_check_func check)
- :sys_var_thd(name_arg,func), offset(offset_arg), enum_names(typelib),
+ :sys_var_thd(chain, name_arg,func), offset(offset_arg), enum_names(typelib),
check_func(check)
{}
bool check(THD *thd, set_var *var)
@@ -429,8 +444,9 @@
class sys_var_thd_sql_mode :public sys_var_thd_enum
{
public:
- sys_var_thd_sql_mode(const char *name_arg, ulong SV::*offset_arg)
- :sys_var_thd_enum(name_arg, offset_arg, &sql_mode_typelib,
+ sys_var_thd_sql_mode(sys_var_chain &chain, const char *name_arg,
+ ulong SV::*offset_arg)
+ :sys_var_thd_enum(chain, name_arg, offset_arg, &sql_mode_typelib,
fix_sql_mode_var)
{}
bool check(THD *thd, set_var *var)
@@ -449,8 +465,9 @@
protected:
handlerton *SV::*offset;
public:
- sys_var_thd_storage_engine(const char *name_arg, handlerton *SV::*offset_arg)
- :sys_var_thd(name_arg), offset(offset_arg)
+ sys_var_thd_storage_engine(sys_var_chain &chain, const char *name_arg,
+ handlerton *SV::*offset_arg)
+ :sys_var_thd(chain, name_arg), offset(offset_arg)
{}
bool check(THD *thd, set_var *var);
SHOW_TYPE type() { return SHOW_CHAR; }
@@ -466,8 +483,9 @@
class sys_var_thd_table_type :public sys_var_thd_storage_engine
{
public:
- sys_var_thd_table_type(const char *name_arg, handlerton *SV::*offset_arg)
- :sys_var_thd_storage_engine(name_arg, offset_arg)
+ sys_var_thd_table_type(sys_var_chain &chain, const char *name_arg,
+ handlerton *SV::*offset_arg)
+ :sys_var_thd_storage_engine(chain, name_arg, offset_arg)
{}
void warn_deprecated(THD *thd);
void set_default(THD *thd, enum_var_type type);
@@ -481,10 +499,10 @@
public:
ulong bit_flag;
bool reverse;
- sys_var_thd_bit(const char *name_arg,
+ sys_var_thd_bit(sys_var_chain &chain, const char *name_arg,
sys_check_func c_func, sys_update_func u_func,
ulong bit, bool reverse_arg=0)
- :sys_var_thd(name_arg), check_func(c_func), update_func(u_func),
+ :sys_var_thd(chain, name_arg), check_func(c_func), update_func(u_func),
bit_flag(bit), reverse(reverse_arg)
{}
bool check(THD *thd, set_var *var);
@@ -498,7 +516,8 @@
class sys_var_thd_dbug :public sys_var_thd
{
public:
- sys_var_thd_dbug(const char *name_arg) :sys_var_thd(name_arg) {}
+ sys_var_thd_dbug(sys_var_chain &chain, const char *name_arg)
+ :sys_var_thd(chain, name_arg) {}
bool check_update_type(Item_result type) { return type != STRING_RESULT; }
bool check(THD *thd, set_var *var);
SHOW_TYPE type() { return SHOW_CHAR; }
@@ -514,7 +533,8 @@
class sys_var_timestamp :public sys_var
{
public:
- sys_var_timestamp(const char *name_arg) :sys_var(name_arg) {}
+ sys_var_timestamp(sys_var_chain &chain, const char *name_arg)
+ :sys_var(chain, name_arg) {}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
@@ -527,7 +547,8 @@
class sys_var_last_insert_id :public sys_var
{
public:
- sys_var_last_insert_id(const char *name_arg) :sys_var(name_arg) {}
+ sys_var_last_insert_id(sys_var_chain &chain, const char *name_arg)
+ :sys_var(chain, name_arg) {}
bool update(THD *thd, set_var *var);
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
SHOW_TYPE type() { return SHOW_LONGLONG; }
@@ -538,7 +559,8 @@
class sys_var_insert_id :public sys_var
{
public:
- sys_var_insert_id(const char *name_arg) :sys_var(name_arg) {}
+ sys_var_insert_id(sys_var_chain &chain, const char *name_arg)
+ :sys_var(chain, name_arg) {}
bool update(THD *thd, set_var *var);
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
SHOW_TYPE type() { return SHOW_LONGLONG; }
@@ -546,33 +568,11 @@
};
-#ifdef HAVE_REPLICATION
-class sys_var_slave_skip_counter :public sys_var
-{
-public:
- sys_var_slave_skip_counter(const char *name_arg) :sys_var(name_arg) {}
- bool check(THD *thd, set_var *var);
- bool update(THD *thd, set_var *var);
- bool check_type(enum_var_type type) { return type != OPT_GLOBAL; }
- /*
- We can't retrieve the value of this, so we don't have to define
- type() or value_ptr()
- */
-};
-
-class sys_var_sync_binlog_period :public sys_var_long_ptr
-{
-public:
- sys_var_sync_binlog_period(const char *name_arg, ulong *value_ptr)
- :sys_var_long_ptr(name_arg,value_ptr) {}
- bool update(THD *thd, set_var *var);
-};
-#endif
-
class sys_var_rand_seed1 :public sys_var
{
public:
- sys_var_rand_seed1(const char *name_arg) :sys_var(name_arg) {}
+ sys_var_rand_seed1(sys_var_chain &chain, const char *name_arg)
+ :sys_var(chain, name_arg) {}
bool update(THD *thd, set_var *var);
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
};
@@ -580,7 +580,8 @@
class sys_var_rand_seed2 :public sys_var
{
public:
- sys_var_rand_seed2(const char *name_arg) :sys_var(name_arg) {}
+ sys_var_rand_seed2(sys_var_chain &chain, const char *name_arg)
+ :sys_var(chain, name_arg) {}
bool update(THD *thd, set_var *var);
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
};
@@ -589,7 +590,8 @@
class sys_var_collation :public sys_var_thd
{
public:
- sys_var_collation(const char *name_arg) :sys_var_thd(name_arg)
+ sys_var_collation(sys_var_chain &chain, const char *name_arg)
+ :sys_var_thd(chain, name_arg)
{
no_support_one_shot= 0;
}
@@ -607,8 +609,8 @@
{
public:
bool nullable;
- sys_var_character_set(const char *name_arg) :
- sys_var_thd(name_arg)
+ sys_var_character_set(sys_var_chain &chain, const char *name_arg) :
+ sys_var_thd(chain, name_arg)
{
nullable= 0;
/*
@@ -633,8 +635,8 @@
class sys_var_character_set_filesystem :public sys_var_character_set
{
public:
- sys_var_character_set_filesystem(const char *name_arg) :
- sys_var_character_set(name_arg) {}
+ sys_var_character_set_filesystem(sys_var_chain &chain, const char *name_arg) :
+ sys_var_character_set(chain, name_arg) {}
void set_default(THD *thd, enum_var_type type);
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
};
@@ -642,8 +644,8 @@
class sys_var_character_set_client :public sys_var_character_set
{
public:
- sys_var_character_set_client(const char *name_arg) :
- sys_var_character_set(name_arg) {}
+ sys_var_character_set_client(sys_var_chain &chain, const char *name_arg) :
+ sys_var_character_set(chain, name_arg) {}
void set_default(THD *thd, enum_var_type type);
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
};
@@ -651,8 +653,8 @@
class sys_var_character_set_results :public sys_var_character_set
{
public:
- sys_var_character_set_results(const char *name_arg) :
- sys_var_character_set(name_arg)
+ sys_var_character_set_results(sys_var_chain &chain, const char *name_arg) :
+ sys_var_character_set(chain, name_arg)
{ nullable= 1; }
void set_default(THD *thd, enum_var_type type);
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
@@ -661,8 +663,8 @@
class sys_var_character_set_server :public sys_var_character_set
{
public:
- sys_var_character_set_server(const char *name_arg) :
- sys_var_character_set(name_arg) {}
+ sys_var_character_set_server(sys_var_chain &chain, const char *name_arg) :
+ sys_var_character_set(chain, name_arg) {}
void set_default(THD *thd, enum_var_type type);
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
};
@@ -670,8 +672,8 @@
class sys_var_character_set_database :public sys_var_character_set
{
public:
- sys_var_character_set_database(const char *name_arg) :
- sys_var_character_set(name_arg) {}
+ sys_var_character_set_database(sys_var_chain &chain, const char *name_arg) :
+ sys_var_character_set(chain, name_arg) {}
void set_default(THD *thd, enum_var_type type);
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
};
@@ -679,8 +681,8 @@
class sys_var_character_set_connection :public sys_var_character_set
{
public:
- sys_var_character_set_connection(const char *name_arg) :
- sys_var_character_set(name_arg) {}
+ sys_var_character_set_connection(sys_var_chain &chain, const char *name_arg) :
+ sys_var_character_set(chain, name_arg) {}
void set_default(THD *thd, enum_var_type type);
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
};
@@ -688,7 +690,8 @@
class sys_var_collation_connection :public sys_var_collation
{
public:
- sys_var_collation_connection(const char *name_arg) :sys_var_collation(name_arg) {}
+ sys_var_collation_connection(sys_var_chain &chain, const char *name_arg)
+ :sys_var_collation(chain, name_arg) {}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
@@ -697,7 +700,8 @@
class sys_var_collation_server :public sys_var_collation
{
public:
- sys_var_collation_server(const char *name_arg) :sys_var_collation(name_arg) {}
+ sys_var_collation_server(sys_var_chain &chain, const char *name_arg)
+ :sys_var_collation(chain, name_arg) {}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
@@ -706,7 +710,8 @@
class sys_var_collation_database :public sys_var_collation
{
public:
- sys_var_collation_database(const char *name_arg) :sys_var_collation(name_arg) {}
+ sys_var_collation_database(sys_var_chain &chain, const char *name_arg)
+ :sys_var_collation(chain, name_arg) {}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
@@ -718,8 +723,9 @@
protected:
size_t offset;
public:
- sys_var_key_cache_param(const char *name_arg, size_t offset_arg)
- :sys_var(name_arg), offset(offset_arg)
+ sys_var_key_cache_param(sys_var_chain &chain, const char *name_arg,
+ size_t offset_arg)
+ :sys_var(chain, name_arg), offset(offset_arg)
{}
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
bool check_default(enum_var_type type) { return 1; }
@@ -730,8 +736,9 @@
class sys_var_key_buffer_size :public sys_var_key_cache_param
{
public:
- sys_var_key_buffer_size(const char *name_arg)
- :sys_var_key_cache_param(name_arg, offsetof(KEY_CACHE, param_buff_size))
+ sys_var_key_buffer_size(sys_var_chain &chain, const char *name_arg)
+ :sys_var_key_cache_param(chain, name_arg,
+ offsetof(KEY_CACHE, param_buff_size))
{}
bool update(THD *thd, set_var *var);
SHOW_TYPE type() { return SHOW_LONGLONG; }
@@ -741,8 +748,8 @@
class sys_var_key_cache_long :public sys_var_key_cache_param
{
public:
- sys_var_key_cache_long(const char *name_arg, size_t offset_arg)
- :sys_var_key_cache_param(name_arg, offset_arg)
+ sys_var_key_cache_long(sys_var_chain &chain, const char *name_arg, size_t
offset_arg)
+ :sys_var_key_cache_param(chain, name_arg, offset_arg)
{}
bool update(THD *thd, set_var *var);
SHOW_TYPE type() { return SHOW_LONG; }
@@ -754,10 +761,10 @@
DATE_TIME_FORMAT *SV::*offset;
timestamp_type date_time_type;
public:
- sys_var_thd_date_time_format(const char *name_arg,
+ sys_var_thd_date_time_format(sys_var_chain &chain, const char *name_arg,
DATE_TIME_FORMAT *SV::*offset_arg,
timestamp_type date_time_type_arg)
- :sys_var_thd(name_arg), offset(offset_arg),
+ :sys_var_thd(chain, name_arg), offset(offset_arg),
date_time_type(date_time_type_arg)
{}
SHOW_TYPE type() { return SHOW_CHAR; }
@@ -778,8 +785,9 @@
{
uint log_type;
public:
- sys_var_log_state(const char *name_arg, my_bool *value_arg, uint log_type_arg)
- :sys_var_bool_ptr(name_arg, value_arg), log_type(log_type_arg) {}
+ sys_var_log_state(sys_var_chain &chain, const char *name_arg, my_bool *value_arg,
+ uint log_type_arg)
+ :sys_var_bool_ptr(chain, name_arg, value_arg), log_type(log_type_arg) {}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
};
@@ -790,9 +798,9 @@
ulong *value;
TYPELIB *enum_names;
public:
- sys_var_log_output(const char *name_arg, ulong *value_arg,
+ sys_var_log_output(sys_var_chain &chain, const char *name_arg, ulong *value_arg,
TYPELIB *typelib, sys_after_update_func func)
- :sys_var(name_arg,func), value(value_arg), enum_names(typelib)
+ :sys_var(chain, name_arg,func), value(value_arg), enum_names(typelib)
{}
bool check(THD *thd, set_var *var)
{
@@ -814,10 +822,10 @@
enum_var_type var_type;
SHOW_TYPE show_type;
sys_value_ptr_func value_ptr_func;
- sys_var_readonly(const char *name_arg, enum_var_type type,
+ sys_var_readonly(sys_var_chain &chain, const char *name_arg, enum_var_type type,
SHOW_TYPE show_type_arg,
sys_value_ptr_func value_ptr_func_arg)
- :sys_var(name_arg), var_type(type),
+ :sys_var(chain, name_arg), var_type(type),
show_type(show_type_arg), value_ptr_func(value_ptr_func_arg)
{}
bool update(THD *thd, set_var *var) { return 1; }
@@ -838,9 +846,9 @@
SHOW_COMP_OPTION *have_variable;
public:
- sys_var_have_variable(const char *variable_name,
+ sys_var_have_variable(sys_var_chain &chain, const char *variable_name,
SHOW_COMP_OPTION *have_variable_arg):
- sys_var(variable_name),
+ sys_var(chain, variable_name),
have_variable(have_variable_arg)
{ }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
@@ -856,11 +864,32 @@
};
+class sys_var_have_plugin: public sys_var
+{
+ LEX_STRING *plugin_name;
+ int plugin_type;
+
+public:
+ sys_var_have_plugin(sys_var_chain &chain, const char *variable_name,
+ LEX_STRING *plugin_name_arg, int plugin_type_arg):
+ sys_var(chain, variable_name),
+ plugin_name(plugin_name_arg), plugin_type(plugin_type_arg)
+ { }
+ byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ bool update(THD *thd, set_var *var) { return 1; }
+ bool check_default(enum_var_type type) { return 1; }
+ bool check_type(enum_var_type type) { return type != OPT_GLOBAL; }
+ bool check_update_type(Item_result type) { return 1; }
+ SHOW_TYPE type() { return SHOW_CHAR; }
+ bool is_readonly() const { return 1; }
+};
+
+
class sys_var_thd_time_zone :public sys_var_thd
{
public:
- sys_var_thd_time_zone(const char *name_arg):
- sys_var_thd(name_arg)
+ sys_var_thd_time_zone(sys_var_chain &chain, const char *name_arg):
+ sys_var_thd(chain, name_arg)
{
no_support_one_shot= 0;
}
@@ -880,8 +909,8 @@
class sys_var_max_user_conn : public sys_var_thd
{
public:
- sys_var_max_user_conn(const char *name_arg):
- sys_var_thd(name_arg) {}
+ sys_var_max_user_conn(sys_var_chain &chain, const char *name_arg):
+ sys_var_thd(chain, name_arg) {}
bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var);
bool check_default(enum_var_type type)
@@ -897,8 +926,9 @@
{
/* We need a derived class only to have a warn_deprecated() */
public:
- sys_var_trust_routine_creators(const char *name_arg, my_bool *value_arg) :
- sys_var_bool_ptr(name_arg, value_arg) {};
+ sys_var_trust_routine_creators(sys_var_chain &chain, const char *name_arg,
+ my_bool *value_arg) :
+ sys_var_bool_ptr(chain, name_arg, value_arg) {};
void warn_deprecated(THD *thd);
void set_default(THD *thd, enum_var_type type);
bool update(THD *thd, set_var *var);
@@ -908,8 +938,8 @@
class sys_var_thd_lc_time_names :public sys_var_thd
{
public:
- sys_var_thd_lc_time_names(const char *name_arg):
- sys_var_thd(name_arg)
+ sys_var_thd_lc_time_names(sys_var_chain &chain, const char *name_arg):
+ sys_var_thd(chain, name_arg)
{}
bool check(THD *thd, set_var *var);
SHOW_TYPE type() { return SHOW_CHAR; }
@@ -928,8 +958,8 @@
{
/* We need a derived class only to have a warn_deprecated() */
public:
- sys_var_event_scheduler(const char *name_arg) :
- sys_var_long_ptr(name_arg, NULL, NULL) {};
+ sys_var_event_scheduler(sys_var_chain &chain, const char *name_arg) :
+ sys_var_long_ptr(chain, name_arg, NULL, NULL) {};
bool update(THD *thd, set_var *var);
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
SHOW_TYPE type() { return SHOW_CHAR; }
@@ -947,8 +977,9 @@
class sys_var_thd_binlog_format :public sys_var_thd_enum
{
public:
- sys_var_thd_binlog_format(const char *name_arg, ulong SV::*offset_arg)
- :sys_var_thd_enum(name_arg, offset_arg,
+ sys_var_thd_binlog_format(sys_var_chain &chain, const char *name_arg,
+ ulong SV::*offset_arg)
+ :sys_var_thd_enum(chain, name_arg, offset_arg,
&binlog_format_typelib
#ifdef HAVE_ROW_BASED_REPLICATION
, fix_binlog_format_after_update
@@ -1117,8 +1148,12 @@
Prototypes for helper functions
*/
-void set_var_init();
+int set_var_init();
void set_var_free();
+int mysql_append_static_vars(const SHOW_VAR *show_vars, uint count);
+SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted);
+int mysql_add_sys_var_chain(sys_var *chain, struct my_option *long_options);
+int mysql_del_sys_var_chain(sys_var *chain);
sys_var *find_sys_var(const char *str, uint length=0);
int sql_set_variables(THD *thd, List<set_var_base> *var_list);
bool not_all_support_one_shot(List<set_var_base> *var_list);
--- 1.23/include/mysql/plugin.h 2006-12-21 16:54:34 -08:00
+++ 1.24/include/mysql/plugin.h 2006-12-21 16:54:34 -08:00
@@ -17,6 +17,17 @@
#ifndef _my_plugin_h
#define _my_plugin_h
+#ifdef __cplusplus
+class THD;
+class Item;
+#define PLUGIN_THD THD*
+#define PLUGIN_ITEM Item*
+#else
+#define PLUGIN_THD void*
+#define PLUGIN_ITEM void*
+#endif
+
+
/*************************************************************************
Plugin API. Common for all plugin types.
*/
@@ -85,7 +96,243 @@
};
#define SHOW_VAR_FUNC_BUFF_SIZE 1024
-typedef int (*mysql_show_var_func)(void *, struct st_mysql_show_var*, char *);
+typedef int (*mysql_show_var_func)(PLUGIN_THD, struct st_mysql_show_var*, char *);
+
+
+/*
+ declarations for server variables and command line options
+*/
+
+
+#define PLUGIN_VAR_BOOL 0x0001
+#define PLUGIN_VAR_INT 0x0002
+#define PLUGIN_VAR_LONG 0x0003
+#define PLUGIN_VAR_LONGLONG 0x0004
+#define PLUGIN_VAR_STR 0x0005
+#define PLUGIN_VAR_ENUM 0x0006
+#define PLUGIN_VAR_SET 0x0007
+#define PLUGIN_VAR_UNSIGNED 0x0080
+#define PLUGIN_VAR_THDLOCAL 0x0100
+#define PLUGIN_VAR_READONLY 0x0200
+#define PLUGIN_VAR_NOSYSVAR 0x0400
+#define PLUGIN_VAR_NOCMDOPT 0x0800
+#define PLUGIN_VAR_NOCMDARG 0x1000 /* No argument for cmd line */
+#define PLUGIN_VAR_RQCMDARG 0x0000 /* Argument required for cmd line */
+#define PLUGIN_VAR_OPCMDARG 0x2000 /* Argument optional for cmd line */
+#define PLUGIN_VAR_MEMALLOC 0x8000
+
+struct st_mysql_sys_var;
+typedef int (*mysql_var_check_func)(PLUGIN_THD thd,
+ struct st_mysql_sys_var *var,
+ void *save, PLUGIN_ITEM value);
+typedef void (*mysql_var_update_func)(PLUGIN_THD thd,
+ struct st_mysql_sys_var *var,
+ void *tgt, void *save);
+
+
+/* declarations not for internal use only */
+
+
+#define PLUGIN_VAR_MASK \
+ (PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | \
+ PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_NOCMDARG | \
+ PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_MEMALLOC)
+
+#define MYSQL_PLUGIN_VAR_HEADER \
+ int flags; \
+ const char *name; \
+ const char *comment; \
+ mysql_var_check_func check; \
+ mysql_var_update_func update
+
+#define MYSQL_SYSVAR_NAME(name) mysql_sysvar_ ## name
+#define MYSQL_SYSVAR(name) \
+ ((struct st_mysql_sys_var *)&(MYSQL_SYSVAR_NAME(name)))
+
+/*
+ for global variables, the value pointer is the first
+ element after the header, the default value is the second.
+ for thread variables, the value offset is the first
+ element after the header, the default value is the second.
+*/
+
+
+#define DECLARE_MYSQL_SYSVAR_BASIC(name, type) struct { \
+ MYSQL_PLUGIN_VAR_HEADER; \
+ type *value, def_val; \
+} MYSQL_SYSVAR_NAME(name)
+
+#define DECLARE_MYSQL_SYSVAR_SIMPLE(name, type) struct { \
+ MYSQL_PLUGIN_VAR_HEADER; \
+ type *value, def_val, min_val,\
+ max_val, blk_sz; \
+} MYSQL_SYSVAR_NAME(name)
+
+#define DECLARE_MYSQL_SYSVAR_TYPELIB(name) struct { \
+ MYSQL_PLUGIN_VAR_HEADER; \
+ unsigned long *value, def_val;\
+ TYPELIB *typelib; \
+} MYSQL_SYSVAR_NAME(name)
+
+#define DECLARE_THDVAR_FUNC(type) \
+ type *(*resolve)(PLUGIN_THD thd, int offset)
+
+#define DECLARE_MYSQL_THDVAR_BASIC(name, type) struct { \
+ MYSQL_PLUGIN_VAR_HEADER; \
+ int offset; \
+ type def_val; \
+ DECLARE_THDVAR_FUNC(type); \
+} MYSQL_SYSVAR_NAME(name)
+
+#define DECLARE_MYSQL_THDVAR_SIMPLE(name, type) struct { \
+ MYSQL_PLUGIN_VAR_HEADER; \
+ int offset; \
+ type def_val, min_val, max_val, blk_sz; \
+ DECLARE_THDVAR_FUNC(type); \
+} MYSQL_SYSVAR_NAME(name)
+
+#define DECLARE_MYSQL_THDVAR_TYPELIB(name) struct { \
+ MYSQL_PLUGIN_VAR_HEADER; \
+ int offset; \
+ unsigned long def_val; \
+ DECLARE_THDVAR_FUNC(unsigned long); \
+ TYPELIB *typelib; \
+} MYSQL_SYSVAR_NAME(name)
+
+
+/* declarations for use by implementors follow: */
+
+
+#define MYSQL_SYSVAR_BOOL(name, opt, comment, check, update, def) \
+ MYSQL_SYSVAR_BOOL_REF(name, name, opt, comment, check, update, def)
+#define MYSQL_SYSVAR_STR(name, opt, comment, check, update, def) \
+ MYSQL_SYSVAR_STR_REF(name, name, opt, comment, check, update, def)
+#define MYSQL_SYSVAR_INT(name, opt, comment, check, update, def, min, max, blk) \
+ MYSQL_SYSVAR_INT_REF(name, name, opt, comment, check, update, def, min, max, blk)
+#define MYSQL_SYSVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \
+ MYSQL_SYSVAR_UINT_REF(name, name, opt, comment, check, update, def, min, max, blk)
+#define MYSQL_SYSVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \
+ MYSQL_SYSVAR_LONG_REF(name, name, opt, comment, check, update, def, min, max, blk)
+#define MYSQL_SYSVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \
+ MYSQL_SYSVAR_ULONG_REF(name, name, opt, comment, check, update, def, min, max, blk)
+#define MYSQL_SYSVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \
+ MYSQL_SYSVAR_LONGLONG_REF(name, name, opt, comment, check, update, def, min, max, blk)
+#define MYSQL_SYSVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \
+ MYSQL_SYSVAR_ULONGLONG_REF(name, name, opt, comment, check, update, def, min, max, blk)
+#define MYSQL_SYSVAR_ENUM(name, opt, comment, check, update, def, typelib) \
+ MYSQL_SYSVAR_ENUM_REF(name, name, opt, comment, check, update, def, typelib)
+#define MYSQL_SYSVAR_SET(name, opt, comment, check, update, def, typelib) \
+ MYSQL_SYSVAR_SET_REF(name, name, opt, comment, check, update, def, typelib)
+
+#define MYSQL_SYSVAR_BOOL_REF(name, varname, opt, comment, check, update, def) \
+DECLARE_MYSQL_SYSVAR_BASIC(name, char) = { \
+ PLUGIN_VAR_BOOL | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def}
+
+#define MYSQL_SYSVAR_STR_REF(name, varname, opt, comment, check, update, def) \
+DECLARE_MYSQL_SYSVAR_BASIC(name, char *) = { \
+ PLUGIN_VAR_STR | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def}
+
+#define MYSQL_SYSVAR_INT_REF(name, varname, opt, comment, check, update, def, min, max,
blk) \
+DECLARE_MYSQL_SYSVAR_SIMPLE(name, int) = { \
+ PLUGIN_VAR_INT | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def, min, max, blk }
+
+#define MYSQL_SYSVAR_UINT_REF(name, varname, opt, comment, check, update, def, min, max,
blk) \
+DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned int) = { \
+ PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def, min, max, blk }
+
+#define MYSQL_SYSVAR_LONG_REF(name, varname, opt, comment, check, update, def, min, max,
blk) \
+DECLARE_MYSQL_SYSVAR_SIMPLE(name, long) = { \
+ PLUGIN_VAR_LONG | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def, min, max, blk }
+
+#define MYSQL_SYSVAR_ULONG_REF(name, varname, opt, comment, check, update, def, min, max,
blk) \
+DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long) = { \
+ PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def, min, max, blk }
+
+#define MYSQL_SYSVAR_LONGLONG_REF(name, varname, opt, comment, check, update, def, min,
max, blk) \
+DECLARE_MYSQL_SYSVAR_SIMPLE(name, longlong) = { \
+ PLUGIN_VAR_LONGLONG | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def, min, max, blk }
+
+#define MYSQL_SYSVAR_ULONGLONG_REF(name, varname, opt, comment, check, update, def, min,
max, blk) \
+DECLARE_MYSQL_SYSVAR_SIMPLE(name, ulonglong) = { \
+ PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def, min, max, blk }
+
+#define MYSQL_SYSVAR_ENUM_REF(name, varname, opt, comment, check, update, def, typelib) \
+DECLARE_MYSQL_SYSVAR_TYPELIB(name) = { \
+ PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def, typelib }
+
+#define MYSQL_SYSVAR_SET_REF(name, varname, opt, comment, check, update, def, typelib) \
+DECLARE_MYSQL_SYSVAR_TYPELIB(name) = { \
+ PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def, typelib }
+
+#define MYSQL_THDVAR_BOOL(name, opt, comment, check, update, def) \
+DECLARE_MYSQL_THDVAR_BASIC(name, char) = { \
+ PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, -1, def, NULL}
+
+#define MYSQL_THDVAR_STR(name, opt, comment, check, update, def) \
+DECLARE_MYSQL_THDVAR_BASIC(name, char *) = { \
+ PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, -1, def, NULL}
+
+#define MYSQL_THDVAR_INT(name, opt, comment, check, update, def, min, max, blk) \
+DECLARE_MYSQL_THDVAR_SIMPLE(name, int) = { \
+ PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, -1, def, min, max, blk, NULL }
+
+#define MYSQL_THDVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \
+DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned int) = { \
+ PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) &
PLUGIN_VAR_MASK), \
+ #name, comment, check, update, -1, def, min, max, blk, NULL }
+
+#define MYSQL_THDVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \
+DECLARE_MYSQL_THDVAR_SIMPLE(name, long) = { \
+ PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, -1, def, min, max, blk, NULL }
+
+#define MYSQL_THDVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \
+DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long) = { \
+ PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) &
PLUGIN_VAR_MASK), \
+ #name, comment, check, update, -1, def, min, max, blk, NULL }
+
+#define MYSQL_THDVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \
+DECLARE_MYSQL_THDVAR_SIMPLE(name, longlong) = { \
+ PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, -1, def, min, max, blk, NULL }
+
+#define MYSQL_THDVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \
+DECLARE_MYSQL_THDVAR_SIMPLE(name, ulonglong) = { \
+ PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) &
PLUGIN_VAR_MASK), \
+ #name, comment, check, update, -1, def, min, max, blk, NULL }
+
+#define MYSQL_THDVAR_ENUM(name, opt, comment, check, update, def, typelib) \
+DECLARE_MYSQL_THDVAR_TYPELIB(name) = { \
+ PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, -1, def, NULL, typelib }
+
+#define MYSQL_THDVAR_SET(name, opt, comment, check, update, def, typelib) \
+DECLARE_MYSQL_THDVAR_TYPELIB(name) = { \
+ PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, -1, def, NULL, typelib }
+
+/* accessor macros */
+
+#define SYSVAR(name) \
+ (*(MYSQL_SYSVAR_NAME(name).value))
+
+/* when thd == null, result points to global value */
+#define THDVAR(thd, name) \
+ (*(MYSQL_SYSVAR_NAME(name).resolve(thd, MYSQL_SYSVAR_NAME(name).offset)))
+
/*
Plugin description structure.
@@ -103,8 +350,8 @@
int (*deinit)(void *);/* the function to invoke when plugin is unloaded */
unsigned int version; /* plugin version (for SHOW PLUGINS) */
struct st_mysql_show_var *status_vars;
- void * __reserved1; /* placeholder for system variables */
- void * __reserved2; /* placeholder for config options */
+ struct st_mysql_sys_var **system_vars;
+ void * __reserved1;
};
/*************************************************************************
--- 1.39/sql/sql_plugin.cc 2006-12-21 16:54:34 -08:00
+++ 1.40/sql/sql_plugin.cc 2006-12-21 16:54:34 -08:00
@@ -16,11 +16,17 @@
#include "mysql_priv.h"
#include <my_pthread.h>
+#include <my_getopt.h>
#define REPORT_TO_LOG 1
#define REPORT_TO_USER 2
+#undef MYSQL_SYSVAR_NAME
+#define MYSQL_SYSVAR_NAME(name) name
+#define PLUGIN_VAR_TYPEMASK 0x007f
+
extern struct st_mysql_plugin *mysqld_builtins[];
+char *opt_plugin_load= NULL;
char *opt_plugin_dir_ptr;
char opt_plugin_dir[FN_REFLEN];
/*
@@ -77,18 +83,1217 @@
static int plugin_array_version=0;
+static uint global_variables_dynamic_size= 0;
+static MEM_ROOT plugin_mem_root;
+static HASH plugin_var_hash;
+
+struct st_plugin_var /* stored in plugin_var_hash */
+{
+ char *name;
+ uint name_len;
+ int offset;
+};
+
/* prototypes */
my_bool plugin_register_builtin(struct st_mysql_plugin *plugin);
-void plugin_load(void);
+static void plugin_load(char **argv);
+static bool plugin_load_list(char **argv, const char *list);
+static int test_plugin_options(struct st_plugin_int &tmp,
+ char **argv, my_bool default_enabled);
+static my_bool register_builtin(struct st_mysql_plugin *plugin,
+ struct st_plugin_int &tmp,
+ struct st_plugin_int *&ptr);
+static st_plugin_var *register_var(const char *plugin, const char *name,
+ int flags);
+static st_plugin_var *find_var(const char *plugin, const char *name,
+ int flags);
+static void plugin_opt_set_limits(struct my_option *options,
+ const struct st_mysql_sys_var *opt);
+
+#define SET_PLUGIN_VAR_RESOLVE(opt)\
+ *(mysql_sys_var_ptr_p*)&((opt)->resolve)= mysql_sys_var_ptr
+typedef byte *(*mysql_sys_var_ptr_p)(void* a_thd, int offset);
+static byte *mysql_sys_var_ptr(void* a_thd, int offset);
+
+
+/****************************************************************************
+ Help Verbose text with Plugin System Variables
+****************************************************************************/
+
+static int option_cmp(my_option *a, my_option *b)
+{
+ if (a->id < 256 && b->id >= 256)
+ return -1;
+ if (a->id >= 256 && b->id < 256)
+ return 1;
+ if (a->id < 256 && b->id < 256)
+ return a->id - b->id;
+ return my_strcasecmp(&my_charset_latin1, a->name, b->name);
+}
+
+
+void my_print_help_inc_plugins(my_option *main_options, uint size)
+{
+ DYNAMIC_ARRAY all_options;
+ struct st_plugin_int *p;
+ my_option *opt;
+
+ my_init_dynamic_array(&all_options, sizeof(my_option), size, size/4);
+
+ for (uint idx= 0; initialized && idx < plugin_array.elements; idx++)
+ {
+ p= dynamic_element(&plugin_array, idx, struct st_plugin_int *);
+ if (!(opt= p->cmd_options))
+ continue;
+
+ for (;opt->id; opt++)
+ if (opt->comment)
+ insert_dynamic(&all_options, (gptr) opt);
+ }
+
+ for (;main_options->id; main_options++)
+ insert_dynamic(&all_options, (gptr) main_options);
+
+ sort_dynamic(&all_options, (qsort_cmp)option_cmp);
+ insert_dynamic(&all_options, (gptr) main_options);
+ my_print_help((my_option*) all_options.buffer);
+ my_print_variables((my_option*) all_options.buffer);
+ delete_dynamic(&all_options);
+}
+
+/****************************************************************************
+ Plugin System Variables
+****************************************************************************/
+
+struct st_mysql_sys_var
+{
+ MYSQL_PLUGIN_VAR_HEADER;
+};
+
+typedef DECLARE_MYSQL_SYSVAR_BASIC(sysvar_bool_t, my_bool);
+typedef DECLARE_MYSQL_THDVAR_BASIC(thdvar_bool_t, my_bool);
+typedef DECLARE_MYSQL_SYSVAR_BASIC(sysvar_str_t, char *);
+typedef DECLARE_MYSQL_THDVAR_BASIC(thdvar_str_t, char *);
+
+typedef DECLARE_MYSQL_SYSVAR_TYPELIB(sysvar_typelib_t);
+typedef DECLARE_MYSQL_THDVAR_TYPELIB(thdvar_typelib_t);
+
+typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_int_t, int);
+typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_long_t, long);
+typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_longlong_t, longlong);
+typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_uint_t, uint);
+typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_ulong_t, ulong);
+typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_ulonglong_t, ulonglong);
+
+typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_int_t, int);
+typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_long_t, long);
+typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_longlong_t, longlong);
+typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_uint_t, uint);
+typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_ulong_t, ulong);
+typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_ulonglong_t, ulonglong);
+
+class sys_var_pluginvar: public sys_var
+{
+public:
+ struct st_mysql_sys_var *plugin_var;
+
+ static void *operator new(size_t size, MEM_ROOT *mem_root)
+ { return (void*) alloc_root(mem_root, (uint) size); }
+ static void operator delete(void *ptr_arg,size_t size)
+ { TRASH(ptr_arg, size); }
+
+ sys_var_pluginvar(sys_var_chain &chain, const char *name_arg,
+ st_mysql_sys_var *plugin_var_arg)
+ :sys_var(chain, name_arg), plugin_var(plugin_var_arg)
+ {}
+
+ sys_var_pluginvar *cast_pluginvar() { return this; }
+
+ bool is_readonly() const
+ { return plugin_var->flags & PLUGIN_VAR_READONLY; }
+
+ bool check_type(enum_var_type type)
+ {
+ if (plugin_var->flags & PLUGIN_VAR_THDLOCAL)
+ return 0;
+ return type != OPT_GLOBAL;
+ }
+
+ bool check_update_type(Item_result type)
+ {
+ if (is_readonly())
+ return 1;
+ switch (plugin_var->flags & PLUGIN_VAR_TYPEMASK) {
+ case PLUGIN_VAR_INT:
+ case PLUGIN_VAR_LONG:
+ case PLUGIN_VAR_LONGLONG:
+ return type != INT_RESULT;
+ case PLUGIN_VAR_STR:
+ return type != STRING_RESULT;
+ default:
+ return 0;
+ }
+ }
+
+ SHOW_TYPE type()
+ {
+ switch (plugin_var->flags & PLUGIN_VAR_TYPEMASK) {
+ case PLUGIN_VAR_BOOL:
+ return SHOW_MY_BOOL;
+ case PLUGIN_VAR_INT:
+ return SHOW_INT;
+ case PLUGIN_VAR_LONG:
+ return SHOW_LONG;
+ case PLUGIN_VAR_LONGLONG:
+ return SHOW_LONGLONG;
+ case PLUGIN_VAR_STR:
+ return SHOW_CHAR_PTR;
+ case PLUGIN_VAR_ENUM:
+ case PLUGIN_VAR_SET:
+ return SHOW_CHAR;
+ default:
+ return SHOW_UNDEF;
+ }
+ }
+
+ byte* real_value_ptr(THD *thd, enum_var_type type)
+ {
+ if (plugin_var->flags & PLUGIN_VAR_THDLOCAL)
+ {
+ if (type == OPT_GLOBAL)
+ thd= NULL;
+ return mysql_sys_var_ptr(thd, *(int*)(plugin_var+1));
+ }
+ return *(byte**)(plugin_var+1);
+ }
+
+ TYPELIB* plugin_var_typelib(void)
+ {
+ int type= plugin_var->flags & PLUGIN_VAR_TYPEMASK;
+ if (type == PLUGIN_VAR_ENUM || type == PLUGIN_VAR_SET)
+ {
+ if (plugin_var->flags & PLUGIN_VAR_THDLOCAL)
+ return ((thdvar_typelib_t *)plugin_var)->typelib;
+ else
+ return ((sysvar_typelib_t *)plugin_var)->typelib;
+ }
+ return NULL;
+ }
+
+ byte* value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
+ {
+ char buffer[STRING_BUFFER_USUAL_SIZE];
+ String str(buffer, sizeof(buffer), system_charset_info);
+ byte* result;
+ TYPELIB *typelib;
+ ulong mask= 1;
+ uint i;
+
+ result= real_value_ptr(thd, type);
+ if ((plugin_var->flags && PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_ENUM)
+ {
+ typelib= plugin_var_typelib();
+ result= (byte*) (*(ulong*)result < typelib->count ?
+ typelib->type_names[*(ulong*)result] : "undefined");
+ }
+ else
+ if ((plugin_var->flags && PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_SET)
+ {
+ typelib= plugin_var_typelib();
+ str.length(0);
+ for (i= 0; i < typelib->count; i++, mask<<=1)
+ {
+ if (!(*(ulong*)result & mask))
+ continue;
+ str.append(typelib->type_names[i], typelib->type_lengths[i]);
+ str.append(',');
+ }
+
+ result= (byte*) "";
+ if (str.length())
+ result= (byte*) thd->strmake(str.ptr(), str.length()-1);
+ }
+ return result;
+ }
+
+ bool check(THD *thd, set_var *var)
+ {
+ if (is_readonly() || !plugin_var->check)
+ return 1;
+ return plugin_var->check(thd, plugin_var, &var->save_result,
var->value);
+ }
+
+ void set_default(THD *thd, enum_var_type type)
+ {
+ void *tgt = real_value_ptr(thd, type);
+ void *src = ((void **)(plugin_var + 1) + 1);
+
+ if (!(plugin_var->update))
+ return;
+
+ if (plugin_var->flags & PLUGIN_VAR_THDLOCAL)
+ {
+ src= ((int*)(plugin_var + 1) + 1);
+ if (type != OPT_GLOBAL)
+ src= real_value_ptr(thd, OPT_GLOBAL);
+ }
+
+ if (!(plugin_var->flags & PLUGIN_VAR_THDLOCAL) ||
+ type == OPT_GLOBAL)
+ {
+ rw_wrlock(&THR_LOCK_plugin);
+ plugin_var->update(thd, plugin_var, tgt, src);
+ rw_unlock(&THR_LOCK_plugin);
+ }
+ else
+ plugin_var->update(thd, plugin_var, tgt, src);
+ }
+
+ bool update(THD *thd, set_var *var)
+ {
+ void *tgt;
+
+ if (is_readonly() || !plugin_var->update)
+ return 1;
+
+ tgt= real_value_ptr(thd, var->type);
+
+ /* thd must equal current_thd if PLUGIN_VAR_THDLOCAL flag is set */
+ DBUG_ASSERT(!(plugin_var->flags & PLUGIN_VAR_THDLOCAL) || thd == current_thd);
+
+ if (!(plugin_var->flags & PLUGIN_VAR_THDLOCAL) ||
+ var->type == OPT_GLOBAL)
+ {
+ rw_wrlock(&THR_LOCK_plugin);
+ plugin_var->update(thd, plugin_var, tgt, &var->save_result);
+ rw_unlock(&THR_LOCK_plugin);
+ }
+ else
+ plugin_var->update(thd, plugin_var, tgt, &var->save_result);
+ return 0;
+ }
+};
+
+
+static int check_func_bool(THD *thd, struct st_mysql_sys_var *var,
+ void *save, Item *value)
+{
+ char buff[STRING_BUFFER_USUAL_SIZE];
+ const char *strvalue;
+ String str(buff, sizeof(buff), system_charset_info), *res;
+ int result;
+
+ if (value->result_type() == STRING_RESULT)
+ {
+ if (!(res= value->val_str(&str)) ||
+ (result= find_type(&bool_typelib, res->ptr(), res->length(), 1)-1) <
0)
+ {
+ strvalue= res ? res->c_ptr_quick() : "NULL";
+ goto err;
+ }
+ }
+ else
+ {
+ ulonglong tmp= value->val_int();
+ if (tmp > 1)
+ {
+ llstr(tmp, buff);
+ strvalue= buff;
+ goto err;
+ }
+ result= (int)tmp;
+ }
+ *(int*)save= -result;
+ return 0;
+err:
+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->name, strvalue);
+ return 1;
+}
+
+
+static int check_func_int(THD *thd, struct st_mysql_sys_var *var,
+ void *save, Item *value)
+{
+ *(int*)save= (int)value->val_int();
+ return 0;
+}
+
+
+static int check_func_long(THD *thd, struct st_mysql_sys_var *var,
+ void *save, Item *value)
+{
+ *(long*)save= (long)value->val_int();
+ return 0;
+}
+
+
+static int check_func_longlong(THD *thd, struct st_mysql_sys_var *var,
+ void *save, Item *value)
+{
+ *(ulonglong*)save= value->val_int();
+ return 0;
+}
+
+static int check_func_str(THD *thd, struct st_mysql_sys_var *var,
+ void *save, Item *value)
+{
+ char buff[STRING_BUFFER_USUAL_SIZE];
+ const char *strvalue= NULL;
+ String str(buff, sizeof(buff), system_charset_info), *res;
+
+ if ((res= value->val_str(&str)))
+ strvalue= thd->strmake(res->ptr(), res->length());
+ *(const char**)save= strvalue;
+ return 0;
+}
+
+
+static int check_func_enum(THD *thd, struct st_mysql_sys_var *var,
+ void *save, Item *value)
+{
+ char buff[STRING_BUFFER_USUAL_SIZE];
+ const char *strvalue= "NULL";
+ String str(buff, sizeof(buff), system_charset_info), *res;
+ TYPELIB *typelib;
+ long result;
+
+ if (var->flags & PLUGIN_VAR_THDLOCAL)
+ typelib= ((thdvar_typelib_t*)var)->typelib;
+ else
+ typelib= ((sysvar_typelib_t*)var)->typelib;
+
+ if (value->result_type() == STRING_RESULT)
+ {
+ if (!(res= value->val_str(&str)))
+ goto err;
+ if ((result= find_type(typelib, res->ptr(), res->length(), 1)-1) < 0)
+ {
+ strvalue= res->c_ptr_quick();
+ goto err;
+ }
+ }
+ else
+ {
+ ulonglong tmp= value->val_int();
+ if (tmp >= typelib->count)
+ {
+ llstr(tmp, buff);
+ strvalue= buff;
+ goto err;
+ }
+ result= (long)tmp;
+ }
+ *(long*)save= result;
+ return 0;
+err:
+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->name, strvalue);
+ return 1;
+}
+
+
+static int check_func_set(THD *thd, struct st_mysql_sys_var *var,
+ void *save, Item *value)
+{
+ char buff[STRING_BUFFER_USUAL_SIZE], *error= 0;
+ const char *strvalue= "NULL";
+ TYPELIB *typelib;
+ long result;
+ uint error_len;
+ bool not_used;
+ String str(buff, sizeof(buff), system_charset_info), *res;
+
+ if (var->flags & PLUGIN_VAR_THDLOCAL)
+ typelib= ((thdvar_typelib_t*)var)->typelib;
+ else
+ typelib= ((sysvar_typelib_t*)var)->typelib;
+
+ if (value->result_type() == STRING_RESULT)
+ {
+ if (!(res= value->val_str(&str)))
+ goto err;
+ result= find_set(typelib, res->c_ptr_quick(), res->length(), NULL,
+ &error, &error_len, ¬_used);
+ if (error_len)
+ {
+ strmake(buff, error, min(sizeof(buff), error_len));
+ strvalue= buff;
+ goto err;
+ }
+ }
+ else
+ {
+ ulonglong tmp= value->val_int();
+ if (unlikely((tmp >= (ULL(1) << typelib->count)) &&
+ (typelib->count < sizeof(long)*8)))
+ {
+ llstr(tmp, buff);
+ strvalue= buff;
+ goto err;
+ }
+ result= (long)tmp;
+ }
+ *(long*)save= result;
+ return 0;
+err:
+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->name, strvalue);
+ return 1;
+}
+
+
+static void update_func_bool(THD *thd, struct st_mysql_sys_var *var,
+ void *tgt, void *save)
+{
+ *(my_bool *) tgt= *(int *)save ? 1 : 0;
+}
+
+
+static void update_func_int(THD *thd, struct st_mysql_sys_var *var,
+ void *tgt, void *save)
+{
+ int tmp= *(int *)save;
+ struct my_option options;
+ plugin_opt_set_limits(&options, var);
+ *(int *) tgt= (int) getopt_ull_limit_value(tmp, &options);
+}
+
+
+static void update_func_long(THD *thd, struct st_mysql_sys_var *var,
+ void *tgt, void *save)
+{
+ long tmp= *(long *)save;
+ struct my_option options;
+ plugin_opt_set_limits(&options, var);
+ *(long *) tgt= (long) getopt_ull_limit_value(tmp, &options);
+}
+
+
+static void update_func_longlong(THD *thd, struct st_mysql_sys_var *var,
+ void *tgt, void *save)
+{
+ ulonglong tmp= *(ulonglong *)save;
+ struct my_option options;
+ plugin_opt_set_limits(&options, var);
+ *(longlong *) tgt= getopt_ull_limit_value(tmp, &options);
+}
+
+
+static void update_func_str(THD *thd, struct st_mysql_sys_var *var,
+ void *tgt, void *save)
+{
+ char *old= *(char **) tgt;
+ *(char **) tgt= *(char **)save;
+ if (var->flags & PLUGIN_VAR_MEMALLOC)
+ {
+ *(char **) tgt= my_strdup(*(char **) save, MYF(0));
+ my_free(old, MYF(0));
+ }
+}
+
+
+static st_plugin_var *register_var(const char *plugin, const char *name,
+ int flags)
+{
+ uint length= strlen(plugin) + strlen(name) + 3, size= 0, offset;
+ st_plugin_var *result;
+
+ if (!(flags & PLUGIN_VAR_THDLOCAL))
+ return NULL;
+
+ switch (flags & PLUGIN_VAR_TYPEMASK) {
+ case PLUGIN_VAR_BOOL:
+ size= sizeof(my_bool);
+ break;
+ case PLUGIN_VAR_INT:
+ size= sizeof(int);
+ break;
+ case PLUGIN_VAR_LONG:
+ size= sizeof(long);
+ break;
+ case PLUGIN_VAR_LONGLONG:
+ size= sizeof(ulonglong);
+ break;
+ case PLUGIN_VAR_STR:
+ size= sizeof(char*);
+ break;
+ default:
+ return NULL;
+ };
+
+ char *varname= ((char*) my_alloca(length)), *p;
+ strxmov(varname + 1, plugin, "_", name, NullS);
+ for (p= varname + 1; *p; p++)
+ if (*p == '-')
+ *p= '_';
+
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ if (!(result= find_var(NULL, varname + 1, flags)))
+ {
+ result= (st_plugin_var*) alloc_root(&plugin_mem_root,
+ sizeof(struct st_plugin_var) + length);
+ varname[0]= flags & PLUGIN_VAR_TYPEMASK;
+ result->name= (char *) memcpy(&result[1], varname, length);
+ result->name_len= length;
+ result->offset= -1;
+ if (size)
+ {
+ offset= global_system_variables.dynamic_variables_size;
+ offset= (offset + size - 1) & ~(size - 1);
+ result->offset= (int) offset;
+ uint new_size= (offset + size + 63) & ~63;
+
+ if (new_size > global_variables_dynamic_size)
+ {
+ global_system_variables.dynamic_variables_ptr=
+ my_realloc(global_system_variables.dynamic_variables_ptr, new_size,
+ MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
+ max_system_variables.dynamic_variables_ptr=
+ my_realloc(max_system_variables.dynamic_variables_ptr, new_size,
+ MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
+ global_variables_dynamic_size= new_size;
+ }
+ global_system_variables.dynamic_variables_size= offset + size;
+ max_system_variables.dynamic_variables_size= offset + size;
+ global_system_variables.dynamic_variables_version++;
+ max_system_variables.dynamic_variables_version++;
+ }
+ my_hash_insert(&plugin_var_hash, (byte*) result);
+ }
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ my_afree(varname);
+ return result;
+}
+
+static st_plugin_var *find_var(const char *plugin, const char *name,
+ int flags)
+{
+ st_plugin_var *result= NULL;
+ uint namelen, length, pluginlen= 0;
+ char *varname, *p;
+
+ if (!(flags & PLUGIN_VAR_THDLOCAL))
+ return NULL;
+
+ namelen= strlen(name);
+ if (plugin)
+ pluginlen= strlen(plugin) + 1;
+ length= namelen + pluginlen + 2;
+ varname= (char*) my_alloca(length);
+
+ if (plugin)
+ strxmov(varname + 1, plugin, "_", name, NullS);
+ else
+ memcpy(varname + 1, name, namelen + 1);
+
+ for (p= varname + 1; *p; p++)
+ if (*p == '-')
+ *p= '_';
+
+ varname[0]= flags & PLUGIN_VAR_TYPEMASK;
+
+ if (plugin)
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ result= (st_plugin_var*) hash_search(&plugin_var_hash,
+ (const byte*)varname, length);
+ if (plugin)
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+
+ my_afree(varname);
+ return result;
+}
+
+static byte *mysql_sys_var_ptr(void* a_thd, int offset)
+{
+ THD *thd= (THD*) a_thd;
+ uint idx;
+ st_plugin_var *v;
+ sys_var_pluginvar *pi;
+ sys_var *var;
+ char **pp;
+
+ DBUG_ASSERT(offset >= 0);
+ DBUG_ASSERT((uint)offset < global_system_variables.dynamic_variables_size);
+
+ if (!thd)
+ return (byte*)global_system_variables.dynamic_variables_ptr + offset;
+
+ if ((uint)offset >= thd->variables.dynamic_variables_size ||
+ !thd->variables.dynamic_variables_ptr)
+ {
+ rw_wrlock(&THR_LOCK_plugin);
+
+ thd->variables.dynamic_variables_ptr=
+ my_realloc(thd->variables.dynamic_variables_ptr,
+ global_system_variables.dynamic_variables_size,
+ MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
+
+ memcpy(thd->variables.dynamic_variables_ptr +
+ thd->variables.dynamic_variables_size,
+ global_system_variables.dynamic_variables_ptr +
+ thd->variables.dynamic_variables_size,
+ global_system_variables.dynamic_variables_size -
+ thd->variables.dynamic_variables_size);
+
+ /*
+ now we need to iterate through any newly copied 'defaults'
+ and if it is a string type with MEMALLOC flag, we need to strdup
+ */
+ for (idx= 0; idx < plugin_var_hash.records; idx++)
+ {
+ v= (st_plugin_var*) hash_element(&plugin_var_hash,idx);
+
+ if (v->offset < (int) thd->variables.dynamic_variables_size ||
+ !(var= find_sys_var(v->name + 1, /*v->name_len - 1*/ 0)) ||
+ !(pi= var->cast_pluginvar()) ||
+ v->name[0] != (pi->plugin_var->flags & PLUGIN_VAR_TYPEMASK))
+ continue;
+
+ if ((pi->plugin_var->flags & PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_STR
&&
+ pi->plugin_var->flags & PLUGIN_VAR_MEMALLOC)
+ {
+ pp= (char**)(thd->variables.dynamic_variables_ptr +
+ *(int*)(pi->plugin_var + 1));
+ if (*pp)
+ *pp= my_strdup(*pp, MYF(MY_WME|MY_FAE));
+ }
+ }
+
+ thd->variables.dynamic_variables_version=
+ global_system_variables.dynamic_variables_version;
+ thd->variables.dynamic_variables_size=
+ global_system_variables.dynamic_variables_size;
+
+ rw_unlock(&THR_LOCK_plugin);
+ }
+ return (byte*)thd->variables.dynamic_variables_ptr + offset;
+}
+
+
+void mysql_pluginvar_cleanup(THD *thd)
+{
+ st_plugin_var *v;
+ sys_var_pluginvar *pivar;
+ sys_var *var;
+ int flags;
+ uint idx;
+
+ for (idx= 0; idx < plugin_var_hash.records; idx++)
+ {
+ v= (st_plugin_var*)hash_element(&plugin_var_hash,idx);
+
+ if (v->offset < 0 ||
+ v->offset >= (int) thd->variables.dynamic_variables_size)
+ continue;
+
+ if (!(var= find_sys_var(v->name + 1, /* v->name_len - 1 */ 0)) ||
+ !(pivar= var->cast_pluginvar()) ||
+ v->name[0] != (pivar->plugin_var->flags & PLUGIN_VAR_TYPEMASK))
+ continue;
+
+ flags= pivar->plugin_var->flags;
+
+ if ((flags & PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_STR &&
+ flags & PLUGIN_VAR_THDLOCAL && flags & PLUGIN_VAR_MEMALLOC)
+ {
+ char **ptr= (char**) pivar->real_value_ptr(thd, OPT_SESSION);
+ my_free(*ptr, MYF(MY_WME|MY_FAE));
+ }
+ }
+ my_free(thd->variables.dynamic_variables_ptr, MYF(MY_ALLOW_ZERO_PTR));
+}
+
+#define OPTION_SET_LIMITS(type, options, opt) \
+ options->var_type= type; \
+ options->def_value= (opt)->def_val; \
+ options->min_value= (opt)->min_val; \
+ options->max_value= (opt)->max_val; \
+ options->block_size= (opt)->blk_sz
+
+
+static void plugin_opt_set_limits(struct my_option *options,
+ const struct st_mysql_sys_var *opt)
+{
+ switch (opt->flags & (PLUGIN_VAR_TYPEMASK |
+ PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_THDLOCAL)) {
+ /* global system variables */
+ case PLUGIN_VAR_INT:
+ OPTION_SET_LIMITS(GET_INT, options, (sysvar_int_t*)opt);
+ break;
+ case PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED:
+ OPTION_SET_LIMITS(GET_UINT, options, (sysvar_uint_t*)opt);
+ break;
+ case PLUGIN_VAR_LONG:
+ OPTION_SET_LIMITS(GET_LONG, options, (sysvar_long_t*)opt);
+ break;
+ case PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED:
+ OPTION_SET_LIMITS(GET_ULONG, options, (sysvar_ulong_t*)opt);
+ break;
+ case PLUGIN_VAR_LONGLONG:
+ OPTION_SET_LIMITS(GET_LL, options, (sysvar_longlong_t*)opt);
+ break;
+ case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED:
+ OPTION_SET_LIMITS(GET_ULL, options, (sysvar_ulonglong_t*)opt);
+ break;
+ case PLUGIN_VAR_ENUM:
+ case PLUGIN_VAR_SET:
+ options->var_type= GET_STR;
+ options->def_value= *(ulong*)((void**)(opt + 1) + 1);
+ break;
+ case PLUGIN_VAR_BOOL:
+ options->var_type= GET_BOOL;
+ options->def_value= *(my_bool*)((void**)(opt + 1) + 1);
+ break;
+ case PLUGIN_VAR_STR:
+ options->var_type= GET_STR;
+ break;
+ /* threadlocal variables */
+ case PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL:
+ OPTION_SET_LIMITS(GET_INT, options, (thdvar_int_t*)opt);
+ break;
+ case PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_THDLOCAL:
+ OPTION_SET_LIMITS(GET_UINT, options, (thdvar_uint_t*)opt);
+ break;
+ case PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL:
+ OPTION_SET_LIMITS(GET_LONG, options, (thdvar_long_t*)opt);
+ break;
+ case PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_THDLOCAL:
+ OPTION_SET_LIMITS(GET_ULONG, options, (thdvar_ulong_t*)opt);
+ break;
+ case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL:
+ OPTION_SET_LIMITS(GET_LL, options, (thdvar_longlong_t*)opt);
+ break;
+ case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_THDLOCAL:
+ OPTION_SET_LIMITS(GET_ULL, options, (thdvar_ulonglong_t*)opt);
+ break;
+ case PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL:
+ options->var_type= GET_STR;
+ options->def_value= *(ulong*)((int*)(opt + 1) + 1);
+ options->min_value= options->block_size= 0;
+ options->max_value= ((thdvar_typelib_t*)opt)->typelib->count - 1;
+ break;
+ case PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL:
+ options->var_type= GET_STR;
+ options->def_value= *(ulong*)((int*)(opt + 1) + 1);
+ options->min_value= options->block_size= 0;
+ options->max_value= (ULL(1) <<
((thdvar_typelib_t*)opt)->typelib->count) - 1;
+ break;
+ case PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL:
+ options->var_type= GET_BOOL;
+ options->def_value= *(my_bool*)((int*)(opt + 1) + 1);
+ break;
+ case PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL:
+ options->var_type= GET_STR;
+ break;
+ default:
+ DBUG_ASSERT(0);
+ }
+ options->arg_type= REQUIRED_ARG;
+ if (opt->flags & PLUGIN_VAR_NOCMDARG)
+ options->arg_type= NO_ARG;
+ if (opt->flags & PLUGIN_VAR_OPCMDARG)
+ options->arg_type= OPT_ARG;
+}
+
+static my_bool get_one_option(int optid __attribute__((unused)),
+ const struct my_option *opt,
+ char *argument)
+{
+ struct st_mysql_sys_var *var;
+ long lvalue;
+ TYPELIB *typelib;
+ char* error;
+ bool dummy;
+ uint error_len;
+
+ if (!opt->app_type)
+ return 0;
+
+ var= (struct st_mysql_sys_var *) opt->app_type;
+
+ switch (var->flags & PLUGIN_VAR_TYPEMASK) {
+ case PLUGIN_VAR_ENUM:
+ if (var->flags & PLUGIN_VAR_THDLOCAL)
+ {
+ lvalue= (long) ((thdvar_typelib_t*)var)->def_val;
+ typelib= ((thdvar_typelib_t*)var)->typelib;
+ }
+ else
+ {
+ lvalue= (long) ((sysvar_typelib_t*)var)->def_val;
+ typelib= ((sysvar_typelib_t*)var)->typelib;
+ }
+
+ if (argument == disabled_my_option)
+ lvalue= 0;
+ else
+ if (argument && (lvalue= find_type(argument, typelib, 2) - 1) <= 0)
+ goto bad_opt;
+
+ if (var->flags & PLUGIN_VAR_THDLOCAL)
+ THDVAR(NULL,(*(thdvar_typelib_t*)var))= (ulong) lvalue;
+ else
+ SYSVAR((*(sysvar_typelib_t*)var))= (ulong) lvalue;
+ break;
+ case PLUGIN_VAR_SET:
+ if (var->flags & PLUGIN_VAR_THDLOCAL)
+ {
+ lvalue= (long) ((thdvar_typelib_t*)var)->def_val;
+ typelib= ((thdvar_typelib_t*)var)->typelib;
+ }
+ else
+ {
+ lvalue= (long) ((sysvar_typelib_t*)var)->def_val;
+ typelib= ((sysvar_typelib_t*)var)->typelib;
+ }
+ if (argument)
+ {
+ lvalue= 0;
+ if (argument != disabled_my_option)
+ {
+ error= NULL;
+ error_len= 0;
+ lvalue= find_set(typelib, argument, strlen(argument), NULL,
+ &error, &error_len, &dummy);
+ if (error_len)
+ goto bad_opt;
+ }
+ }
+ if (var->flags & PLUGIN_VAR_THDLOCAL)
+ THDVAR(NULL,(*(thdvar_typelib_t*)var))= (ulong) lvalue;
+ else
+ SYSVAR((*(sysvar_typelib_t*)var))= (ulong) lvalue;
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+
+bad_opt:
+ fprintf(stderr, "Unknown or bad option to %s: %s\n", opt->name, argument);
+ exit(1);
+}
+
+
+static int construct_options(MEM_ROOT *mem_root,
+ struct st_plugin_int &tmp,
+ my_option *options,
+ my_bool **enabled, my_bool can_disable)
+{
+ const char *plugin_name= tmp.plugin->name;
+ uint namelen= strlen(plugin_name);
+ char *name= (char*) alloc_root(mem_root, namelen * 4 + (can_disable ? 75 : 10)) + 1;
+ char *optname, *p;
+ int index= 0, offset= 0;
+ st_mysql_sys_var *opt, **plugin_option;
+ st_plugin_var *v;
+ DBUG_ENTER("construct_options");
+
+ /* support --skip-plugin-foo syntax */
+ memcpy(name, plugin_name, namelen + 1);
+ my_casedn_str(&my_charset_latin1, name);
+ strxmov(name + namelen + 1, "plugin-", name, NullS);
+
+ for (p= name + namelen*2 + 8; p > name; p--)
+ if (*p == '_')
+ *p= '-';
+
+ if (can_disable)
+ {
+ strxmov(name + namelen*2 + 10, "Enable ", plugin_name, " plugin. "
+ "Disable with --skip-plugin-", name," (will save memory).", NullS);
+
+ options[0].comment= name + namelen*2 + 10;
+ }
+
+ *((my_bool *)(name -1))= **enabled;
+ *enabled= (my_bool *)(name - 1);
+
+
+ options[1].name= (options[0].name= name) + namelen + 1;
+ options[0].id= options[1].id= 256;
+ options[0].var_type= options[1].var_type= GET_BOOL;
+ options[0].arg_type= options[1].arg_type= NO_ARG;
+ options[0].def_value= options[1].def_value= **enabled;
+ options[0].value= options[0].u_max_value=
+ options[1].value= options[1].u_max_value= (gptr*) (name - 1);
+ options+= 2;
+
+ /*
+ Two passes as the 2nd pass will take pointer addresses for use
+ by my_getopt
+ */
+
+ for (plugin_option= tmp.plugin->system_vars;
+ plugin_option && *plugin_option; plugin_option++, index++)
+ {
+ opt= *plugin_option;
+ if (!(opt->flags & PLUGIN_VAR_THDLOCAL))
+ continue;
+ if (!(register_var(name, opt->name, opt->flags)))
+ continue;
+ switch (opt->flags & PLUGIN_VAR_TYPEMASK) {
+ case PLUGIN_VAR_BOOL:
+ SET_PLUGIN_VAR_RESOLVE((thdvar_bool_t *)opt);
+ break;
+ case PLUGIN_VAR_INT:
+ SET_PLUGIN_VAR_RESOLVE((thdvar_int_t *)opt);
+ break;
+ case PLUGIN_VAR_LONG:
+ SET_PLUGIN_VAR_RESOLVE((thdvar_long_t *)opt);
+ break;
+ case PLUGIN_VAR_LONGLONG:
+ SET_PLUGIN_VAR_RESOLVE((thdvar_longlong_t *)opt);
+ break;
+ case PLUGIN_VAR_STR:
+ SET_PLUGIN_VAR_RESOLVE((thdvar_str_t *)opt);
+ break;
+ case PLUGIN_VAR_ENUM:
+ case PLUGIN_VAR_SET:
+ SET_PLUGIN_VAR_RESOLVE((thdvar_typelib_t *)opt);
+ break;
+ default:
+ sql_print_error("Unknown variable type code 0x%x in plugin '%s'.",
+ opt->flags, tmp.plugin->name);
+ DBUG_RETURN(-1);
+ };
+ }
+
+ for (plugin_option= tmp.plugin->system_vars;
+ plugin_option && *plugin_option; plugin_option++, index++)
+ {
+ switch ((opt= *plugin_option)->flags & PLUGIN_VAR_TYPEMASK) {
+ case PLUGIN_VAR_BOOL:
+ if (!opt->check)
+ opt->check= check_func_bool;
+ if (!opt->update)
+ opt->update= update_func_bool;
+ break;
+ case PLUGIN_VAR_INT:
+ if (!opt->check)
+ opt->check= check_func_int;
+ if (!opt->update)
+ opt->update= update_func_int;
+ break;
+ case PLUGIN_VAR_LONG:
+ if (!opt->check)
+ opt->check= check_func_long;
+ if (!opt->update)
+ opt->update= update_func_long;
+ break;
+ case PLUGIN_VAR_LONGLONG:
+ if (!opt->check)
+ opt->check= check_func_longlong;
+ if (!opt->update)
+ opt->update= update_func_longlong;
+ break;
+ case PLUGIN_VAR_STR:
+ if (!opt->check)
+ opt->check= check_func_str;
+ if (!opt->update)
+ {
+ opt->update= update_func_str;
+ if (!(opt->flags & PLUGIN_VAR_MEMALLOC))
+ opt->flags |= PLUGIN_VAR_READONLY;
+ }
+ break;
+ case PLUGIN_VAR_ENUM:
+ if (!opt->check)
+ opt->check= check_func_enum;
+ if (!opt->update)
+ opt->update= update_func_long;
+ break;
+ case PLUGIN_VAR_SET:
+ if (!opt->check)
+ opt->check= check_func_set;
+ if (!opt->update)
+ opt->update= update_func_long;
+ break;
+ default:
+ sql_print_error("Unknown variable type code 0x%x in plugin '%s'.",
+ opt->flags, tmp.plugin->name);
+ DBUG_RETURN(-1);
+ }
+
+ if (opt->flags & PLUGIN_VAR_NOCMDOPT)
+ continue;
+
+ if (!opt->name)
+ {
+ sql_print_error("Missing variable name in plugin '%s'.",
+ tmp.plugin->name);
+ DBUG_RETURN(-1);
+ }
+
+ if (!(v= find_var(name, opt->name, opt->flags)))
+ {
+ uint optnamelen= strlen(opt->name);
+ optname= (char*) alloc_root(mem_root, namelen + optnamelen + 2);
+ strxmov(optname, name, "-", opt->name, NullS);
+ }
+ else
+ optname= memdup_root(mem_root, v->name + 1, v->name_len - 1);
+
+ /* convert '_' to '-' */
+ for (p= optname; *p; p++)
+ if (*p == '_')
+ *p= '-';
+
+ options->name= optname;
+ options->comment= opt->comment;
+ options->app_type= (long) opt;
+ options->id= (options-1)->id + 1;
+
+ if (opt->flags & PLUGIN_VAR_THDLOCAL)
+ *(int*)(opt + 1)= offset= v->offset;
+
+ plugin_opt_set_limits(options, opt);
+
+ if ((opt->flags & PLUGIN_VAR_TYPEMASK) != PLUGIN_VAR_ENUM &&
+ (opt->flags & PLUGIN_VAR_TYPEMASK) != PLUGIN_VAR_SET)
+ {
+ if (opt->flags & PLUGIN_VAR_THDLOCAL)
+ options->value= options->u_max_value= (gptr*)
+ (global_system_variables.dynamic_variables_ptr + offset);
+ else
+ options->value= options->u_max_value= *(gptr**)(opt + 1);
+ }
+
+ options++;
+ }
+ DBUG_RETURN(0);
+}
+
+
+/*
+ SYNOPSIS
+ test_plugin_options()
+ plugin internal plugin structure
+ argv user supplied arguments
+ default_enabled default plugin enable status
+ RETURNS:
+ 0 SUCCESS - plugin should be enabled/loaded
+*/
+static int test_plugin_options(struct st_plugin_int &tmp,
+ char **argv, my_bool default_enabled)
+{
+ char buffer[1000];
+ struct sys_var_chain chain= { NULL, NULL };
+ my_bool enabled_saved= default_enabled, can_disable;
+ my_bool *enabled= &default_enabled;
+ MEM_ROOT *mem_root= alloc_root_inited(&tmp.mem_root) ?
+ &tmp.mem_root : &plugin_mem_root;
+ st_mysql_sys_var **opt;
+ my_option *opts;
+ char *p, **pp, *varname;
+ int argc, error;
+ st_mysql_sys_var *o;
+ sys_var *v;
+ struct st_plugin_var *var;
+ uint len, count= 0;
+ DBUG_ENTER("test_plugin_options");
+ DBUG_ASSERT(tmp.plugin && tmp.plugin->name);
+
+ for (opt= tmp.plugin->system_vars; opt && *opt; opt++, count++);
+
+ can_disable=
+ my_strcasecmp(&my_charset_latin1, tmp.plugin->name, "MyISAM") ||
+ my_strcasecmp(&my_charset_latin1, tmp.plugin->name, "MEMORY");
+
+ if (count || (argv && *argv))
+ {
+ if (!(opts= (my_option*)
+ alloc_root(mem_root, sizeof(my_option) * (count + 3))))
+ {
+ sql_print_error("Out of memory for plugin '%s'.", tmp.plugin->name);
+ DBUG_RETURN(-1);
+ }
+ bzero(opts, sizeof(my_option) * (count + 3));
+
+ if (construct_options(mem_root, tmp, opts, &enabled, can_disable))
+ {
+ sql_print_error("Bad options for plugin '%s'.", tmp.plugin->name);
+ DBUG_RETURN(-1);
+ }
+
+ argc= 0;
+ for (pp= argv; *pp; pp++, argc++);
+
+ error= handle_options(&argc, &argv, opts, get_one_option);
+
+ my_afree(name1);
+
+ if (error)
+ {
+ sql_print_error("Parsing options for plugin '%s' failed.",
+ tmp.plugin->name);
+ DBUG_RETURN(error);
+ }
+ tmp.cmd_options= opts;
+ }
+
+ if (!*enabled && !can_disable)
+ {
+ sql_print_error("Plugin '%s' cannot be disabled", tmp.plugin->name);
+ *enabled= TRUE;
+ }
+
+ if (*enabled)
+ {
+ for (opt= tmp.plugin->system_vars; opt && *opt; opt++)
+ {
+ if (((o= *opt)->flags & PLUGIN_VAR_NOSYSVAR))
+ continue;
+
+ if ((var= find_var(tmp.plugin->name, o->name, o->flags)))
+ v= new (mem_root) sys_var_pluginvar(chain, var->name + 1, o);
+ else
+ {
+ len= strlen(tmp.plugin->name) + strlen(o->name) + 2;
+ varname= (char*) alloc_root(mem_root, len);
+ strxmov(varname, tmp.plugin->name, "-", o->name, NullS);
+ my_casedn_str(&my_charset_latin1, varname);
+
+ for (p= varname; *p; p++)
+ if (*p == '-')
+ *p= '_';
+
+ v= new (mem_root) sys_var_pluginvar(chain, varname, o);
+ }
+
+ DBUG_ASSERT(v);
+ }
+ if (chain.first)
+ {
+ chain.last->next = NULL;
+ if (mysql_add_sys_var_chain(chain.first, tmp.cmd_options))
+ {
+ sql_print_error("Plugin '%s' has conflicting system variables",
tmp.plugin->name);
+ DBUG_RETURN(1);
+ }
+ tmp.system_vars= chain.first;
+ }
+ DBUG_RETURN(0);
+ }
+
+ if (enabled_saved)
+ sql_print_information("Plugin '%s' disabled by command line option",
+ tmp.plugin->name);
+ DBUG_RETURN(1);
+}
+
+
+/****************************************************************************
+ Plugin support code
+****************************************************************************/
static struct st_plugin_dl *plugin_dl_find(const LEX_STRING *dl)
{
uint i;
+ struct st_plugin_dl *tmp;
DBUG_ENTER("plugin_dl_find");
for (i= 0; i < plugin_dl_array.elements; i++)
{
- struct st_plugin_dl *tmp= dynamic_element(&plugin_dl_array, i,
- struct st_plugin_dl *);
+ tmp= dynamic_element(&plugin_dl_array, i, struct st_plugin_dl *);
if (tmp->ref_count &&
! my_strnncoll(files_charset_info,
(const uchar *)dl->str, dl->length,
@@ -102,11 +1307,11 @@
static st_plugin_dl *plugin_dl_insert_or_reuse(struct st_plugin_dl *plugin_dl)
{
uint i;
+ struct st_plugin_dl *tmp;
DBUG_ENTER("plugin_dl_insert_or_reuse");
for (i= 0; i < plugin_dl_array.elements; i++)
{
- struct st_plugin_dl *tmp= dynamic_element(&plugin_dl_array, i,
- struct st_plugin_dl *);
+ tmp= dynamic_element(&plugin_dl_array, i, struct st_plugin_dl *);
if (! tmp->ref_count)
{
memcpy(tmp, plugin_dl, sizeof(struct st_plugin_dl));
@@ -366,12 +1571,24 @@
my_bool plugin_is_ready(const LEX_STRING *name, int type)
{
my_bool rc= FALSE;
+ if (plugin_status(name, type) == SHOW_OPTION_YES)
+ rc= TRUE;
+ return rc;
+}
+
+
+SHOW_COMP_OPTION plugin_status(const LEX_STRING *name, int type)
+{
+ SHOW_COMP_OPTION rc= SHOW_OPTION_NO;
struct st_plugin_int *plugin;
DBUG_ENTER("plugin_is_ready");
rw_rdlock(&THR_LOCK_plugin);
- if ((plugin= plugin_find_internal(name, type)) &&
- plugin->state == PLUGIN_IS_READY)
- rc= TRUE;
+ if ((plugin= plugin_find_internal(name, type)))
+ {
+ rc= SHOW_OPTION_DISABLED;
+ if (plugin->state == PLUGIN_IS_READY)
+ rc= SHOW_OPTION_YES;
+ }
rw_unlock(&THR_LOCK_plugin);
DBUG_RETURN(rc);
}
@@ -414,7 +1631,8 @@
struct st_plugin_int *));
}
-static my_bool plugin_add(const LEX_STRING *name, const LEX_STRING *dl, int report)
+static my_bool plugin_add(const LEX_STRING *name, const LEX_STRING *dl,
+ char **argv, int report)
{
struct st_plugin_int tmp;
struct st_mysql_plugin *plugin;
@@ -460,6 +1678,11 @@
tmp.name.length= name_len;
tmp.ref_count= 0;
tmp.state= PLUGIN_IS_UNINITIALIZED;
+ if (test_plugin_options(tmp, argv, true))
+ {
+ plugin_dl_del(dl);
+ DBUG_RETURN(FALSE);
+ }
if (! (tmp_plugin_ptr= plugin_insert_or_reuse(&tmp)))
goto err;
plugin_array_version++;
@@ -468,6 +1691,7 @@
tmp_plugin_ptr->state= PLUGIN_IS_FREED;
goto err;
}
+ init_alloc_root(&tmp_plugin_ptr->mem_root, 4096, 4096);
DBUG_RETURN(FALSE);
}
}
@@ -532,6 +1756,8 @@
plugin_dl_del(&plugin->plugin_dl->dl);
plugin->state= PLUGIN_IS_FREED;
plugin_array_version++;
+ mysql_del_sys_var_chain(plugin->system_vars);
+ free_root(&plugin->mem_root, MYF(0));
DBUG_VOID_RETURN;
}
@@ -620,6 +1846,14 @@
}
+static byte *get_var_hash_key(const byte *buff, uint *length,
+ my_bool not_used __attribute__((unused)))
+{
+ struct st_plugin_var *var= (st_plugin_var *)buff;
+ *length= var->name_len;
+ return (byte*) var->name;
+}
+
/*
The logic is that we first load and initialize all compiled in plugins.
From there we load up the dynamic types (assuming we have not been told to
@@ -627,7 +1861,7 @@
Finally we inializie everything, aka the dynamic that have yet to initialize.
*/
-int plugin_init(int skip_dynamic_loading)
+int plugin_init(char **argv, int flags)
{
uint i;
struct st_mysql_plugin **builtins;
@@ -637,6 +1871,12 @@
if (initialized)
DBUG_RETURN(0);
+ init_alloc_root(&plugin_mem_root, 4096, 4096);
+ if (hash_init(&plugin_var_hash, &my_charset_bin, 16, 0, 0,
+ get_var_hash_key, NULL, 0))
+ goto err;
+
+
my_rwlock_init(&THR_LOCK_plugin, NULL);
if (my_init_dynamic_array(&plugin_dl_array,
@@ -659,25 +1899,40 @@
{
for (plugin= *builtins; plugin->info; plugin++)
{
-// if (!(strcmp(plugin->name, "MyISAM")))
- {
- if (plugin_register_builtin(plugin))
- goto err;
- struct st_plugin_int *tmp= dynamic_element(&plugin_array,
- plugin_array.elements-1,
- struct st_plugin_int *);
- if (plugin_initialize(tmp))
- goto err;
- }
+ /* by default, only ndbcluster is disabled */
+ bool def_enabled=
+ my_strcasecmp(&my_charset_latin1, plugin->name, "NDBCLUSTER") != 0;
+ struct st_plugin_int tmp, *plugin_ptr;
+ bzero(&tmp, sizeof(tmp));
+ tmp.plugin= plugin;
+ if (test_plugin_options(tmp, argv, def_enabled))
+ continue;
+ if (register_builtin(plugin, tmp, plugin_ptr))
+ goto err;
+
+ /* only initialize MyISAM, CSV and MEMORY at this stage */
+ if ((!my_strcasecmp(&my_charset_latin1, plugin->name, "MyISAM") ||
+ !my_strcasecmp(&my_charset_latin1, plugin->name, "MEMORY") ||
+ !my_strcasecmp(&my_charset_latin1, plugin->name, "CSV")) &&
+ plugin_initialize(plugin_ptr))
+ goto err;
}
}
/* Register all dynamic plugins */
- if (!skip_dynamic_loading)
- plugin_load();
+ if (!(flags & PLUGIN_INIT_SKIP_DYNAMIC_LOADING))
+ {
+ if (opt_plugin_load && plugin_load_list(argv, opt_plugin_load))
+ goto err;
+ if (!(flags & PLUGIN_INIT_SKIP_PLUGIN_TABLE))
+ plugin_load(argv);
+ }
initialized= 1;
+ if (flags & PLUGIN_INIT_SKIP_INITIALIZATION)
+ DBUG_RETURN(0);
+
/*
Now we initialize all remaining plugins
*/
@@ -702,9 +1957,10 @@
}
-my_bool plugin_register_builtin(struct st_mysql_plugin *plugin)
+static my_bool register_builtin(struct st_mysql_plugin *plugin,
+ struct st_plugin_int &tmp,
+ struct st_plugin_int *&ptr)
{
- struct st_plugin_int tmp;
DBUG_ENTER("plugin_register_builtin");
tmp.plugin= plugin;
@@ -719,17 +1975,23 @@
if (insert_dynamic(&plugin_array, (gptr)&tmp))
DBUG_RETURN(1);
- if (my_hash_insert(&plugin_hash[plugin->type],
- (byte*)dynamic_element(&plugin_array,
- plugin_array.elements - 1,
- struct st_plugin_int *)))
+ ptr= dynamic_element(&plugin_array, plugin_array.elements - 1,
+ struct st_plugin_int *);
+
+ if (my_hash_insert(&plugin_hash[plugin->type],(byte*) ptr))
DBUG_RETURN(1);
DBUG_RETURN(0);
}
+my_bool plugin_register_builtin(struct st_mysql_plugin *plugin)
+{
+ struct st_plugin_int tmp, *ptr;
+ return register_builtin(plugin, tmp, ptr);
+}
+
-void plugin_load(void)
+static void plugin_load(char **argv)
{
TABLE_LIST tables;
TABLE *table;
@@ -773,7 +2035,7 @@
LEX_STRING name= {(char *)str_name.ptr(), str_name.length()};
LEX_STRING dl= {(char *)str_dl.ptr(), str_dl.length()};
- if (plugin_add(&name, &dl, REPORT_TO_LOG))
+ if (plugin_add(&name, &dl, argv, REPORT_TO_LOG))
sql_print_warning("Couldn't load plugin named '%s' with soname '%s'.",
str_name.c_ptr(), str_dl.c_ptr());
}
@@ -791,6 +2053,70 @@
}
+static bool plugin_load_list(char **argv, const char *list)
+{
+ char buffer[FN_REFLEN];
+ LEX_STRING name= {buffer, 0}, dl= {NULL, 0}, *str= &name;
+ char *p= buffer;
+ bool result= FALSE;
+ DBUG_ENTER("plugin_load_list");
+ while (list)
+ {
+ if (p == buffer + sizeof(buffer) - 1)
+ break;
+ switch ((*(p++)= *(list++))) {
+ case '\0':
+ list= NULL; /* terminate the loop */
+#ifndef __WIN__
+ case ':': /* can't use this as delimiter as it may be drive letter */
+#endif
+ case ';':
+ name.str[name.length]= '\0';
+ if (str != &dl) // load all plugins in named module
+ {
+ struct st_plugin_dl *plugin_dl;
+ dl= name;
+ if ((plugin_dl= plugin_dl_add(&dl, REPORT_TO_LOG)))
+ {
+ struct st_mysql_plugin *plugin;
+ for (plugin= plugin_dl->plugins; plugin->info; plugin++)
+ {
+ name.str= (char *) plugin->name;
+ name.length= strlen(name.str);
+ if (plugin_add(&name, &dl, argv, REPORT_TO_LOG))
+ goto error;
+ }
+ plugin_dl_del(&dl); // reduce ref count
+ }
+ }
+ else
+ if (plugin_add(&name, &dl, argv, REPORT_TO_LOG))
+ goto error;
+ name.length= dl.length= 0;
+ dl.str= NULL; name.str= p= buffer;
+ str= &name;
+ continue;
+ case '=':
+ case '#':
+ if (str == &name)
+ {
+ str= &dl;
+ str->str= p;
+ continue;
+ }
+ default:
+ str->length++;
+ continue;
+ }
+ }
+ DBUG_RETURN(FALSE);
+error:
+ sql_print_error("Couldn't load plugin named '%s' with soname '%s'.",
+ name.str, dl.str);
+ DBUG_RETURN(TRUE);
+}
+
+
void plugin_shutdown(void)
{
uint i;
@@ -803,6 +2129,8 @@
{
struct st_plugin_int *tmp= dynamic_element(&plugin_array, i,
struct st_plugin_int *);
+ if (tmp->state == PLUGIN_IS_UNINITIALIZED)
+ continue;
plugin_deinitialize(tmp);
}
@@ -845,7 +2173,7 @@
DBUG_RETURN(TRUE);
rw_wrlock(&THR_LOCK_plugin);
- if (plugin_add(name, dl, REPORT_TO_USER))
+ if (plugin_add(name, dl, NULL, REPORT_TO_USER))
goto err;
tmp= plugin_find_internal(name, MYSQL_ANY_PLUGIN);
--- 1.12/sql/sql_plugin.h 2006-12-21 16:54:34 -08:00
+++ 1.13/sql/sql_plugin.h 2006-12-21 16:54:34 -08:00
@@ -17,6 +17,16 @@
#ifndef _sql_plugin_h
#define _sql_plugin_h
+class sys_var;
+
+/*
+ the following flags are valid for plugin_init()
+*/
+#define PLUGIN_INIT_SKIP_DYNAMIC_LOADING 1
+#define PLUGIN_INIT_SKIP_PLUGIN_TABLE 2
+#define PLUGIN_INIT_SKIP_INITIALIZATION 4
+
+
/*
the following #define adds server-only members to enum_mysql_show_type,
that is defined in plugin.h
@@ -64,14 +74,21 @@
uint state;
uint ref_count; /* number of threads using the plugin */
void *data; /* plugin type specific, e.g. handlerton */
+ MEM_ROOT mem_root; /* memory for dynamic plugin structures */
+ sys_var *system_vars; /* server variables for this plugin */
+ struct my_option *cmd_options;/* may go away soon */
};
typedef int (*plugin_type_init)(struct st_plugin_int *);
+extern char *opt_plugin_load;
extern char *opt_plugin_dir_ptr;
extern char opt_plugin_dir[FN_REFLEN];
extern const LEX_STRING plugin_type_names[];
-extern int plugin_init(int);
+extern int plugin_init(char **argv, int init_flags);
+extern void mysql_pluginvar_cleanup(THD *thd);
+extern void my_print_help_inc_plugins(struct my_option *options, uint size);
+extern SHOW_COMP_OPTION plugin_status(const LEX_STRING *name, int type);
extern void plugin_shutdown(void);
extern my_bool plugin_is_ready(const LEX_STRING *name, int type);
extern st_plugin_int *plugin_lock(const LEX_STRING *name, int type);
--- 1.92/storage/federated/ha_federated.cc 2006-12-21 16:54:34 -08:00
+++ 1.93/storage/federated/ha_federated.cc 2006-12-21 16:54:35 -08:00
@@ -1647,7 +1647,7 @@
values_string.length(0);
insert_string.length(0);
insert_field_value_string.length(0);
- statistic_increment(table->in_use->status_var.ha_write_count, &LOCK_status);
+ ha_statistic_increment(&SSV::ha_write_count);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time();
@@ -2114,8 +2114,7 @@
*result= 0; // In case of errors
index_string.length(0);
sql_query.length(0);
- statistic_increment(table->in_use->status_var.ha_read_key_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_key_count);
sql_query.append(share->select_query);
@@ -2229,8 +2228,7 @@
int ha_federated::index_next(byte *buf)
{
DBUG_ENTER("ha_federated::index_next");
- statistic_increment(table->in_use->status_var.ha_read_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_next_count);
DBUG_RETURN(read_next(buf, stored_result));
}
@@ -2431,8 +2429,7 @@
{
int result;
DBUG_ENTER("ha_federated::rnd_pos");
- statistic_increment(table->in_use->status_var.ha_read_rnd_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_rnd_count);
if (table->s->primary_key != MAX_KEY)
{
/* We have a primary key, so use index_read_idx to find row */
--- 1.157/sql/sql_repl.cc 2006-12-21 16:54:35 -08:00
+++ 1.158/sql/sql_repl.cc 2006-12-21 16:54:35 -08:00
@@ -1597,6 +1597,148 @@
return 0;
}
+/*
+ Replication System Variables
+*/
+
+class sys_var_slave_skip_counter :public sys_var
+{
+public:
+ sys_var_slave_skip_counter(sys_var_chain &chain, const char *name_arg)
+ :sys_var(chain, name_arg) {}
+ bool check(THD *thd, set_var *var);
+ bool update(THD *thd, set_var *var);
+ bool check_type(enum_var_type type) { return type != OPT_GLOBAL; }
+ /*
+ We can't retrieve the value of this, so we don't have to define
+ type() or value_ptr()
+ */
+};
+
+class sys_var_sync_binlog_period :public sys_var_long_ptr
+{
+public:
+ sys_var_sync_binlog_period(sys_var_chain &chain, const char *name_arg,
+ ulong *value_ptr)
+ :sys_var_long_ptr(chain, name_arg,value_ptr) {}
+ bool update(THD *thd, set_var *var);
+};
+
+static sys_var_chain vars = { NULL, NULL };
+
+static sys_var_bool_ptr sys_relay_log_purge(vars, "relay_log_purge",
+ &relay_log_purge);
+static sys_var_long_ptr sys_slave_net_timeout(vars, "slave_net_timeout",
+ &slave_net_timeout);
+static sys_var_long_ptr sys_slave_trans_retries(vars, "slave_transaction_retries",
+ &slave_trans_retries);
+static sys_var_sync_binlog_period sys_sync_binlog_period(vars, "sync_binlog",
&sync_binlog_period);
+static sys_var_slave_skip_counter sys_slave_skip_counter(vars, "sql_slave_skip_counter");
+
+static int show_slave_skip_errors(THD *thd, SHOW_VAR *var, char *buff);
+
+
+static SHOW_VAR fixed_vars[]= {
+ {"log_slave_updates", (char*) &opt_log_slave_updates, SHOW_MY_BOOL},
+ {"relay_log_space_limit", (char*) &relay_log_space_limit, SHOW_LONGLONG},
+ {"slave_load_tmpdir", (char*) &slave_load_tmpdir, SHOW_CHAR_PTR},
+ {"slave_skip_errors", (char*) &show_slave_skip_errors, SHOW_FUNC},
+};
+
+static int show_slave_skip_errors(THD *thd, SHOW_VAR *var, char *buff)
+{
+ var->type=SHOW_CHAR;
+ var->value= buff;
+ if (!use_slave_mask || bitmap_is_clear_all(&slave_error_mask))
+ {
+ var->value= const_cast<char *>("OFF");
+ }
+ else if (bitmap_is_set_all(&slave_error_mask))
+ {
+ var->value= const_cast<char *>("ALL");
+ }
+ else
+ {
+ /* 10 is enough assuming errors are max 4 digits */
+ int i;
+ var->value= buff;
+ for (i= 1;
+ i < MAX_SLAVE_ERROR &&
+ (buff - var->value) < SHOW_VAR_FUNC_BUFF_SIZE;
+ i++)
+ {
+ if (bitmap_is_set(&slave_error_mask, i))
+ {
+ buff= int10_to_str(i, buff, 10);
+ *buff++= ',';
+ }
+ }
+ if (var->value != buff)
+ buff--; // Remove last ','
+ if (i < MAX_SLAVE_ERROR)
+ buff= strmov(buff, "..."); // Couldn't show all errors
+ *buff=0;
+ }
+ return 0;
+}
+
+bool sys_var_slave_skip_counter::check(THD *thd, set_var *var)
+{
+ int result= 0;
+ pthread_mutex_lock(&LOCK_active_mi);
+ pthread_mutex_lock(&active_mi->rli.run_lock);
+ if (active_mi->rli.slave_running)
+ {
+ my_message(ER_SLAVE_MUST_STOP, ER(ER_SLAVE_MUST_STOP), MYF(0));
+ result=1;
+ }
+ pthread_mutex_unlock(&active_mi->rli.run_lock);
+ pthread_mutex_unlock(&LOCK_active_mi);
+ var->save_result.ulong_value= (ulong) var->value->val_int();
+ return result;
+}
+
+
+bool sys_var_slave_skip_counter::update(THD *thd, set_var *var)
+{
+ pthread_mutex_lock(&LOCK_active_mi);
+ pthread_mutex_lock(&active_mi->rli.run_lock);
+ /*
+ The following test should normally never be true as we test this
+ in the check function; To be safe against multiple
+ SQL_SLAVE_SKIP_COUNTER request, we do the check anyway
+ */
+ if (!active_mi->rli.slave_running)
+ {
+ pthread_mutex_lock(&active_mi->rli.data_lock);
+ active_mi->rli.slave_skip_counter= var->save_result.ulong_value;
+ pthread_mutex_unlock(&active_mi->rli.data_lock);
+ }
+ pthread_mutex_unlock(&active_mi->rli.run_lock);
+ pthread_mutex_unlock(&LOCK_active_mi);
+ return 0;
+}
+
+
+bool sys_var_sync_binlog_period::update(THD *thd, set_var *var)
+{
+ sync_binlog_period= (ulong) var->save_result.ulonglong_value;
+ return 0;
+}
+
+int init_replication_sys_vars()
+{
+ mysql_append_static_vars(fixed_vars, sizeof(fixed_vars) / sizeof(SHOW_VAR));
+
+ if (mysql_add_sys_var_chain(vars.first, my_long_options))
+ {
+ /* should not happen */
+ fprintf(stderr, "failed to initialize replication system variables");
+ unireg_abort(1);
+ }
+ return 0;
+}
+
#endif /* HAVE_REPLICATION */
--- 1.42/sql/sql_repl.h 2006-12-21 16:54:35 -08:00
+++ 1.43/sql/sql_repl.h 2006-12-21 16:54:35 -08:00
@@ -68,6 +68,7 @@
} LOAD_FILE_INFO;
int log_loaded_block(IO_CACHE* file);
+int init_replication_sys_vars();
#endif /* HAVE_REPLICATION */
| Thread |
|---|
| • bk commit into 5.1 tree (antony:1.2361) | antony | 22 Dec |