Merge bk-internal.mysql.com:/home/bk/mysql-5.1-engines

into  chilla.local:/home/mydev/mysql-5.1-wl2936-two


client/mysql.cc:
  Auto merged
client/mysqltest.c:
  Auto merged
include/my_global.h:
  Auto merged
include/my_sys.h:
  Auto merged
mysql-test/lib/mtr_cases.pl:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/ndb_dd_basic.result:
  Auto merged
mysql-test/r/variables.result:
  Auto merged
mysql-test/t/ndb_dd_basic.test:
  Auto merged
mysql-test/t/variables.test:
  Auto merged
mysys/hash.c:
  Auto merged
sql/event_queue.cc:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/ha_partition.cc:
  Auto merged
sql/handler.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/opt_range.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_cache.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_connect.cc:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_plugin.cc:
  Auto merged
sql/sql_repl.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/structs.h:
  Auto merged
sql/table.cc:
  Auto merged
storage/innobase/handler/ha_innodb.cc:
  Auto merged
storage/innobase/handler/ha_innodb.h:
  Auto merged
include/typelib.h:
  WL#2936 - Falcon & MySQL plugin interface: server variables
  Manual merge
mysys/typelib.c:
  WL#2936 - Falcon & MySQL plugin interface: server variables
  Manual merge
This commit is contained in:
unknown 2007-04-27 19:09:39 +02:00
commit 2f664e46c6
79 changed files with 5306 additions and 2663 deletions

View File

@ -739,7 +739,7 @@ static struct my_option my_long_options[] =
"Number of seconds before connection timeout.", "Number of seconds before connection timeout.",
(gptr*) &opt_connect_timeout, (gptr*) &opt_connect_timeout,
(gptr*) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0, (gptr*) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0,
0, 1}, 0, 0},
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
"Max packet length to send to, or receive from server", "Max packet length to send to, or receive from server",
(gptr*) &opt_max_allowed_packet, (gptr*) &opt_max_allowed_packet, 0, GET_ULONG, (gptr*) &opt_max_allowed_packet, (gptr*) &opt_max_allowed_packet, 0, GET_ULONG,

View File

@ -1546,7 +1546,7 @@ void do_source(struct st_command *command)
{ {
static DYNAMIC_STRING ds_filename; static DYNAMIC_STRING ds_filename;
const struct command_arg source_args[] = { const struct command_arg source_args[] = {
"filename", ARG_STRING, TRUE, &ds_filename, "File to source" { "filename", ARG_STRING, TRUE, &ds_filename, "File to source" }
}; };
DBUG_ENTER("do_source"); DBUG_ENTER("do_source");
@ -1932,7 +1932,7 @@ void do_remove_file(struct st_command *command)
int error; int error;
static DYNAMIC_STRING ds_filename; static DYNAMIC_STRING ds_filename;
const struct command_arg rm_args[] = { const struct command_arg rm_args[] = {
"filename", ARG_STRING, TRUE, &ds_filename, "File to delete" { "filename", ARG_STRING, TRUE, &ds_filename, "File to delete" }
}; };
DBUG_ENTER("do_remove_file"); DBUG_ENTER("do_remove_file");
@ -1966,8 +1966,8 @@ void do_copy_file(struct st_command *command)
static DYNAMIC_STRING ds_from_file; static DYNAMIC_STRING ds_from_file;
static DYNAMIC_STRING ds_to_file; static DYNAMIC_STRING ds_to_file;
const struct command_arg copy_file_args[] = { const struct command_arg copy_file_args[] = {
"from_file", ARG_STRING, TRUE, &ds_from_file, "Filename to copy from", { "from_file", ARG_STRING, TRUE, &ds_from_file, "Filename to copy from" },
"to_file", ARG_STRING, TRUE, &ds_to_file, "Filename to copy to" { "to_file", ARG_STRING, TRUE, &ds_to_file, "Filename to copy to" }
}; };
DBUG_ENTER("do_copy_file"); DBUG_ENTER("do_copy_file");
@ -2003,8 +2003,8 @@ void do_chmod_file(struct st_command *command)
static DYNAMIC_STRING ds_mode; static DYNAMIC_STRING ds_mode;
static DYNAMIC_STRING ds_file; static DYNAMIC_STRING ds_file;
const struct command_arg chmod_file_args[] = { const struct command_arg chmod_file_args[] = {
"mode", ARG_STRING, TRUE, &ds_mode, "Mode of file", { "mode", ARG_STRING, TRUE, &ds_mode, "Mode of file" },
"file", ARG_STRING, TRUE, &ds_file, "Filename of file to modify" { "file", ARG_STRING, TRUE, &ds_file, "Filename of file to modify" }
}; };
DBUG_ENTER("do_chmod_file"); DBUG_ENTER("do_chmod_file");
@ -2041,7 +2041,7 @@ void do_file_exist(struct st_command *command)
int error; int error;
static DYNAMIC_STRING ds_filename; static DYNAMIC_STRING ds_filename;
const struct command_arg file_exist_args[] = { const struct command_arg file_exist_args[] = {
"filename", ARG_STRING, TRUE, &ds_filename, "File to check if it exist" { "filename", ARG_STRING, TRUE, &ds_filename, "File to check if it exist" }
}; };
DBUG_ENTER("do_file_exist"); DBUG_ENTER("do_file_exist");
@ -2123,8 +2123,8 @@ void do_write_file_command(struct st_command *command, my_bool append)
static DYNAMIC_STRING ds_filename; static DYNAMIC_STRING ds_filename;
static DYNAMIC_STRING ds_delimiter; static DYNAMIC_STRING ds_delimiter;
const struct command_arg write_file_args[] = { const struct command_arg write_file_args[] = {
"filename", ARG_STRING, TRUE, &ds_filename, "File to write to", { "filename", ARG_STRING, TRUE, &ds_filename, "File to write to" },
"delimiter", ARG_STRING, FALSE, &ds_delimiter, "Delimiter to read until" { "delimiter", ARG_STRING, FALSE, &ds_delimiter, "Delimiter to read until" }
}; };
DBUG_ENTER("do_write_file"); DBUG_ENTER("do_write_file");
@ -2232,7 +2232,7 @@ void do_cat_file(struct st_command *command)
char buff[512]; char buff[512];
static DYNAMIC_STRING ds_filename; static DYNAMIC_STRING ds_filename;
const struct command_arg cat_file_args[] = { const struct command_arg cat_file_args[] = {
"filename", ARG_STRING, TRUE, &ds_filename, "File to read from" { "filename", ARG_STRING, TRUE, &ds_filename, "File to read from" }
}; };
DBUG_ENTER("do_cat_file"); DBUG_ENTER("do_cat_file");
@ -2296,8 +2296,8 @@ void do_diff_files(struct st_command *command)
static DYNAMIC_STRING ds_filename; static DYNAMIC_STRING ds_filename;
static DYNAMIC_STRING ds_filename2; static DYNAMIC_STRING ds_filename2;
const struct command_arg diff_file_args[] = { const struct command_arg diff_file_args[] = {
"file1", ARG_STRING, TRUE, &ds_filename, "First file to diff", { "file1", ARG_STRING, TRUE, &ds_filename, "First file to diff" },
"file2", ARG_STRING, TRUE, &ds_filename2, "Second file to diff" { "file2", ARG_STRING, TRUE, &ds_filename2, "Second file to diff" }
}; };
DBUG_ENTER("do_diff_files"); DBUG_ENTER("do_diff_files");
@ -2373,7 +2373,7 @@ void do_perl(struct st_command *command)
static DYNAMIC_STRING ds_script; static DYNAMIC_STRING ds_script;
static DYNAMIC_STRING ds_delimiter; static DYNAMIC_STRING ds_delimiter;
const struct command_arg perl_args[] = { const struct command_arg perl_args[] = {
"delimiter", ARG_STRING, FALSE, &ds_delimiter, "Delimiter to read until" { "delimiter", ARG_STRING, FALSE, &ds_delimiter, "Delimiter to read until" }
}; };
DBUG_ENTER("do_perl"); DBUG_ENTER("do_perl");
@ -3452,18 +3452,14 @@ void do_connect(struct st_command *command)
static DYNAMIC_STRING ds_sock; static DYNAMIC_STRING ds_sock;
static DYNAMIC_STRING ds_options; static DYNAMIC_STRING ds_options;
const struct command_arg connect_args[] = { const struct command_arg connect_args[] = {
"connection name", ARG_STRING, TRUE, &ds_connection_name, { "connection name", ARG_STRING, TRUE, &ds_connection_name, "Name of the connection" },
"Name of the connection", { "host", ARG_STRING, TRUE, &ds_host, "Host to connect to" },
"host", ARG_STRING, TRUE, &ds_host, "Host to connect to", { "user", ARG_STRING, FALSE, &ds_user, "User to connect as" },
"user", ARG_STRING, FALSE, &ds_user, "User to connect as", { "passsword", ARG_STRING, FALSE, &ds_password, "Password used when connecting" },
"passsword", ARG_STRING, FALSE, &ds_password, { "database", ARG_STRING, FALSE, &ds_database, "Database to select after connect" },
"Password used when connecting", { "port", ARG_STRING, FALSE, &ds_port, "Port to connect to" },
"database", ARG_STRING, FALSE, &ds_database, { "socket", ARG_STRING, FALSE, &ds_sock, "Socket to connect with" },
"Dtabase to select after connect", { "options", ARG_STRING, FALSE, &ds_options, "Options to use while connecting" }
"port", ARG_STRING, FALSE, &ds_port, "Port to connect to",
"socket", ARG_STRING, FALSE, &ds_sock, "Socket to connect with",
"options", ARG_STRING, FALSE, &ds_options,
"Options to use while connecting"
}; };
DBUG_ENTER("do_connect"); DBUG_ENTER("do_connect");

View File

@ -241,7 +241,7 @@ static int create_header_files(struct errors *error_head)
/* generating sql_state.h file */ /* generating sql_state.h file */
if (tmp_error->sql_code1[0] || tmp_error->sql_code2[0]) if (tmp_error->sql_code1[0] || tmp_error->sql_code2[0])
fprintf(sql_statef, fprintf(sql_statef,
"%-40s,\"%s\", \"%s\",\n", tmp_error->er_name, "{ %-40s,\"%s\", \"%s\" },\n", tmp_error->er_name,
tmp_error->sql_code1, tmp_error->sql_code2); tmp_error->sql_code1, tmp_error->sql_code2);
/*generating er_name file */ /*generating er_name file */
fprintf(er_namef, "{ \"%s\", %d },\n", tmp_error->er_name, fprintf(er_namef, "{ \"%s\", %d },\n", tmp_error->er_name,

View File

@ -27,6 +27,9 @@ extern "C" {
*/ */
#define HASH_OVERHEAD (sizeof(char*)*2) #define HASH_OVERHEAD (sizeof(char*)*2)
/* flags for hash_init */
#define HASH_UNIQUE 1 /* hash_insert fails on duplicate key */
typedef byte *(*hash_get_key)(const byte *,uint*,my_bool); typedef byte *(*hash_get_key)(const byte *,uint*,my_bool);
typedef void (*hash_free_key)(void *); typedef void (*hash_free_key)(void *);

View File

@ -29,12 +29,16 @@ C_MODE_START
#define GET_STR 9 #define GET_STR 9
#define GET_STR_ALLOC 10 #define GET_STR_ALLOC 10
#define GET_DISABLED 11 #define GET_DISABLED 11
#define GET_ENUM 12
#define GET_SET 13
#define GET_ASK_ADDR 128 #define GET_ASK_ADDR 128
#define GET_TYPE_MASK 127 #define GET_TYPE_MASK 127
enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG }; enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG };
struct st_typelib;
struct my_option struct my_option
{ {
const char *name; /* Name of the option */ const char *name; /* Name of the option */
@ -42,7 +46,7 @@ struct my_option
const char *comment; /* option comment, for autom. --help */ const char *comment; /* option comment, for autom. --help */
gptr *value; /* The variable value */ gptr *value; /* The variable value */
gptr *u_max_value; /* The user def. max variable value */ gptr *u_max_value; /* The user def. max variable value */
const char **str_values; /* Pointer to possible values */ struct st_typelib *typelib; /* Pointer to possible values */
ulong var_type; ulong var_type;
enum get_opt_arg_type arg_type; enum get_opt_arg_type arg_type;
longlong def_value; /* Default value */ longlong def_value; /* Default value */
@ -50,7 +54,7 @@ struct my_option
longlong max_value; /* Max allowed value */ longlong max_value; /* Max allowed value */
longlong sub_size; /* Subtract this from given value */ longlong sub_size; /* Subtract this from given value */
long block_size; /* Value should be a mult. of this */ long block_size; /* Value should be a mult. of this */
int app_type; /* To be used by an application */ void *app_type; /* To be used by an application */
}; };
typedef my_bool (* my_get_one_option) (int, const struct my_option *, char * ); typedef my_bool (* my_get_one_option) (int, const struct my_option *, char * );
@ -58,6 +62,7 @@ typedef void (* my_error_reporter) (enum loglevel level, const char *format, ...
extern char *disabled_my_option; extern char *disabled_my_option;
extern my_bool my_getopt_print_errors; extern my_bool my_getopt_print_errors;
extern my_bool my_getopt_skip_unknown;
extern my_error_reporter my_getopt_error_reporter; extern my_error_reporter my_getopt_error_reporter;
extern int handle_options (int *argc, char ***argv, extern int handle_options (int *argc, char ***argv,

View File

@ -465,6 +465,14 @@ C_MODE_END
*/ */
#include <assert.h> #include <assert.h>
/* an assert that works at compile-time. only for constant expression */
#define compile_time_assert(X) \
do \
{ \
char compile_time_assert[(X) ? 1 : -1] \
__attribute__ ((unused)); \
} while(0)
/* Go around some bugs in different OS and compilers */ /* Go around some bugs in different OS and compilers */
#if defined (HPUX11) && defined(_LARGEFILE_SOURCE) #if defined (HPUX11) && defined(_LARGEFILE_SOURCE)
#define _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE

View File

@ -756,8 +756,15 @@ extern my_bool real_open_cached_file(IO_CACHE *cache);
extern void close_cached_file(IO_CACHE *cache); extern void close_cached_file(IO_CACHE *cache);
File create_temp_file(char *to, const char *dir, const char *pfx, File create_temp_file(char *to, const char *dir, const char *pfx,
int mode, myf MyFlags); int mode, myf MyFlags);
#define my_init_dynamic_array(A,B,C,D) init_dynamic_array(A,B,C,D CALLER_INFO) #define my_init_dynamic_array(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D CALLER_INFO)
#define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array(A,B,C,D ORIG_CALLER_INFO) #define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D ORIG_CALLER_INFO)
#define my_init_dynamic_array2(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E CALLER_INFO)
#define my_init_dynamic_array2_ci(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E ORIG_CALLER_INFO)
extern my_bool init_dynamic_array2(DYNAMIC_ARRAY *array,uint element_size,
void *init_buffer, uint init_alloc,
uint alloc_increment
CALLER_INFO_PROTO);
/* init_dynamic_array() function is deprecated */
extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size, extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size,
uint init_alloc,uint alloc_increment uint init_alloc,uint alloc_increment
CALLER_INFO_PROTO); CALLER_INFO_PROTO);

View File

@ -67,7 +67,6 @@ typedef int my_socket;
#include "mysql_version.h" #include "mysql_version.h"
#include "mysql_com.h" #include "mysql_com.h"
#include "mysql_time.h" #include "mysql_time.h"
#include "typelib.h"
#include "my_list.h" /* for LISTs used in 'MYSQL' and 'MYSQL_STMT' */ #include "my_list.h" /* for LISTs used in 'MYSQL' and 'MYSQL_STMT' */
@ -126,6 +125,8 @@ typedef unsigned long long my_ulonglong;
#endif #endif
#endif #endif
#include "typelib.h"
#define MYSQL_COUNT_ERROR (~(my_ulonglong) 0) #define MYSQL_COUNT_ERROR (~(my_ulonglong) 0)
/* backward compatibility define - to be removed eventually */ /* backward compatibility define - to be removed eventually */

View File

@ -16,6 +16,15 @@
#ifndef _my_plugin_h #ifndef _my_plugin_h
#define _my_plugin_h #define _my_plugin_h
#ifdef __cplusplus
class THD;
class Item;
#define MYSQL_THD THD*
#else
#define MYSQL_THD void*
#endif
/************************************************************************* /*************************************************************************
Plugin API. Common for all plugin types. Plugin API. Common for all plugin types.
*/ */
@ -85,7 +94,261 @@ struct st_mysql_show_var {
}; };
#define SHOW_VAR_FUNC_BUFF_SIZE 1024 #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)(MYSQL_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 /* Variable is per-connection */
#define PLUGIN_VAR_READONLY 0x0200 /* Server variable is read only */
#define PLUGIN_VAR_NOSYSVAR 0x0400 /* Not a server variable */
#define PLUGIN_VAR_NOCMDOPT 0x0800 /* Not a command line option */
#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 /* String needs memory allocated */
struct st_mysql_sys_var;
struct st_mysql_value;
/*
SYNOPSIS
(*mysql_var_check_func)()
thd thread handle
var dynamic variable being altered
save pointer to temporary storage
value user provided value
RETURN
0 user provided value is OK and the update func may be called.
any other value indicates error.
This function should parse the user provided value and store in the
provided temporary storage any data as required by the update func.
There is sufficient space in the temporary storage to store a double.
Note that the update func may not be called if any other error occurs
so any memory allocated should be thread-local so that it may be freed
automatically at the end of the statement.
*/
typedef int (*mysql_var_check_func)(MYSQL_THD thd,
struct st_mysql_sys_var *var,
void *save, struct st_mysql_value *value);
/*
SYNOPSIS
(*mysql_var_update_func)()
thd thread handle
var dynamic variable being altered
var_ptr pointer to dynamic variable
save pointer to temporary storage
RETURN
NONE
This function should use the validated value stored in the temporary store
and persist it in the provided pointer to the dynamic variable.
For example, strings may require memory to be allocated.
*/
typedef void (*mysql_var_update_func)(MYSQL_THD thd,
struct st_mysql_sys_var *var,
void *var_ptr, void *save);
/* the following declarations are 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_RQCMDARG | 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; type def_val; \
} MYSQL_SYSVAR_NAME(name)
#define DECLARE_MYSQL_SYSVAR_SIMPLE(name, type) struct { \
MYSQL_PLUGIN_VAR_HEADER; \
type *value; type def_val; \
type min_val; type max_val; \
type 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)(MYSQL_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; type min_val; \
type max_val; type 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)
/*
the following declarations are for use by plugin implementors
*/
#define MYSQL_SYSVAR_BOOL(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(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(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(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(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(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(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(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(name, varname, opt, comment, check, update, def, typelib) \
DECLARE_MYSQL_SYSVAR_TYPELIB(name) = { \
PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def, typelib }
#define MYSQL_SYSVAR_SET(name, varname, opt, comment, check, update, def, typelib) \
DECLARE_MYSQL_SYSVAR_TYPELIB(name) = { \
PLUGIN_VAR_SET | ((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. Plugin description structure.
@ -103,8 +366,8 @@ struct st_mysql_plugin
int (*deinit)(void *);/* the function to invoke when plugin is unloaded */ int (*deinit)(void *);/* the function to invoke when plugin is unloaded */
unsigned int version; /* plugin version (for SHOW PLUGINS) */ unsigned int version; /* plugin version (for SHOW PLUGINS) */
struct st_mysql_show_var *status_vars; struct st_mysql_show_var *status_vars;
void * __reserved1; /* placeholder for system variables */ struct st_mysql_sys_var **system_vars;
void * __reserved2; /* placeholder for config options */ void * __reserved1; /* reserved for dependency checking */
}; };
/************************************************************************* /*************************************************************************
@ -328,6 +591,8 @@ struct st_mysql_storage_engine
int interface_version; int interface_version;
}; };
struct handlerton;
/* /*
Here we define only the descriptor structure, that is referred from Here we define only the descriptor structure, that is referred from
st_mysql_plugin. st_mysql_plugin.
@ -348,5 +613,52 @@ struct st_mysql_information_schema
int interface_version; int interface_version;
}; };
/*
st_mysql_value struct for reading values from mysqld.
Used by server variables framework to parse user-provided values.
Will be used for arguments when implementing UDFs.
Note that val_str() returns a string in temporary memory
that will be freed at the end of statement. Copy the string
if you need it to persist.
*/
#define MYSQL_VALUE_TYPE_STRING 0
#define MYSQL_VALUE_TYPE_REAL 1
#define MYSQL_VALUE_TYPE_INT 2
struct st_mysql_value
{
int (*value_type)(struct st_mysql_value *);
const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length);
int (*val_real)(struct st_mysql_value *, double *realbuf);
int (*val_int)(struct st_mysql_value *, long long *intbuf);
};
/*************************************************************************
Miscellaneous functions for plugin implementors
*/
#ifdef __cplusplus
extern "C" {
#endif
int thd_in_lock_tables(const MYSQL_THD thd);
int thd_tablespace_op(const MYSQL_THD thd);
long long thd_test_options(const MYSQL_THD thd, long long test_options);
int thd_sql_command(const MYSQL_THD thd);
const char *thd_proc_info(MYSQL_THD thd, const char *info);
void **thd_ha_data(const MYSQL_THD thd, const struct handlerton *hton);
int thd_tx_isolation(const MYSQL_THD thd);
char *thd_security_context(MYSQL_THD thd, char *buffer, unsigned int length,
unsigned int max_query_len);
#ifdef __cplusplus
};
#endif
#endif #endif

View File

@ -79,6 +79,7 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */
#define EXIT_NO_PTR_TO_VARIABLE 10 #define EXIT_NO_PTR_TO_VARIABLE 10
#define EXIT_CANNOT_CONNECT_TO_SERVICE 11 #define EXIT_CANNOT_CONNECT_TO_SERVICE 11
#define EXIT_OPTION_DISABLED 12 #define EXIT_OPTION_DISABLED 12
#define EXIT_ARGUMENT_INVALID 13
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -26,6 +26,7 @@ typedef struct st_typelib { /* Different types saved here */
unsigned int *type_lengths; unsigned int *type_lengths;
} TYPELIB; } TYPELIB;
extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position);
extern int find_type_or_exit(const char *x, TYPELIB *typelib, extern int find_type_or_exit(const char *x, TYPELIB *typelib,
const char *option); const char *option);
extern int find_type(char *x, const TYPELIB *typelib, unsigned int full_name); extern int find_type(char *x, const TYPELIB *typelib, unsigned int full_name);

View File

@ -587,7 +587,7 @@ sub collect_one_test_case($$$$$$$) {
if ( $tinfo->{'innodb_test'} ) if ( $tinfo->{'innodb_test'} )
{ {
# This is a test that need innodb # This is a test that need innodb
if ( $::mysqld_variables{'innodb'} eq "FALSE" ) if ( $::mysqld_variables{'innodb'} ne "TRUE" )
{ {
# innodb is not supported, skip it # innodb is not supported, skip it
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;

View File

@ -58,7 +58,7 @@ $Devel::Trace::TRACE= 0; # Don't trace boring init stuff
use File::Path; use File::Path;
use File::Basename; use File::Basename;
use File::Copy; use File::Copy;
use File::Temp qw / tempdir /; use File::Temp qw /tempdir/;
use Cwd; use Cwd;
use Getopt::Long; use Getopt::Long;
use Sys::Hostname; use Sys::Hostname;
@ -113,6 +113,7 @@ our $glob_basedir;
our $path_charsetsdir; our $path_charsetsdir;
our $path_client_bindir; our $path_client_bindir;
our $path_share;
our $path_language; our $path_language;
our $path_timefile; our $path_timefile;
our $path_snapshot; our $path_snapshot;
@ -705,6 +706,15 @@ sub command_line_setup () {
"$glob_basedir/client", "$glob_basedir/client",
"$glob_basedir/bin"); "$glob_basedir/bin");
# Look for language files and charsetsdir, use same share
$path_share= mtr_path_exists("$glob_basedir/share/mysql",
"$glob_basedir/sql/share",
"$glob_basedir/share");
$path_language= mtr_path_exists("$path_share/english");
$path_charsetsdir= mtr_path_exists("$path_share/charsets");
if (!$opt_extern) if (!$opt_extern)
{ {
$exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'), $exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
@ -1345,10 +1355,13 @@ sub collect_mysqld_features () {
my $found_variable_list_start= 0; my $found_variable_list_start= 0;
# #
# Execute "mysqld --no-defaults --help --verbose" to get a # Execute "mysqld --help --verbose" to get a list
# list of all features and settings # list of all features and settings
# #
my $list= `$exe_mysqld --no-defaults --verbose --help`; # --no-defaults and --skip-grant-tables are to avoid loading
# system-wide configs and plugins
#
my $list= `$exe_mysqld --no-defaults --language=$path_language --skip-grant-tables --verbose --help`;
foreach my $line (split('\n', $list)) foreach my $line (split('\n', $list))
{ {
@ -1511,14 +1524,6 @@ sub executable_setup () {
} }
} }
# Look for language files and charsetsdir, use same share
my $path_share= mtr_path_exists("$glob_basedir/share/mysql",
"$glob_basedir/sql/share",
"$glob_basedir/share");
$path_language= mtr_path_exists("$path_share/english");
$path_charsetsdir= mtr_path_exists("$path_share/charsets");
# Look for my_print_defaults # Look for my_print_defaults
$exe_my_print_defaults= $exe_my_print_defaults=
mtr_exe_exists(vs_config_dirs('extra', 'my_print_defaults'), mtr_exe_exists(vs_config_dirs('extra', 'my_print_defaults'),
@ -2972,8 +2977,8 @@ sub install_db ($$) {
mtr_add_arg($args, "--bootstrap"); mtr_add_arg($args, "--bootstrap");
mtr_add_arg($args, "--basedir=%s", $path_my_basedir); mtr_add_arg($args, "--basedir=%s", $path_my_basedir);
mtr_add_arg($args, "--datadir=%s", $data_dir); mtr_add_arg($args, "--datadir=%s", $data_dir);
mtr_add_arg($args, "--skip-innodb"); mtr_add_arg($args, "--loose-skip-innodb");
mtr_add_arg($args, "--skip-ndbcluster"); mtr_add_arg($args, "--loose-skip-ndbcluster");
mtr_add_arg($args, "--tmpdir=."); mtr_add_arg($args, "--tmpdir=.");
mtr_add_arg($args, "--core-file"); mtr_add_arg($args, "--core-file");
@ -3114,8 +3119,8 @@ basedir = $path_my_basedir
server_id = $server_id server_id = $server_id
shutdown-delay = 10 shutdown-delay = 10
skip-stack-trace skip-stack-trace
skip-innodb loose-skip-innodb
skip-ndbcluster loose-skip-ndbcluster
EOF EOF
; ;
if ( $mysql_version_id < 50100 ) if ( $mysql_version_id < 50100 )
@ -3791,7 +3796,7 @@ sub mysqld_arguments ($$$$) {
if ( $opt_skip_ndbcluster || if ( $opt_skip_ndbcluster ||
!$cluster->{'pid'}) !$cluster->{'pid'})
{ {
mtr_add_arg($args, "%s--skip-ndbcluster", $prefix); mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
} }
else else
{ {
@ -3865,7 +3870,7 @@ sub mysqld_arguments ($$$$) {
$mysqld->{'cluster'} == -1 || $mysqld->{'cluster'} == -1 ||
!$clusters->[$mysqld->{'cluster'}]->{'pid'} ) !$clusters->[$mysqld->{'cluster'}]->{'pid'} )
{ {
mtr_add_arg($args, "%s--skip-ndbcluster", $prefix); mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
} }
else else
{ {

View File

@ -4,9 +4,11 @@ show variables like 'log_bin%';
Variable_name Value Variable_name Value
log_bin OFF log_bin OFF
log_bin_trust_function_creators ON log_bin_trust_function_creators ON
log_bin_trust_routine_creators ON
flush logs; flush logs;
show variables like 'log_bin%'; show variables like 'log_bin%';
Variable_name Value Variable_name Value
log_bin OFF log_bin OFF
log_bin_trust_function_creators ON log_bin_trust_function_creators ON
log_bin_trust_routine_creators ON
set global expire_logs_days = 0; set global expire_logs_days = 0;

View File

@ -21,8 +21,8 @@ basedir VALUE
server_id VALUE server_id VALUE
shutdown-delay VALUE shutdown-delay VALUE
skip-stack-trace VALUE skip-stack-trace VALUE
skip-innodb VALUE loose-skip-innodb VALUE
skip-ndbcluster VALUE loose-skip-ndbcluster VALUE
log-output VALUE log-output VALUE
SHOW INSTANCE OPTIONS mysqld2; SHOW INSTANCE OPTIONS mysqld2;
option_name value option_name value
@ -40,8 +40,8 @@ basedir VALUE
server_id VALUE server_id VALUE
shutdown-delay VALUE shutdown-delay VALUE
skip-stack-trace VALUE skip-stack-trace VALUE
skip-innodb VALUE loose-skip-innodb VALUE
skip-ndbcluster VALUE loose-skip-ndbcluster VALUE
nonguarded VALUE nonguarded VALUE
log-output VALUE log-output VALUE
START INSTANCE mysqld2; START INSTANCE mysqld2;

View File

@ -169,6 +169,8 @@ lock tables mysql.slow_log READ LOCAL, mysql.general_log READ LOCAL;
unlock tables; unlock tables;
set global general_log='OFF'; set global general_log='OFF';
set global slow_query_log='OFF'; set global slow_query_log='OFF';
set @save_storage_engine= @@session.storage_engine;
set storage_engine= MEMORY;
alter table mysql.slow_log engine=ndb; alter table mysql.slow_log engine=ndb;
ERROR HY000: This storage engine cannot be used for log tables" ERROR HY000: This storage engine cannot be used for log tables"
alter table mysql.slow_log engine=innodb; alter table mysql.slow_log engine=innodb;
@ -177,6 +179,7 @@ alter table mysql.slow_log engine=archive;
ERROR HY000: This storage engine cannot be used for log tables" ERROR HY000: This storage engine cannot be used for log tables"
alter table mysql.slow_log engine=blackhole; alter table mysql.slow_log engine=blackhole;
ERROR HY000: This storage engine cannot be used for log tables" ERROR HY000: This storage engine cannot be used for log tables"
set storage_engine= @save_storage_engine;
drop table mysql.slow_log; drop table mysql.slow_log;
drop table mysql.general_log; drop table mysql.general_log;
drop table mysql.general_log; drop table mysql.general_log;

View File

@ -55,6 +55,7 @@ engine = x
partition by key (a); partition by key (a);
Warnings: Warnings:
Warning 1286 Unknown table engine 'x' Warning 1286 Unknown table engine 'x'
Warning 1266 Using storage engine MyISAM for table 't1'
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (

View File

@ -303,10 +303,9 @@ prepare stmt4 from ' show variables like ''sql_mode'' ';
execute stmt4; execute stmt4;
Variable_name Value Variable_name Value
sql_mode sql_mode
prepare stmt4 from ' show engine bdb logs '; prepare stmt4 from ' show engine myisam logs ';
ERROR 42000: Unknown table engine 'bdb' execute stmt4;
prepare stmt4 from ' show engine foo logs '; Type Name Status
ERROR 42000: Unknown table engine 'foo'
prepare stmt4 from ' show grants for user '; prepare stmt4 from ' show grants for user ';
prepare stmt4 from ' show create table t2 '; prepare stmt4 from ' show create table t2 ';
prepare stmt4 from ' show master status '; prepare stmt4 from ' show master status ';

View File

@ -235,7 +235,7 @@ net_buffer_length 1024
net_read_timeout 300 net_read_timeout 300
net_retry_count 10 net_retry_count 10
net_write_timeout 200 net_write_timeout 200
select * from information_schema.global_variables where variable_name like 'net_%'; select * from information_schema.global_variables where variable_name like 'net_%' order by 1;
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 1024 NET_BUFFER_LENGTH 1024
NET_READ_TIMEOUT 300 NET_READ_TIMEOUT 300
@ -247,7 +247,7 @@ net_buffer_length 2048
net_read_timeout 600 net_read_timeout 600
net_retry_count 10 net_retry_count 10
net_write_timeout 500 net_write_timeout 500
select * from information_schema.session_variables where variable_name like 'net_%'; select * from information_schema.session_variables where variable_name like 'net_%' order by 1;
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 2048 NET_BUFFER_LENGTH 2048
NET_READ_TIMEOUT 600 NET_READ_TIMEOUT 600
@ -260,7 +260,7 @@ net_buffer_length 1024
net_read_timeout 900 net_read_timeout 900
net_retry_count 10 net_retry_count 10
net_write_timeout 1000 net_write_timeout 1000
select * from information_schema.global_variables where variable_name like 'net_%'; select * from information_schema.global_variables where variable_name like 'net_%' order by 1;
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 1024 NET_BUFFER_LENGTH 1024
NET_READ_TIMEOUT 900 NET_READ_TIMEOUT 900
@ -272,7 +272,7 @@ net_buffer_length 7168
net_read_timeout 600 net_read_timeout 600
net_retry_count 10 net_retry_count 10
net_write_timeout 500 net_write_timeout 500
select * from information_schema.session_variables where variable_name like 'net_%'; select * from information_schema.session_variables where variable_name like 'net_%' order by 1;
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
NET_BUFFER_LENGTH 7168 NET_BUFFER_LENGTH 7168
NET_READ_TIMEOUT 600 NET_READ_TIMEOUT 600
@ -313,7 +313,7 @@ query_prealloc_size 8192
range_alloc_block_size 2048 range_alloc_block_size 2048
transaction_alloc_block_size 8192 transaction_alloc_block_size 8192
transaction_prealloc_size 4096 transaction_prealloc_size 4096
select * from information_schema.session_variables where variable_name like '%alloc%'; select * from information_schema.session_variables where variable_name like '%alloc%' order by 1;
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
QUERY_ALLOC_BLOCK_SIZE 8192 QUERY_ALLOC_BLOCK_SIZE 8192
QUERY_PREALLOC_SIZE 8192 QUERY_PREALLOC_SIZE 8192
@ -335,7 +335,7 @@ query_prealloc_size 18432
range_alloc_block_size 16384 range_alloc_block_size 16384
transaction_alloc_block_size 19456 transaction_alloc_block_size 19456
transaction_prealloc_size 20480 transaction_prealloc_size 20480
select * from information_schema.session_variables where variable_name like '%alloc%'; select * from information_schema.session_variables where variable_name like '%alloc%' order by 1;
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
QUERY_ALLOC_BLOCK_SIZE 17408 QUERY_ALLOC_BLOCK_SIZE 17408
QUERY_PREALLOC_SIZE 18432 QUERY_PREALLOC_SIZE 18432
@ -352,7 +352,7 @@ query_prealloc_size 8192
range_alloc_block_size 2048 range_alloc_block_size 2048
transaction_alloc_block_size 8192 transaction_alloc_block_size 8192
transaction_prealloc_size 4096 transaction_prealloc_size 4096
select * from information_schema.session_variables where variable_name like '%alloc%'; select * from information_schema.session_variables where variable_name like '%alloc%' order by 1;
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
QUERY_ALLOC_BLOCK_SIZE 8192 QUERY_ALLOC_BLOCK_SIZE 8192
QUERY_PREALLOC_SIZE 8192 QUERY_PREALLOC_SIZE 8192
@ -911,7 +911,7 @@ ssl_capath #
ssl_cert # ssl_cert #
ssl_cipher # ssl_cipher #
ssl_key # ssl_key #
select * from information_schema.session_variables where variable_name like 'ssl%'; select * from information_schema.session_variables where variable_name like 'ssl%' order by 1;
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
SSL_CA # SSL_CA #
SSL_CAPATH # SSL_CAPATH #

View File

@ -252,6 +252,8 @@ set global general_log='OFF';
set global slow_query_log='OFF'; set global slow_query_log='OFF';
# check that alter table doesn't work for other engines # check that alter table doesn't work for other engines
set @save_storage_engine= @@session.storage_engine;
set storage_engine= MEMORY;
--error ER_UNSUPORTED_LOG_ENGINE --error ER_UNSUPORTED_LOG_ENGINE
alter table mysql.slow_log engine=ndb; alter table mysql.slow_log engine=ndb;
--error ER_UNSUPORTED_LOG_ENGINE --error ER_UNSUPORTED_LOG_ENGINE
@ -260,6 +262,7 @@ alter table mysql.slow_log engine=innodb;
alter table mysql.slow_log engine=archive; alter table mysql.slow_log engine=archive;
--error ER_UNSUPORTED_LOG_ENGINE --error ER_UNSUPORTED_LOG_ENGINE
alter table mysql.slow_log engine=blackhole; alter table mysql.slow_log engine=blackhole;
set storage_engine= @save_storage_engine;
drop table mysql.slow_log; drop table mysql.slow_log;
drop table mysql.general_log; drop table mysql.general_log;

View File

@ -321,10 +321,8 @@ prepare stmt4 from ' show status like ''Threads_running'' ';
execute stmt4; execute stmt4;
prepare stmt4 from ' show variables like ''sql_mode'' '; prepare stmt4 from ' show variables like ''sql_mode'' ';
execute stmt4; execute stmt4;
--error ER_UNKNOWN_STORAGE_ENGINE prepare stmt4 from ' show engine myisam logs ';
prepare stmt4 from ' show engine bdb logs '; execute stmt4;
--error ER_UNKNOWN_STORAGE_ENGINE
prepare stmt4 from ' show engine foo logs ';
prepare stmt4 from ' show grants for user '; prepare stmt4 from ' show grants for user ';
prepare stmt4 from ' show create table t2 '; prepare stmt4 from ' show create table t2 ';
prepare stmt4 from ' show master status '; prepare stmt4 from ' show master status ';

View File

@ -150,14 +150,14 @@ set global net_retry_count=10, session net_retry_count=10;
set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300; set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600; set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600;
show global variables like 'net_%'; show global variables like 'net_%';
select * from information_schema.global_variables where variable_name like 'net_%'; select * from information_schema.global_variables where variable_name like 'net_%' order by 1;
show session variables like 'net_%'; show session variables like 'net_%';
select * from information_schema.session_variables where variable_name like 'net_%'; select * from information_schema.session_variables where variable_name like 'net_%' order by 1;
set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000; set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
show global variables like 'net_%'; show global variables like 'net_%';
select * from information_schema.global_variables where variable_name like 'net_%'; select * from information_schema.global_variables where variable_name like 'net_%' order by 1;
show session variables like 'net_%'; show session variables like 'net_%';
select * from information_schema.session_variables where variable_name like 'net_%'; select * from information_schema.session_variables where variable_name like 'net_%' order by 1;
set net_buffer_length=1; set net_buffer_length=1;
show variables like 'net_buffer_length'; show variables like 'net_buffer_length';
select * from information_schema.session_variables where variable_name like 'net_buffer_length'; select * from information_schema.session_variables where variable_name like 'net_buffer_length';
@ -174,7 +174,7 @@ set @@rand_seed1=10000000,@@rand_seed2=1000000;
select ROUND(RAND(),5); select ROUND(RAND(),5);
show variables like '%alloc%'; show variables like '%alloc%';
select * from information_schema.session_variables where variable_name like '%alloc%'; select * from information_schema.session_variables where variable_name like '%alloc%' order by 1;
set @@range_alloc_block_size=1024*16; set @@range_alloc_block_size=1024*16;
set @@query_alloc_block_size=1024*17+2; set @@query_alloc_block_size=1024*17+2;
set @@query_prealloc_size=1024*18; set @@query_prealloc_size=1024*18;
@ -182,12 +182,12 @@ set @@transaction_alloc_block_size=1024*20-1;
set @@transaction_prealloc_size=1024*21-1; set @@transaction_prealloc_size=1024*21-1;
select @@query_alloc_block_size; select @@query_alloc_block_size;
show variables like '%alloc%'; show variables like '%alloc%';
select * from information_schema.session_variables where variable_name like '%alloc%'; select * from information_schema.session_variables where variable_name like '%alloc%' order by 1;
set @@range_alloc_block_size=default; set @@range_alloc_block_size=default;
set @@query_alloc_block_size=default, @@query_prealloc_size=default; set @@query_alloc_block_size=default, @@query_prealloc_size=default;
set transaction_alloc_block_size=default, @@transaction_prealloc_size=default; set transaction_alloc_block_size=default, @@transaction_prealloc_size=default;
show variables like '%alloc%'; show variables like '%alloc%';
select * from information_schema.session_variables where variable_name like '%alloc%'; select * from information_schema.session_variables where variable_name like '%alloc%' order by 1;
# #
# Bug #10904 Illegal mix of collations between # Bug #10904 Illegal mix of collations between
@ -692,7 +692,7 @@ select @@ssl_ca, @@ssl_capath, @@ssl_cert, @@ssl_cipher, @@ssl_key;
--replace_column 2 # --replace_column 2 #
show variables like 'ssl%'; show variables like 'ssl%';
--replace_column 2 # --replace_column 2 #
select * from information_schema.session_variables where variable_name like 'ssl%'; select * from information_schema.session_variables where variable_name like 'ssl%' order by 1;
# #
# Bug #19616: make log_queries_not_using_indexes available in SHOW VARIABLES # Bug #19616: make log_queries_not_using_indexes available in SHOW VARIABLES

View File

@ -1 +1 @@
--loose-skip-ndb --loose-skip-plugin-ndbcluster

View File

@ -22,9 +22,10 @@
Initiate dynamic array Initiate dynamic array
SYNOPSIS SYNOPSIS
init_dynamic_array() init_dynamic_array2()
array Pointer to an array array Pointer to an array
element_size Size of element element_size Size of element
init_buffer Initial buffer pointer
init_alloc Number of initial elements init_alloc Number of initial elements
alloc_increment Increment for adding new elements alloc_increment Increment for adding new elements
@ -32,14 +33,15 @@
init_dynamic_array() initiates array and allocate space for init_dynamic_array() initiates array and allocate space for
init_alloc eilements. init_alloc eilements.
Array is usable even if space allocation failed. Array is usable even if space allocation failed.
Static buffers must begin immediately after the array structure.
RETURN VALUE RETURN VALUE
TRUE my_malloc_ci() failed TRUE my_malloc_ci() failed
FALSE Ok FALSE Ok
*/ */
my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size, my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
uint init_alloc, void *init_buffer, uint init_alloc,
uint alloc_increment CALLER_INFO_PROTO) uint alloc_increment CALLER_INFO_PROTO)
{ {
DBUG_ENTER("init_dynamic_array"); DBUG_ENTER("init_dynamic_array");
@ -51,11 +53,16 @@ my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
} }
if (!init_alloc) if (!init_alloc)
{
init_alloc=alloc_increment; init_alloc=alloc_increment;
init_buffer= 0;
}
array->elements=0; array->elements=0;
array->max_element=init_alloc; array->max_element=init_alloc;
array->alloc_increment=alloc_increment; array->alloc_increment=alloc_increment;
array->size_of_element=element_size; array->size_of_element=element_size;
if ((array->buffer= init_buffer))
DBUG_RETURN(FALSE);
if (!(array->buffer=(char*) my_malloc_ci(element_size*init_alloc,MYF(MY_WME)))) if (!(array->buffer=(char*) my_malloc_ci(element_size*init_alloc,MYF(MY_WME))))
{ {
array->max_element=0; array->max_element=0;
@ -64,6 +71,14 @@ my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
uint init_alloc,
uint alloc_increment CALLER_INFO_PROTO)
{
/* placeholder to preserve ABI */
return my_init_dynamic_array_ci(array, element_size, init_alloc,
alloc_increment);
}
/* /*
Insert element at the end of array. Allocate memory if needed. Insert element at the end of array. Allocate memory if needed.
@ -117,6 +132,21 @@ byte *alloc_dynamic(DYNAMIC_ARRAY *array)
if (array->elements == array->max_element) if (array->elements == array->max_element)
{ {
char *new_ptr; char *new_ptr;
if (array->buffer == (char *)(array + 1))
{
/*
In this senerio, the buffer is statically preallocated,
so we have to create an all-new malloc since we overflowed
*/
if (!(new_ptr= (char *) my_malloc((array->max_element+
array->alloc_increment) *
array->size_of_element,
MYF(MY_WME))))
return 0;
memcpy(new_ptr, array->buffer,
array->elements * array->size_of_element);
}
else
if (!(new_ptr=(char*) my_realloc(array->buffer,(array->max_element+ if (!(new_ptr=(char*) my_realloc(array->buffer,(array->max_element+
array->alloc_increment)* array->alloc_increment)*
array->size_of_element, array->size_of_element,
@ -176,6 +206,20 @@ my_bool set_dynamic(DYNAMIC_ARRAY *array, gptr element, uint idx)
char *new_ptr; char *new_ptr;
size=(idx+array->alloc_increment)/array->alloc_increment; size=(idx+array->alloc_increment)/array->alloc_increment;
size*= array->alloc_increment; size*= array->alloc_increment;
if (array->buffer == (char *)(array + 1))
{
/*
In this senerio, the buffer is statically preallocated,
so we have to create an all-new malloc since we overflowed
*/
if (!(new_ptr= (char *) my_malloc(size *
array->size_of_element,
MYF(MY_WME))))
return 0;
memcpy(new_ptr, array->buffer,
array->elements * array->size_of_element);
}
else
if (!(new_ptr=(char*) my_realloc(array->buffer,size* if (!(new_ptr=(char*) my_realloc(array->buffer,size*
array->size_of_element, array->size_of_element,
MYF(MY_WME | MY_ALLOW_ZERO_PTR)))) MYF(MY_WME | MY_ALLOW_ZERO_PTR))))
@ -226,6 +270,12 @@ void get_dynamic(DYNAMIC_ARRAY *array, gptr element, uint idx)
void delete_dynamic(DYNAMIC_ARRAY *array) void delete_dynamic(DYNAMIC_ARRAY *array)
{ {
/*
Just mark as empty if we are using a static buffer
*/
if (array->buffer == (char *)(array + 1))
array->elements= 0;
else
if (array->buffer) if (array->buffer)
{ {
my_free(array->buffer,MYF(MY_WME)); my_free(array->buffer,MYF(MY_WME));
@ -265,6 +315,12 @@ void freeze_size(DYNAMIC_ARRAY *array)
{ {
uint elements=max(array->elements,1); uint elements=max(array->elements,1);
/*
Do nothing if we are using a static buffer
*/
if (array->buffer == (char *)(array + 1))
return;
if (array->buffer && array->max_element != elements) if (array->buffer && array->max_element != elements)
{ {
array->buffer=(char*) my_realloc(array->buffer, array->buffer=(char*) my_realloc(array->buffer,

View File

@ -315,6 +315,13 @@ my_bool my_hash_insert(HASH *info,const byte *record)
LINT_INIT(gpos); LINT_INIT(gpos2); LINT_INIT(gpos); LINT_INIT(gpos2);
LINT_INIT(ptr_to_rec); LINT_INIT(ptr_to_rec2); LINT_INIT(ptr_to_rec); LINT_INIT(ptr_to_rec2);
if (HASH_UNIQUE & info->flags)
{
byte *key= (byte*) hash_key(info, record, &idx, 1);
if (hash_search(info, key, idx))
return(TRUE); /* Duplicate entry */
}
flag=0; flag=0;
if (!(empty=(HASH_LINK*) alloc_dynamic(&info->array))) if (!(empty=(HASH_LINK*) alloc_dynamic(&info->array)))
return(TRUE); /* No more memory */ return(TRUE); /* No more memory */
@ -530,6 +537,19 @@ my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length)
uint idx,new_index,new_pos_index,blength,records,empty; uint idx,new_index,new_pos_index,blength,records,empty;
HASH_LINK org_link,*data,*previous,*pos; HASH_LINK org_link,*data,*previous,*pos;
DBUG_ENTER("hash_update"); DBUG_ENTER("hash_update");
if (HASH_UNIQUE & hash->flags)
{
HASH_SEARCH_STATE state;
byte *found, *new_key= hash_key(hash, record, &idx, 1);
if ((found= hash_first(hash, new_key, idx, &state)))
do
{
if (found != record)
DBUG_RETURN(1); /* Duplicate entry */
}
while ((found= hash_next(hash, new_key, idx, &state)));
}
data=dynamic_element(&hash->array,0,HASH_LINK*); data=dynamic_element(&hash->array,0,HASH_LINK*);
blength=hash->blength; records=hash->records; blength=hash->blength; records=hash->records;

View File

@ -58,6 +58,13 @@ char *disabled_my_option= (char*) "0";
my_bool my_getopt_print_errors= 1; my_bool my_getopt_print_errors= 1;
/*
This is a flag that can be set in client programs. 1 means that
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, static void default_reporter(enum loglevel level,
const char *format, ...) const char *format, ...)
{ {
@ -90,26 +97,30 @@ void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint,
getopt_get_addr= func_addr; getopt_get_addr= func_addr;
} }
int handle_options(int *argc, char ***argv, int handle_options(int *argc, char ***argv,
const struct my_option *longopts, const struct my_option *longopts,
my_get_one_option get_one_option) my_get_one_option get_one_option)
{ {
uint opt_found, argvpos= 0, length, i; uint opt_found, argvpos= 0, length;
my_bool end_of_options= 0, must_be_var, set_maximum_value, my_bool end_of_options= 0, must_be_var, set_maximum_value,
option_is_loose; option_is_loose;
char **pos, **pos_end, *optend, *prev_found, char **pos, **pos_end, *optend, *prev_found,
*opt_str, key_name[FN_REFLEN]; *opt_str, key_name[FN_REFLEN];
const struct my_option *optp; const struct my_option *optp;
gptr *value; gptr *value;
int error; int error, i;
LINT_INIT(opt_found); LINT_INIT(opt_found);
/* handle_options() assumes arg0 (program name) always exists */
DBUG_ASSERT(argc && *argc >= 1);
DBUG_ASSERT(argv && *argv);
(*argc)--; /* Skip the program name */ (*argc)--; /* Skip the program name */
(*argv)++; /* --- || ---- */ (*argv)++; /* --- || ---- */
init_variables(longopts); init_variables(longopts);
for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++) for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++)
{ {
char **first= pos;
char *cur_arg= *pos; char *cur_arg= *pos;
if (cur_arg[0] == '-' && cur_arg[1] && !end_of_options) /* must be opt */ if (cur_arg[0] == '-' && cur_arg[1] && !end_of_options) /* must be opt */
{ {
@ -216,12 +227,11 @@ int handle_options(int *argc, char ***argv,
/* /*
We were called with a special prefix, we can reuse opt_found We were called with a special prefix, we can reuse opt_found
*/ */
opt_str+= (special_opt_prefix_lengths[i] + 1); opt_str+= special_opt_prefix_lengths[i] + 1;
length-= special_opt_prefix_lengths[i] + 1;
if (i == OPT_LOOSE) if (i == OPT_LOOSE)
option_is_loose= 1; option_is_loose= 1;
if ((opt_found= findopt(opt_str, length - if ((opt_found= findopt(opt_str, length, &optp, &prev_found)))
(special_opt_prefix_lengths[i] + 1),
&optp, &prev_found)))
{ {
if (opt_found > 1) if (opt_found > 1)
{ {
@ -245,7 +255,7 @@ int handle_options(int *argc, char ***argv,
break; break;
case OPT_ENABLE: case OPT_ENABLE:
optend= (optend && *optend == '0' && !(*(optend + 1))) ? optend= (optend && *optend == '0' && !(*(optend + 1))) ?
disabled_my_option : (char*) "1"; disabled_my_option : (char*) "1";
break; break;
case OPT_MAXIMUM: case OPT_MAXIMUM:
set_maximum_value= 1; set_maximum_value= 1;
@ -254,11 +264,25 @@ int handle_options(int *argc, char ***argv,
} }
break; /* break from the inner loop, main loop continues */ break; /* break from the inner loop, main loop continues */
} }
i= -1; /* restart the loop */
} }
} }
} }
if (!opt_found) if (!opt_found)
{ {
if (my_getopt_skip_unknown)
{
/*
preserve all the components of this unknown option, this may
occurr when the user provides options like: "-O foo" or
"--set-variable foo" (note that theres a space in there)
Generally, these kind of options are to be avoided
*/
do {
(*argv)[argvpos++]= *first++;
} while (first <= pos);
continue;
}
if (must_be_var) if (must_be_var)
{ {
if (my_getopt_print_errors) if (my_getopt_print_errors)
@ -596,6 +620,15 @@ static int setval(const struct my_option *opts, gptr *value, char *argument,
if (!(*((char**) result_pos)= my_strdup(argument, MYF(MY_WME)))) if (!(*((char**) result_pos)= my_strdup(argument, MYF(MY_WME))))
return EXIT_OUT_OF_MEMORY; return EXIT_OUT_OF_MEMORY;
break; break;
case GET_ENUM:
if (((*(int*)result_pos)= find_type(argument, opts->typelib, 2) - 1) < 0)
return EXIT_ARGUMENT_INVALID;
break;
case GET_SET:
*((ulonglong*)result_pos)= find_typeset(argument, opts->typelib, &err);
if (err)
return EXIT_ARGUMENT_INVALID;
break;
default: /* dummy default to avoid compiler warnings */ default: /* dummy default to avoid compiler warnings */
break; break;
} }
@ -780,6 +813,7 @@ ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp)
static void init_one_value(const struct my_option *option, gptr *variable, static void init_one_value(const struct my_option *option, gptr *variable,
longlong value) longlong value)
{ {
DBUG_ENTER("init_one_value");
switch ((option->var_type & GET_TYPE_MASK)) { switch ((option->var_type & GET_TYPE_MASK)) {
case GET_BOOL: case GET_BOOL:
*((my_bool*) variable)= (my_bool) value; *((my_bool*) variable)= (my_bool) value;
@ -788,6 +822,7 @@ static void init_one_value(const struct my_option *option, gptr *variable,
*((int*) variable)= (int) value; *((int*) variable)= (int) value;
break; break;
case GET_UINT: case GET_UINT:
case GET_ENUM:
*((uint*) variable)= (uint) value; *((uint*) variable)= (uint) value;
break; break;
case GET_LONG: case GET_LONG:
@ -800,11 +835,32 @@ static void init_one_value(const struct my_option *option, gptr *variable,
*((longlong*) variable)= (longlong) value; *((longlong*) variable)= (longlong) value;
break; break;
case GET_ULL: case GET_ULL:
case GET_SET:
*((ulonglong*) variable)= (ulonglong) value; *((ulonglong*) variable)= (ulonglong) value;
break; break;
case GET_STR:
/*
Do not clear variable value if it has no default value.
The default value may already be set.
*/
if ((char*) value)
*((char**) variable)= (char*) value;
break;
case GET_STR_ALLOC:
/*
Do not clear variable value if it has no default value.
The default value may already be set.
*/
if ((char*) value)
{
my_free((*(char**) variable), MYF(MY_ALLOW_ZERO_PTR));
*((char**) variable)= my_strdup((char*) value, MYF(MY_WME));
}
break;
default: /* dummy default to avoid compiler warnings */ default: /* dummy default to avoid compiler warnings */
break; break;
} }
DBUG_VOID_RETURN;
} }
@ -823,9 +879,11 @@ static void init_one_value(const struct my_option *option, gptr *variable,
static void init_variables(const struct my_option *options) static void init_variables(const struct my_option *options)
{ {
DBUG_ENTER("init_variables");
for (; options->name; options++) for (; options->name; options++)
{ {
gptr *variable; gptr *variable;
DBUG_PRINT("options", ("name: '%s'", options->name));
/* /*
We must set u_max_value first as for some variables We must set u_max_value first as for some variables
options->u_max_value == options->value and in this case we want to options->u_max_value == options->value and in this case we want to
@ -839,6 +897,7 @@ static void init_variables(const struct my_option *options)
(variable= (*getopt_get_addr)("", 0, options))) (variable= (*getopt_get_addr)("", 0, options)))
init_one_value(options, variable, options->def_value); init_one_value(options, variable, options->def_value);
} }
DBUG_VOID_RETURN;
} }
@ -928,7 +987,8 @@ void my_print_help(const struct my_option *options)
void my_print_variables(const struct my_option *options) void my_print_variables(const struct my_option *options)
{ {
uint name_space= 34, length; uint name_space= 34, length, nr;
ulonglong bit, llvalue;
char buff[255]; char buff[255];
const struct my_option *optp; const struct my_option *optp;
@ -946,6 +1006,21 @@ void my_print_variables(const struct my_option *options)
for (; length < name_space; length++) for (; length < name_space; length++)
putchar(' '); putchar(' ');
switch ((optp->var_type & GET_TYPE_MASK)) { switch ((optp->var_type & GET_TYPE_MASK)) {
case GET_SET:
if (!(llvalue= *(ulonglong*) value))
printf("%s\n", "(No default value)");
else
for (nr= 0, bit= 1; llvalue && nr < optp->typelib->count; nr++, bit<<=1)
{
if (!(bit & llvalue))
continue;
llvalue&= ~bit;
printf( llvalue ? "%s," : "%s\n", get_type(optp->typelib, nr));
}
break;
case GET_ENUM:
printf("%s\n", get_type(optp->typelib, *(uint*) value));
break;
case GET_STR: case GET_STR:
case GET_STR_ALLOC: /* fall through */ case GET_STR_ALLOC: /* fall through */
printf("%s\n", *((char**) value) ? *((char**) value) : printf("%s\n", *((char**) value) ? *((char**) value) :

View File

@ -20,6 +20,8 @@
#include <m_ctype.h> #include <m_ctype.h>
static const char field_separator=',';
int find_type_or_exit(const char *x, TYPELIB *typelib, const char *option) int find_type_or_exit(const char *x, TYPELIB *typelib, const char *option)
{ {
int res; int res;
@ -53,6 +55,7 @@ int find_type_or_exit(const char *x, TYPELIB *typelib, const char *option)
If & 1 accept only whole names If & 1 accept only whole names
If & 2 don't expand if half field If & 2 don't expand if half field
If & 4 allow #number# as type If & 4 allow #number# as type
If & 8 use ',' as string terminator
NOTES NOTES
If part, uniq field is found and full_name == 0 then x is expanded If part, uniq field is found and full_name == 0 then x is expanded
@ -82,16 +85,18 @@ int find_type(char *x, const TYPELIB *typelib, uint full_name)
for (pos=0 ; (j=typelib->type_names[pos]) ; pos++) for (pos=0 ; (j=typelib->type_names[pos]) ; pos++)
{ {
for (i=x ; for (i=x ;
*i && my_toupper(&my_charset_latin1,*i) == *i && (!(full_name & 8) || *i != field_separator) &&
my_toupper(&my_charset_latin1,*i) ==
my_toupper(&my_charset_latin1,*j) ; i++, j++) ; my_toupper(&my_charset_latin1,*j) ; i++, j++) ;
if (! *j) if (! *j)
{ {
while (*i == ' ') while (*i == ' ')
i++; /* skip_end_space */ i++; /* skip_end_space */
if (! *i) if (! *i || ((full_name & 8) && *i == field_separator))
DBUG_RETURN(pos+1); DBUG_RETURN(pos+1);
} }
if (! *i && (!*j || !(full_name & 1))) if ((!*i && (!(full_name & 8) || *i != field_separator)) &&
(!*j || !(full_name & 1)))
{ {
find++; find++;
findpos=pos; findpos=pos;
@ -142,6 +147,50 @@ const char *get_type(TYPELIB *typelib, uint nr)
} }
/*
Create an integer value to represent the supplied comma-seperated
string where each string in the TYPELIB denotes a bit position.
SYNOPSIS
find_typeset()
x string to decompose
lib TYPELIB (struct of pointer to values + count)
err index (not char position) of string element which was not
found or 0 if there was no error
RETURN
a integer representation of the supplied string
*/
my_ulonglong find_typeset(my_string x, TYPELIB *lib, int *err)
{
my_ulonglong result;
int find;
my_string i;
DBUG_ENTER("find_set");
DBUG_PRINT("enter",("x: '%s' lib: 0x%lx", x, (long) lib));
if (!lib->count)
{
DBUG_PRINT("exit",("no count"));
DBUG_RETURN(0);
}
result= 0;
*err= 0;
while (*x)
{
(*err)++;
i= x;
while (*x && *x != field_separator) x++;
if ((find= find_type(i, lib, 2 | 8) - 1) < 0)
DBUG_RETURN(0);
result|= (ULL(1) << find);
}
*err= 0;
DBUG_RETURN(result);
} /* find_set */
/* /*
Create a copy of a specified TYPELIB structure. Create a copy of a specified TYPELIB structure.

View File

@ -215,6 +215,41 @@ static struct st_mysql_show_var simple_status[]=
{0,0,0} {0,0,0}
}; };
/*
Plugin system variables.
*/
static long sysvar_one_value;
static char *sysvar_two_value;
static MYSQL_SYSVAR_LONG(simple_sysvar_one, sysvar_one_value,
PLUGIN_VAR_RQCMDARG,
"Simple fulltext parser example system variable number one. Give a number.",
NULL, NULL, 77L, 7L, 777L, 0);
static MYSQL_SYSVAR_STR(simple_sysvar_two, sysvar_two_value,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC,
"Simple fulltext parser example system variable number two. Give a string.",
NULL, NULL, "simple sysvar two default");
static MYSQL_THDVAR_LONG(simple_thdvar_one,
PLUGIN_VAR_RQCMDARG,
"Simple fulltext parser example thread variable number one. Give a number.",
NULL, NULL, 88L, 8L, 888L, 0);
static MYSQL_THDVAR_STR(simple_thdvar_two,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC,
"Simple fulltext parser example thread variable number two. Give a string.",
NULL, NULL, "simple thdvar two default");
static struct st_mysql_sys_var* simple_system_variables[]= {
MYSQL_SYSVAR(simple_sysvar_one),
MYSQL_SYSVAR(simple_sysvar_two),
MYSQL_SYSVAR(simple_thdvar_one),
MYSQL_SYSVAR(simple_thdvar_two),
NULL
};
/* /*
Plugin library descriptor Plugin library descriptor
*/ */
@ -231,8 +266,8 @@ mysql_declare_plugin(ftexample)
simple_parser_plugin_deinit,/* deinit function (when unloaded) */ simple_parser_plugin_deinit,/* deinit function (when unloaded) */
0x0001, /* version */ 0x0001, /* version */
simple_status, /* status variables */ simple_status, /* status variables */
NULL, /* system variables */ simple_system_variables, /* system variables */
NULL /* config options */ NULL
} }
mysql_declare_plugin_end; mysql_declare_plugin_end;

View File

@ -70,11 +70,11 @@ event_queue_element_compare_q(void *vptr, byte* a, byte *b)
*/ */
Event_queue::Event_queue() Event_queue::Event_queue()
:mutex_last_unlocked_at_line(0), mutex_last_locked_at_line(0), :mutex_last_locked_at_line(0), mutex_last_unlocked_at_line(0),
mutex_last_attempted_lock_at_line(0), mutex_last_attempted_lock_at_line(0),
mutex_queue_data_locked(FALSE), mutex_queue_data_locked(FALSE),
mutex_queue_data_attempting_lock(FALSE), next_activation_at(0),
next_activation_at(0) mutex_queue_data_attempting_lock(FALSE)
{ {
mutex_last_unlocked_in_func= mutex_last_locked_in_func= mutex_last_unlocked_in_func= mutex_last_locked_in_func=
mutex_last_attempted_lock_in_func= ""; mutex_last_attempted_lock_in_func= "";

View File

@ -2642,7 +2642,7 @@ int ha_ndbcluster::write_row(byte *record)
DBUG_RETURN(peek_res); 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) if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time(); table->timestamp_field->set_time();
@ -2871,7 +2871,7 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
DBUG_RETURN(peek_res); 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) if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
{ {
table->timestamp_field->set_time(); table->timestamp_field->set_time();
@ -3051,7 +3051,7 @@ int ha_ndbcluster::delete_row(const byte *record)
DBUG_ENTER("delete_row"); DBUG_ENTER("delete_row");
m_write_op= TRUE; m_write_op= TRUE;
statistic_increment(thd->status_var.ha_delete_count,&LOCK_status); ha_statistic_increment(&SSV::ha_delete_count);
m_rows_changed++; m_rows_changed++;
if (m_use_partition_function && if (m_use_partition_function &&
@ -3445,8 +3445,7 @@ int ha_ndbcluster::index_read(byte *buf,
int ha_ndbcluster::index_next(byte *buf) int ha_ndbcluster::index_next(byte *buf)
{ {
DBUG_ENTER("ha_ndbcluster::index_next"); DBUG_ENTER("ha_ndbcluster::index_next");
statistic_increment(current_thd->status_var.ha_read_next_count, ha_statistic_increment(&SSV::ha_read_next_count);
&LOCK_status);
DBUG_RETURN(next_result(buf)); DBUG_RETURN(next_result(buf));
} }
@ -3454,8 +3453,7 @@ int ha_ndbcluster::index_next(byte *buf)
int ha_ndbcluster::index_prev(byte *buf) int ha_ndbcluster::index_prev(byte *buf)
{ {
DBUG_ENTER("ha_ndbcluster::index_prev"); DBUG_ENTER("ha_ndbcluster::index_prev");
statistic_increment(current_thd->status_var.ha_read_prev_count, ha_statistic_increment(&SSV::ha_read_prev_count);
&LOCK_status);
DBUG_RETURN(next_result(buf)); DBUG_RETURN(next_result(buf));
} }
@ -3463,8 +3461,7 @@ int ha_ndbcluster::index_prev(byte *buf)
int ha_ndbcluster::index_first(byte *buf) int ha_ndbcluster::index_first(byte *buf)
{ {
DBUG_ENTER("ha_ndbcluster::index_first"); DBUG_ENTER("ha_ndbcluster::index_first");
statistic_increment(current_thd->status_var.ha_read_first_count, ha_statistic_increment(&SSV::ha_read_first_count);
&LOCK_status);
// Start the ordered index scan and fetch the first row // Start the ordered index scan and fetch the first row
// Only HA_READ_ORDER indexes get called by index_first // Only HA_READ_ORDER indexes get called by index_first
@ -3475,7 +3472,7 @@ int ha_ndbcluster::index_first(byte *buf)
int ha_ndbcluster::index_last(byte *buf) int ha_ndbcluster::index_last(byte *buf)
{ {
DBUG_ENTER("ha_ndbcluster::index_last"); 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)); DBUG_RETURN(ordered_index_scan(0, 0, TRUE, TRUE, buf, NULL));
} }
@ -3661,8 +3658,7 @@ int ha_ndbcluster::rnd_end()
int ha_ndbcluster::rnd_next(byte *buf) int ha_ndbcluster::rnd_next(byte *buf)
{ {
DBUG_ENTER("rnd_next"); DBUG_ENTER("rnd_next");
statistic_increment(current_thd->status_var.ha_read_rnd_next_count, ha_statistic_increment(&SSV::ha_read_rnd_next_count);
&LOCK_status);
if (!m_active_cursor) if (!m_active_cursor)
DBUG_RETURN(full_table_scan(buf)); DBUG_RETURN(full_table_scan(buf));
@ -3680,8 +3676,7 @@ int ha_ndbcluster::rnd_next(byte *buf)
int ha_ndbcluster::rnd_pos(byte *buf, byte *pos) int ha_ndbcluster::rnd_pos(byte *buf, byte *pos)
{ {
DBUG_ENTER("rnd_pos"); DBUG_ENTER("rnd_pos");
statistic_increment(current_thd->status_var.ha_read_rnd_count, ha_statistic_increment(&SSV::ha_read_rnd_count);
&LOCK_status);
// The primary key for the record is stored in pos // The primary key for the record is stored in pos
// Perform a pk_read using primary key "index" // Perform a pk_read using primary key "index"
{ {
@ -6946,6 +6941,7 @@ static int connect_callback()
} }
extern int ndb_dictionary_is_mysqld; extern int ndb_dictionary_is_mysqld;
extern pthread_mutex_t LOCK_plugin;
static int ndbcluster_init(void *p) static int ndbcluster_init(void *p)
{ {
@ -6955,6 +6951,13 @@ static int ndbcluster_init(void *p)
if (ndbcluster_inited) if (ndbcluster_inited)
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
/*
Below we create new THD's. They'll need LOCK_plugin, but it's taken now by
plugin initialization code. Release it to avoid deadlocks. It's safe, as
there're no threads that may concurrently access plugin control structures.
*/
pthread_mutex_unlock(&LOCK_plugin);
pthread_mutex_init(&ndbcluster_mutex,MY_MUTEX_INIT_FAST); pthread_mutex_init(&ndbcluster_mutex,MY_MUTEX_INIT_FAST);
pthread_mutex_init(&LOCK_ndb_util_thread, MY_MUTEX_INIT_FAST); pthread_mutex_init(&LOCK_ndb_util_thread, MY_MUTEX_INIT_FAST);
pthread_cond_init(&COND_ndb_util_thread, NULL); pthread_cond_init(&COND_ndb_util_thread, NULL);
@ -6966,7 +6969,7 @@ static int ndbcluster_init(void *p)
{ {
handlerton *h= ndbcluster_hton; handlerton *h= ndbcluster_hton;
h->state= have_ndbcluster; h->state= SHOW_OPTION_YES;
h->db_type= DB_TYPE_NDBCLUSTER; h->db_type= DB_TYPE_NDBCLUSTER;
h->close_connection= ndbcluster_close_connection; h->close_connection= ndbcluster_close_connection;
h->commit= ndbcluster_commit; h->commit= ndbcluster_commit;
@ -6988,9 +6991,6 @@ static int ndbcluster_init(void *p)
h->table_exists_in_engine= ndbcluster_table_exists_in_engine; 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 // Initialize ndb interface
ndb_init_internal(); ndb_init_internal();
@ -7098,6 +7098,8 @@ static int ndbcluster_init(void *p)
goto ndbcluster_init_error; goto ndbcluster_init_error;
} }
pthread_mutex_lock(&LOCK_plugin);
ndbcluster_inited= 1; ndbcluster_inited= 1;
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
@ -7108,9 +7110,10 @@ ndbcluster_init_error:
if (g_ndb_cluster_connection) if (g_ndb_cluster_connection)
delete g_ndb_cluster_connection; delete g_ndb_cluster_connection;
g_ndb_cluster_connection= NULL; 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 ndbcluster_hton->state= SHOW_OPTION_DISABLED; // If we couldn't use handler
pthread_mutex_lock(&LOCK_plugin);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -10491,10 +10494,6 @@ ndbcluster_show_status(handlerton *hton, THD* thd, stat_print_fn *stat_print,
uint buflen; uint buflen;
DBUG_ENTER("ndbcluster_show_status"); DBUG_ENTER("ndbcluster_show_status");
if (have_ndbcluster != SHOW_OPTION_YES)
{
DBUG_RETURN(FALSE);
}
if (stat_type != HA_ENGINE_STATUS) if (stat_type != HA_ENGINE_STATUS)
{ {
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);

View File

@ -1986,6 +1986,8 @@ bool ha_partition::create_handler_file(const char *name)
void ha_partition::clear_handler_file() void ha_partition::clear_handler_file()
{ {
if (m_engine_array)
plugin_unlock_list(NULL, m_engine_array, m_tot_parts);
my_free((char*) m_file_buffer, MYF(MY_ALLOW_ZERO_PTR)); my_free((char*) m_file_buffer, MYF(MY_ALLOW_ZERO_PTR));
my_free((char*) m_engine_array, MYF(MY_ALLOW_ZERO_PTR)); my_free((char*) m_engine_array, MYF(MY_ALLOW_ZERO_PTR));
m_file_buffer= NULL; m_file_buffer= NULL;
@ -2008,6 +2010,7 @@ bool ha_partition::create_handlers(MEM_ROOT *mem_root)
{ {
uint i; uint i;
uint alloc_len= (m_tot_parts + 1) * sizeof(handler*); uint alloc_len= (m_tot_parts + 1) * sizeof(handler*);
handlerton *hton0;
DBUG_ENTER("create_handlers"); DBUG_ENTER("create_handlers");
if (!(m_file= (handler **) alloc_root(mem_root, alloc_len))) if (!(m_file= (handler **) alloc_root(mem_root, alloc_len)))
@ -2016,19 +2019,21 @@ bool ha_partition::create_handlers(MEM_ROOT *mem_root)
bzero((char*) m_file, alloc_len); bzero((char*) m_file, alloc_len);
for (i= 0; i < m_tot_parts; i++) for (i= 0; i < m_tot_parts; i++)
{ {
handlerton *hton= plugin_data(m_engine_array[i], handlerton*);
if (!(m_file[i]= get_new_handler(table_share, mem_root, if (!(m_file[i]= get_new_handler(table_share, mem_root,
m_engine_array[i]))) hton)))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
DBUG_PRINT("info", ("engine_type: %u", m_engine_array[i]->db_type)); DBUG_PRINT("info", ("engine_type: %u", hton->db_type));
} }
/* For the moment we only support partition over the same table engine */ /* For the moment we only support partition over the same table engine */
if (m_engine_array[0] == myisam_hton) hton0= plugin_data(m_engine_array[0], handlerton*);
if (hton0 == myisam_hton)
{ {
DBUG_PRINT("info", ("MyISAM")); DBUG_PRINT("info", ("MyISAM"));
m_myisam= TRUE; m_myisam= TRUE;
} }
/* INNODB may not be compiled in... */ /* INNODB may not be compiled in... */
else if (ha_legacy_type(m_engine_array[0]) == DB_TYPE_INNODB) else if (ha_legacy_type(hton0) == DB_TYPE_INNODB)
{ {
DBUG_PRINT("info", ("InnoDB")); DBUG_PRINT("info", ("InnoDB"));
m_innodb= TRUE; m_innodb= TRUE;
@ -2159,8 +2164,7 @@ bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root)
m_tot_parts= uint4korr((file_buffer) + 8); m_tot_parts= uint4korr((file_buffer) + 8);
DBUG_PRINT("info", ("No of parts = %u", m_tot_parts)); DBUG_PRINT("info", ("No of parts = %u", m_tot_parts));
tot_partition_words= (m_tot_parts + 3) / 4; tot_partition_words= (m_tot_parts + 3) / 4;
if (!(engine_array= (handlerton **) my_malloc(m_tot_parts * sizeof(handlerton*),MYF(0)))) engine_array= (handlerton **) my_alloca(m_tot_parts * sizeof(handlerton*));
goto err2;
for (i= 0; i < m_tot_parts; i++) for (i= 0; i < m_tot_parts; i++)
engine_array[i]= ha_resolve_by_legacy_type(current_thd, engine_array[i]= ha_resolve_by_legacy_type(current_thd,
(enum legacy_db_type) (enum legacy_db_type)
@ -2168,12 +2172,21 @@ bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root)
address_tot_name_len= file_buffer + 12 + 4 * tot_partition_words; address_tot_name_len= file_buffer + 12 + 4 * tot_partition_words;
tot_name_words= (uint4korr(address_tot_name_len) + 3) / 4; tot_name_words= (uint4korr(address_tot_name_len) + 3) / 4;
if (len_words != (tot_partition_words + tot_name_words + 4)) if (len_words != (tot_partition_words + tot_name_words + 4))
goto err2; goto err3;
name_buffer_ptr= file_buffer + 16 + 4 * tot_partition_words; name_buffer_ptr= file_buffer + 16 + 4 * tot_partition_words;
VOID(my_close(file, MYF(0))); VOID(my_close(file, MYF(0)));
m_file_buffer= file_buffer; // Will be freed in clear_handler_file() m_file_buffer= file_buffer; // Will be freed in clear_handler_file()
m_name_buffer_ptr= name_buffer_ptr; m_name_buffer_ptr= name_buffer_ptr;
m_engine_array= engine_array;
if (!(m_engine_array= (plugin_ref*)
my_malloc(m_tot_parts * sizeof(plugin_ref), MYF(MY_WME))))
goto err3;
for (i= 0; i < m_tot_parts; i++)
m_engine_array[i]= ha_lock_engine(NULL, engine_array[i]);
my_afree((gptr) engine_array);
if (!m_file && create_handlers(mem_root)) if (!m_file && create_handlers(mem_root))
{ {
clear_handler_file(); clear_handler_file();
@ -2181,6 +2194,8 @@ bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root)
} }
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
err3:
my_afree((gptr) engine_array);
err2: err2:
my_free(file_buffer, MYF(0)); my_free(file_buffer, MYF(0));
err1: err1:
@ -2324,7 +2339,8 @@ err_handler:
handler *ha_partition::clone(MEM_ROOT *mem_root) handler *ha_partition::clone(MEM_ROOT *mem_root)
{ {
handler *new_handler= get_new_handler(table->s, mem_root, table->s->db_type); handler *new_handler= get_new_handler(table->s, mem_root,
table->s->db_type());
((ha_partition*)new_handler)->m_part_info= m_part_info; ((ha_partition*)new_handler)->m_part_info= m_part_info;
((ha_partition*)new_handler)->is_clone= TRUE; ((ha_partition*)new_handler)->is_clone= TRUE;
if (new_handler && !new_handler->ha_open(table, if (new_handler && !new_handler->ha_open(table,

View File

@ -27,6 +27,7 @@ enum partition_keywords
The partition implements the minimum of what you will probably need. The partition implements the minimum of what you will probably need.
*/ */
#ifdef NOT_USED
typedef struct st_partition_share typedef struct st_partition_share
{ {
char *table_name; char *table_name;
@ -34,6 +35,7 @@ typedef struct st_partition_share
pthread_mutex_t mutex; pthread_mutex_t mutex;
THR_LOCK lock; THR_LOCK lock;
} PARTITION_SHARE; } PARTITION_SHARE;
#endif
#define PARTITION_BYTES_IN_POS 2 #define PARTITION_BYTES_IN_POS 2
@ -54,7 +56,7 @@ private:
uint m_open_test_lock; // Open test_if_locked uint m_open_test_lock; // Open test_if_locked
char *m_file_buffer; // Buffer with names char *m_file_buffer; // Buffer with names
char *m_name_buffer_ptr; // Pointer to first partition name char *m_name_buffer_ptr; // Pointer to first partition name
handlerton **m_engine_array; // Array of types of the handlers plugin_ref *m_engine_array; // Array of types of the handlers
handler **m_file; // Array of references to handler inst. handler **m_file; // Array of references to handler inst.
uint m_file_tot_parts; // Debug uint m_file_tot_parts; // Debug
handler **m_new_file; // Array of references to new handlers handler **m_new_file; // Array of references to new handlers
@ -130,7 +132,9 @@ private:
Variables for lock structures. Variables for lock structures.
*/ */
THR_LOCK_DATA lock; /* MySQL lock */ THR_LOCK_DATA lock; /* MySQL lock */
#ifdef NOT_USED
PARTITION_SHARE *share; /* Shared lock info */ PARTITION_SHARE *share; /* Shared lock info */
#endif
/* /*
TRUE <=> this object was created with ha_partition::clone and doesn't TRUE <=> this object was created with ha_partition::clone and doesn't

View File

@ -77,6 +77,15 @@ static TYPELIB known_extensions= {0,"known_exts", NULL, NULL};
uint known_extensions_id= 0; uint known_extensions_id= 0;
static plugin_ref ha_default_plugin(THD *thd)
{
if (thd->variables.table_plugin)
return thd->variables.table_plugin;
return my_plugin_lock(thd, &global_system_variables.table_plugin);
}
/** @brief /** @brief
Return the default storage engine handlerton for thread Return the default storage engine handlerton for thread
@ -89,10 +98,11 @@ uint known_extensions_id= 0;
*/ */
handlerton *ha_default_handlerton(THD *thd) handlerton *ha_default_handlerton(THD *thd)
{ {
return (thd->variables.table_type != NULL) ? plugin_ref plugin= ha_default_plugin(thd);
thd->variables.table_type : DBUG_ASSERT(plugin);
(global_system_variables.table_type != NULL ? handlerton *hton= plugin_data(plugin, handlerton*);
global_system_variables.table_type : myisam_hton); DBUG_ASSERT(hton);
return hton;
} }
@ -105,26 +115,30 @@ handlerton *ha_default_handlerton(THD *thd)
name name of storage engine name name of storage engine
RETURN RETURN
pointer to handlerton pointer to storage engine plugin handle
*/ */
handlerton *ha_resolve_by_name(THD *thd, const LEX_STRING *name) plugin_ref ha_resolve_by_name(THD *thd, const LEX_STRING *name)
{ {
const LEX_STRING *table_alias; const LEX_STRING *table_alias;
st_plugin_int *plugin; plugin_ref plugin;
redo: redo:
/* my_strnncoll is a macro and gcc doesn't do early expansion of macro */ /* my_strnncoll is a macro and gcc doesn't do early expansion of macro */
if (thd && !my_charset_latin1.coll->strnncoll(&my_charset_latin1, if (thd && !my_charset_latin1.coll->strnncoll(&my_charset_latin1,
(const uchar *)name->str, name->length, (const uchar *)name->str, name->length,
(const uchar *)STRING_WITH_LEN("DEFAULT"), 0)) (const uchar *)STRING_WITH_LEN("DEFAULT"), 0))
return ha_default_handlerton(thd); return ha_default_plugin(thd);
if ((plugin= plugin_lock(name, MYSQL_STORAGE_ENGINE_PLUGIN))) if ((plugin= my_plugin_lock_by_name(thd, name, MYSQL_STORAGE_ENGINE_PLUGIN)))
{ {
handlerton *hton= (handlerton *)plugin->data; handlerton *hton= plugin_data(plugin, handlerton *);
if (!(hton->flags & HTON_NOT_USER_SELECTABLE)) if (!(hton->flags & HTON_NOT_USER_SELECTABLE))
return hton; return plugin;
plugin_unlock(plugin);
/*
unlocking plugin immediately after locking is relatively low cost.
*/
plugin_unlock(thd, plugin);
} }
/* /*
@ -145,19 +159,19 @@ redo:
} }
const char *ha_get_storage_engine(enum legacy_db_type db_type) plugin_ref ha_lock_engine(THD *thd, handlerton *hton)
{ {
switch (db_type) { if (hton)
case DB_TYPE_DEFAULT: {
return "DEFAULT"; st_plugin_int **plugin= hton2plugin + hton->slot;
default:
if (db_type > DB_TYPE_UNKNOWN && db_type < DB_TYPE_DEFAULT && #ifdef DBUG_OFF
installed_htons[db_type]) return my_plugin_lock(thd, plugin);
return hton2plugin[installed_htons[db_type]->slot]->name.str; #else
/* fall through */ return my_plugin_lock(thd, &plugin);
case DB_TYPE_UNKNOWN: #endif
return "UNKNOWN";
} }
return NULL;
} }
@ -172,14 +186,16 @@ static handler *create_default(TABLE_SHARE *table, MEM_ROOT *mem_root)
handlerton *ha_resolve_by_legacy_type(THD *thd, enum legacy_db_type db_type) handlerton *ha_resolve_by_legacy_type(THD *thd, enum legacy_db_type db_type)
{ {
plugin_ref plugin;
switch (db_type) { switch (db_type) {
case DB_TYPE_DEFAULT: case DB_TYPE_DEFAULT:
return ha_default_handlerton(thd); return ha_default_handlerton(thd);
case DB_TYPE_UNKNOWN:
return NULL;
default: default:
if (db_type > DB_TYPE_UNKNOWN && db_type < DB_TYPE_DEFAULT) if (db_type > DB_TYPE_UNKNOWN && db_type < DB_TYPE_DEFAULT &&
return installed_htons[db_type]; (plugin= ha_lock_engine(thd, installed_htons[db_type])))
return plugin_data(plugin, handlerton*);
/* fall through */
case DB_TYPE_UNKNOWN:
return NULL; return NULL;
} }
} }
@ -199,7 +215,7 @@ handlerton *ha_checktype(THD *thd, enum legacy_db_type database_type,
{ {
if (report_error) if (report_error)
{ {
const char *engine_name= ha_get_storage_engine(database_type); const char *engine_name= ha_resolve_storage_engine_name(hton);
my_error(ER_FEATURE_DISABLED,MYF(0),engine_name,engine_name); my_error(ER_FEATURE_DISABLED,MYF(0),engine_name,engine_name);
} }
return NULL; return NULL;
@ -238,8 +254,7 @@ handler *get_new_handler(TABLE_SHARE *share, MEM_ROOT *alloc,
Here the call to current_thd() is ok as we call this function a lot of Here the call to current_thd() is ok as we call this function a lot of
times but we enter this branch very seldom. times but we enter this branch very seldom.
*/ */
DBUG_RETURN(get_new_handler(share, alloc, DBUG_RETURN(get_new_handler(share, alloc, ha_default_handlerton(current_thd)));
current_thd->variables.table_type));
} }
@ -401,6 +416,7 @@ int ha_initialize_handlerton(st_plugin_int *plugin)
{ {
handlerton *hton; handlerton *hton;
DBUG_ENTER("ha_initialize_handlerton"); DBUG_ENTER("ha_initialize_handlerton");
DBUG_PRINT("plugin", ("initialize plugin: '%s'", plugin->name.str));
hton= (handlerton *)my_malloc(sizeof(handlerton), hton= (handlerton *)my_malloc(sizeof(handlerton),
MYF(MY_WME | MY_ZEROFILL)); MYF(MY_WME | MY_ZEROFILL));
@ -522,10 +538,10 @@ int ha_end()
DBUG_RETURN(error); DBUG_RETURN(error);
} }
static my_bool dropdb_handlerton(THD *unused1, st_plugin_int *plugin, static my_bool dropdb_handlerton(THD *unused1, plugin_ref plugin,
void *path) void *path)
{ {
handlerton *hton= (handlerton *)plugin->data; handlerton *hton= plugin_data(plugin, handlerton *);
if (hton->state == SHOW_OPTION_YES && hton->drop_database) if (hton->state == SHOW_OPTION_YES && hton->drop_database)
hton->drop_database(hton, (char *)path); hton->drop_database(hton, (char *)path);
return FALSE; return FALSE;
@ -538,10 +554,10 @@ void ha_drop_database(char* path)
} }
static my_bool closecon_handlerton(THD *thd, st_plugin_int *plugin, static my_bool closecon_handlerton(THD *thd, plugin_ref plugin,
void *unused) void *unused)
{ {
handlerton *hton= (handlerton *)plugin->data; handlerton *hton= plugin_data(plugin, handlerton *);
/* /*
there's no need to rollback here as all transactions must there's no need to rollback here as all transactions must
be rolled back already be rolled back already
@ -638,7 +654,7 @@ int ha_prepare(THD *thd)
{ {
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA), ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA),
hton2plugin[(*ht)->slot]->name.str); ha_resolve_storage_engine_name(*ht));
} }
} }
} }
@ -886,10 +902,10 @@ struct xahton_st {
int result; int result;
}; };
static my_bool xacommit_handlerton(THD *unused1, st_plugin_int *plugin, static my_bool xacommit_handlerton(THD *unused1, plugin_ref plugin,
void *arg) void *arg)
{ {
handlerton *hton= (handlerton *)plugin->data; handlerton *hton= plugin_data(plugin, handlerton *);
if (hton->state == SHOW_OPTION_YES && hton->recover) if (hton->state == SHOW_OPTION_YES && hton->recover)
{ {
hton->commit_by_xid(hton, ((struct xahton_st *)arg)->xid); hton->commit_by_xid(hton, ((struct xahton_st *)arg)->xid);
@ -898,10 +914,10 @@ static my_bool xacommit_handlerton(THD *unused1, st_plugin_int *plugin,
return FALSE; return FALSE;
} }
static my_bool xarollback_handlerton(THD *unused1, st_plugin_int *plugin, static my_bool xarollback_handlerton(THD *unused1, plugin_ref plugin,
void *arg) void *arg)
{ {
handlerton *hton= (handlerton *)plugin->data; handlerton *hton= plugin_data(plugin, handlerton *);
if (hton->state == SHOW_OPTION_YES && hton->recover) if (hton->state == SHOW_OPTION_YES && hton->recover)
{ {
hton->rollback_by_xid(hton, ((struct xahton_st *)arg)->xid); hton->rollback_by_xid(hton, ((struct xahton_st *)arg)->xid);
@ -1004,10 +1020,10 @@ struct xarecover_st
bool dry_run; bool dry_run;
}; };
static my_bool xarecover_handlerton(THD *unused, st_plugin_int *plugin, static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin,
void *arg) void *arg)
{ {
handlerton *hton= (handlerton *)plugin->data; handlerton *hton= plugin_data(plugin, handlerton *);
struct xarecover_st *info= (struct xarecover_st *) arg; struct xarecover_st *info= (struct xarecover_st *) arg;
int got; int got;
@ -1016,7 +1032,7 @@ static my_bool xarecover_handlerton(THD *unused, st_plugin_int *plugin,
while ((got= hton->recover(hton, info->list, info->len)) > 0 ) while ((got= hton->recover(hton, info->list, info->len)) > 0 )
{ {
sql_print_information("Found %d prepared transaction(s) in %s", sql_print_information("Found %d prepared transaction(s) in %s",
got, hton2plugin[hton->slot]->name.str); got, ha_resolve_storage_engine_name(hton));
for (int i=0; i < got; i ++) for (int i=0; i < got; i ++)
{ {
my_xid x=info->list[i].get_my_xid(); my_xid x=info->list[i].get_my_xid();
@ -1192,10 +1208,10 @@ bool mysql_xa_recover(THD *thd)
thd: the thread handle of the current connection thd: the thread handle of the current connection
return value: always 0 return value: always 0
*/ */
static my_bool release_temporary_latches(THD *thd, st_plugin_int *plugin, static my_bool release_temporary_latches(THD *thd, plugin_ref plugin,
void *unused) void *unused)
{ {
handlerton *hton= (handlerton *)plugin->data; handlerton *hton= plugin_data(plugin, handlerton *);
if (hton->state == SHOW_OPTION_YES && hton->release_temporary_latches) if (hton->state == SHOW_OPTION_YES && hton->release_temporary_latches)
hton->release_temporary_latches(hton, thd); hton->release_temporary_latches(hton, thd);
@ -1318,10 +1334,10 @@ int ha_release_savepoint(THD *thd, SAVEPOINT *sv)
} }
static my_bool snapshot_handlerton(THD *thd, st_plugin_int *plugin, static my_bool snapshot_handlerton(THD *thd, plugin_ref plugin,
void *arg) void *arg)
{ {
handlerton *hton= (handlerton *)plugin->data; handlerton *hton= plugin_data(plugin, handlerton *);
if (hton->state == SHOW_OPTION_YES && if (hton->state == SHOW_OPTION_YES &&
hton->start_consistent_snapshot) hton->start_consistent_snapshot)
{ {
@ -1349,10 +1365,10 @@ int ha_start_consistent_snapshot(THD *thd)
} }
static my_bool flush_handlerton(THD *thd, st_plugin_int *plugin, static my_bool flush_handlerton(THD *thd, plugin_ref plugin,
void *arg) void *arg)
{ {
handlerton *hton= (handlerton *)plugin->data; handlerton *hton= plugin_data(plugin, handlerton *);
if (hton->state == SHOW_OPTION_YES && hton->flush_logs && if (hton->state == SHOW_OPTION_YES && hton->flush_logs &&
hton->flush_logs(hton)) hton->flush_logs(hton))
return TRUE; return TRUE;
@ -1397,7 +1413,7 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
/* DB_TYPE_UNKNOWN is used in ALTER TABLE when renaming only .frm files */ /* DB_TYPE_UNKNOWN is used in ALTER TABLE when renaming only .frm files */
if (table_type == NULL || if (table_type == NULL ||
! (file=get_new_handler(&dummy_share, thd->mem_root, table_type))) ! (file=get_new_handler((TABLE_SHARE*)0, thd->mem_root, table_type)))
DBUG_RETURN(ENOENT); DBUG_RETURN(ENOENT);
if (lower_case_table_names == 2 && !(file->ha_table_flags() & HA_FILE_BASED)) if (lower_case_table_names == 2 && !(file->ha_table_flags() & HA_FILE_BASED))
@ -1438,6 +1454,8 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
dummy_share.table_name.length= strlen(alias); dummy_share.table_name.length= strlen(alias);
dummy_table.alias= alias; dummy_table.alias= alias;
file->table_share= &dummy_share;
file->table= &dummy_table;
file->print_error(error, 0); file->print_error(error, 0);
strmake(new_error, thd->net.last_error, sizeof(buff)-1); strmake(new_error, thd->net.last_error, sizeof(buff)-1);
@ -1458,7 +1476,7 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
****************************************************************************/ ****************************************************************************/
handler *handler::clone(MEM_ROOT *mem_root) handler *handler::clone(MEM_ROOT *mem_root)
{ {
handler *new_handler= get_new_handler(table->s, mem_root, table->s->db_type); handler *new_handler= get_new_handler(table->s, mem_root, table->s->db_type());
if (new_handler && !new_handler->ha_open(table, if (new_handler && !new_handler->ha_open(table,
table->s->normalized_path.str, table->s->normalized_path.str,
table->db_stat, table->db_stat,
@ -1474,6 +1492,17 @@ void handler::ha_statistic_increment(ulong SSV::*offset) const
statistic_increment(table->in_use->status_var.*offset, &LOCK_status); statistic_increment(table->in_use->status_var.*offset, &LOCK_status);
} }
void **handler::ha_data(THD *thd) const
{
return (void **) thd->ha_data + ht->slot;
}
THD *handler::ha_thd(void) const
{
DBUG_ASSERT(!table || !table->in_use || table->in_use == current_thd);
return (table && table->in_use) ? table->in_use : current_thd;
}
bool handler::check_if_log_table_locking_is_allowed(uint sql_command, bool handler::check_if_log_table_locking_is_allowed(uint sql_command,
ulong type, TABLE *table) ulong type, TABLE *table)
@ -1567,8 +1596,7 @@ int handler::read_first_row(byte * buf, uint primary_key)
register int error; register int error;
DBUG_ENTER("handler::read_first_row"); DBUG_ENTER("handler::read_first_row");
statistic_increment(table->in_use->status_var.ha_read_first_count, ha_statistic_increment(&SSV::ha_read_first_count);
&LOCK_status);
/* /*
If there is very few deleted rows in the table, find the first row by If there is very few deleted rows in the table, find the first row by
@ -2778,11 +2806,11 @@ struct st_discover_args
uint* frmlen; uint* frmlen;
}; };
static my_bool discover_handlerton(THD *thd, st_plugin_int *plugin, static my_bool discover_handlerton(THD *thd, plugin_ref plugin,
void *arg) void *arg)
{ {
st_discover_args *vargs= (st_discover_args *)arg; st_discover_args *vargs= (st_discover_args *)arg;
handlerton *hton= (handlerton *)plugin->data; handlerton *hton= plugin_data(plugin, handlerton *);
if (hton->state == SHOW_OPTION_YES && hton->discover && if (hton->state == SHOW_OPTION_YES && hton->discover &&
(!(hton->discover(hton, thd, vargs->db, vargs->name, (!(hton->discover(hton, thd, vargs->db, vargs->name,
vargs->frmblob, vargs->frmblob,
@ -2827,11 +2855,11 @@ struct st_find_files_args
List<char> *files; List<char> *files;
}; };
static my_bool find_files_handlerton(THD *thd, st_plugin_int *plugin, static my_bool find_files_handlerton(THD *thd, plugin_ref plugin,
void *arg) void *arg)
{ {
st_find_files_args *vargs= (st_find_files_args *)arg; st_find_files_args *vargs= (st_find_files_args *)arg;
handlerton *hton= (handlerton *)plugin->data; handlerton *hton= plugin_data(plugin, handlerton *);
if (hton->state == SHOW_OPTION_YES && hton->find_files) if (hton->state == SHOW_OPTION_YES && hton->find_files)
@ -2874,11 +2902,11 @@ struct st_table_exists_in_engine_args
const char *name; const char *name;
}; };
static my_bool table_exists_in_engine_handlerton(THD *thd, st_plugin_int *plugin, static my_bool table_exists_in_engine_handlerton(THD *thd, plugin_ref plugin,
void *arg) void *arg)
{ {
st_table_exists_in_engine_args *vargs= (st_table_exists_in_engine_args *)arg; st_table_exists_in_engine_args *vargs= (st_table_exists_in_engine_args *)arg;
handlerton *hton= (handlerton *)plugin->data; handlerton *hton= plugin_data(plugin, handlerton *);
if (hton->state == SHOW_OPTION_YES && hton->table_exists_in_engine) if (hton->state == SHOW_OPTION_YES && hton->table_exists_in_engine)
if ((hton->table_exists_in_engine(hton, thd, vargs->db, vargs->name)) == 1) if ((hton->table_exists_in_engine(hton, thd, vargs->db, vargs->name)) == 1)
@ -2922,10 +2950,10 @@ struct binlog_func_st
/** @brief /** @brief
Listing handlertons first to avoid recursive calls and deadlock Listing handlertons first to avoid recursive calls and deadlock
*/ */
static my_bool binlog_func_list(THD *thd, st_plugin_int *plugin, void *arg) static my_bool binlog_func_list(THD *thd, plugin_ref plugin, void *arg)
{ {
hton_list_st *hton_list= (hton_list_st *)arg; hton_list_st *hton_list= (hton_list_st *)arg;
handlerton *hton= (handlerton *)plugin->data; handlerton *hton= plugin_data(plugin, handlerton *);
if (hton->state == SHOW_OPTION_YES && hton->binlog_func) if (hton->state == SHOW_OPTION_YES && hton->binlog_func)
{ {
uint sz= hton_list->sz; uint sz= hton_list->sz;
@ -3012,10 +3040,10 @@ static my_bool binlog_log_query_handlerton2(THD *thd,
} }
static my_bool binlog_log_query_handlerton(THD *thd, static my_bool binlog_log_query_handlerton(THD *thd,
st_plugin_int *plugin, plugin_ref plugin,
void *args) void *args)
{ {
return binlog_log_query_handlerton2(thd, (handlerton *)plugin->data, args); return binlog_log_query_handlerton2(thd, plugin_data(plugin, handlerton *), args);
} }
void ha_binlog_log_query(THD *thd, handlerton *hton, void ha_binlog_log_query(THD *thd, handlerton *hton,
@ -3307,11 +3335,11 @@ int handler::index_read_idx(byte * buf, uint index, const byte * key,
RETURN VALUE RETURN VALUE
pointer pointer to TYPELIB structure pointer pointer to TYPELIB structure
*/ */
static my_bool exts_handlerton(THD *unused, st_plugin_int *plugin, static my_bool exts_handlerton(THD *unused, plugin_ref plugin,
void *arg) void *arg)
{ {
List<char> *found_exts= (List<char> *) arg; List<char> *found_exts= (List<char> *) arg;
handlerton *hton= (handlerton *)plugin->data; handlerton *hton= plugin_data(plugin, handlerton *);
handler *file; handler *file;
if (hton->state == SHOW_OPTION_YES && hton->create && if (hton->state == SHOW_OPTION_YES && hton->create &&
(file= hton->create(hton, (TABLE_SHARE*) 0, current_thd->mem_root))) (file= hton->create(hton, (TABLE_SHARE*) 0, current_thd->mem_root)))
@ -3382,11 +3410,11 @@ static bool stat_print(THD *thd, const char *type, uint type_len,
} }
static my_bool showstat_handlerton(THD *thd, st_plugin_int *plugin, static my_bool showstat_handlerton(THD *thd, plugin_ref plugin,
void *arg) void *arg)
{ {
enum ha_stat_type stat= *(enum ha_stat_type *) arg; enum ha_stat_type stat= *(enum ha_stat_type *) arg;
handlerton *hton= (handlerton *)plugin->data; handlerton *hton= plugin_data(plugin, handlerton *);
if (hton->state == SHOW_OPTION_YES && hton->show_status && if (hton->state == SHOW_OPTION_YES && hton->show_status &&
hton->show_status(hton, thd, stat_print, stat)) hton->show_status(hton, thd, stat_print, stat))
return TRUE; return TRUE;

View File

@ -888,6 +888,8 @@ uint calculate_key_len(TABLE *, uint, const byte *, key_part_map);
class handler :public Sql_alloc class handler :public Sql_alloc
{ {
friend class ha_partition; friend class ha_partition;
friend int ha_delete_table(THD*,handlerton*,const char*,const char*,
const char*,bool);
protected: protected:
struct st_table_share *table_share; /* The table definition */ struct st_table_share *table_share; /* The table definition */
@ -906,7 +908,10 @@ class handler :public Sql_alloc
virtual int rnd_init(bool scan) =0; virtual int rnd_init(bool scan) =0;
virtual int rnd_end() { return 0; } virtual int rnd_end() { return 0; }
virtual ulonglong table_flags(void) const =0; virtual ulonglong table_flags(void) const =0;
void ha_statistic_increment(ulong SSV::*offset) const; void ha_statistic_increment(ulong SSV::*offset) const;
void **ha_data(THD *) const;
THD *ha_thd(void) const;
ha_rows estimation_rows_to_insert; ha_rows estimation_rows_to_insert;
virtual void start_bulk_insert(ha_rows rows) {} virtual void start_bulk_insert(ha_rows rows) {}
@ -963,11 +968,12 @@ public:
Discrete_interval auto_inc_interval_for_cur_row; Discrete_interval auto_inc_interval_for_cur_row;
handler(handlerton *ht_arg, TABLE_SHARE *share_arg) handler(handlerton *ht_arg, TABLE_SHARE *share_arg)
:table_share(share_arg), estimation_rows_to_insert(0), ht(ht_arg), :table_share(share_arg), table(0),
estimation_rows_to_insert(0), ht(ht_arg),
ref(0), key_used_on_scan(MAX_KEY), active_index(MAX_KEY), ref(0), key_used_on_scan(MAX_KEY), active_index(MAX_KEY),
ref_length(sizeof(my_off_t)), ref_length(sizeof(my_off_t)),
ft_handler(0), inited(NONE), implicit_emptied(0), ft_handler(0), inited(NONE), implicit_emptied(0),
pushed_cond(NULL), next_insert_id(0), insert_id_for_cur_row(0) pushed_cond(0), next_insert_id(0), insert_id_for_cur_row(0)
{} {}
virtual ~handler(void) virtual ~handler(void)
{ {
@ -1570,6 +1576,10 @@ public:
/* lock_count() can be more than one if the table is a MERGE */ /* lock_count() can be more than one if the table is a MERGE */
virtual uint lock_count(void) const { return 1; } virtual uint lock_count(void) const { return 1; }
/*
NOTE that one can NOT rely on table->in_use in store_lock(). It may
refer to a different thread if called from mysql_lock_abort_for_thread().
*/
virtual THR_LOCK_DATA **store_lock(THD *thd, virtual THR_LOCK_DATA **store_lock(THD *thd,
THR_LOCK_DATA **to, THR_LOCK_DATA **to,
enum thr_lock_type lock_type)=0; enum thr_lock_type lock_type)=0;
@ -1687,9 +1697,9 @@ extern ulong total_ha, total_ha_2pc;
/* lookups */ /* lookups */
handlerton *ha_default_handlerton(THD *thd); handlerton *ha_default_handlerton(THD *thd);
handlerton *ha_resolve_by_name(THD *thd, const LEX_STRING *name); plugin_ref ha_resolve_by_name(THD *thd, const LEX_STRING *name);
plugin_ref ha_lock_engine(THD *thd, handlerton *hton);
handlerton *ha_resolve_by_legacy_type(THD *thd, enum legacy_db_type db_type); handlerton *ha_resolve_by_legacy_type(THD *thd, enum legacy_db_type db_type);
const char *ha_get_storage_engine(enum legacy_db_type db_type);
handler *get_new_handler(TABLE_SHARE *share, MEM_ROOT *alloc, handler *get_new_handler(TABLE_SHARE *share, MEM_ROOT *alloc,
handlerton *db_type); handlerton *db_type);
handlerton *ha_checktype(THD *thd, enum legacy_db_type database_type, handlerton *ha_checktype(THD *thd, enum legacy_db_type database_type,

View File

@ -4681,203 +4681,203 @@ struct Native_func_registry
static Native_func_registry func_array[] = static Native_func_registry func_array[] =
{ {
{ C_STRING_WITH_LEN("ABS"), BUILDER(Create_func_abs)}, { { C_STRING_WITH_LEN("ABS") }, BUILDER(Create_func_abs)},
{ C_STRING_WITH_LEN("ACOS"), BUILDER(Create_func_acos)}, { { C_STRING_WITH_LEN("ACOS") }, BUILDER(Create_func_acos)},
{ C_STRING_WITH_LEN("ADDTIME"), BUILDER(Create_func_addtime)}, { { C_STRING_WITH_LEN("ADDTIME") }, BUILDER(Create_func_addtime)},
{ C_STRING_WITH_LEN("AES_DECRYPT"), BUILDER(Create_func_aes_decrypt)}, { { C_STRING_WITH_LEN("AES_DECRYPT") }, BUILDER(Create_func_aes_decrypt)},
{ C_STRING_WITH_LEN("AES_ENCRYPT"), BUILDER(Create_func_aes_encrypt)}, { { C_STRING_WITH_LEN("AES_ENCRYPT") }, BUILDER(Create_func_aes_encrypt)},
{ C_STRING_WITH_LEN("AREA"), GEOM_BUILDER(Create_func_area)}, { { C_STRING_WITH_LEN("AREA") }, GEOM_BUILDER(Create_func_area)},
{ C_STRING_WITH_LEN("ASBINARY"), GEOM_BUILDER(Create_func_as_wkb)}, { { C_STRING_WITH_LEN("ASBINARY") }, GEOM_BUILDER(Create_func_as_wkb)},
{ C_STRING_WITH_LEN("ASIN"), BUILDER(Create_func_asin)}, { { C_STRING_WITH_LEN("ASIN") }, BUILDER(Create_func_asin)},
{ C_STRING_WITH_LEN("ASTEXT"), GEOM_BUILDER(Create_func_as_wkt)}, { { C_STRING_WITH_LEN("ASTEXT") }, GEOM_BUILDER(Create_func_as_wkt)},
{ C_STRING_WITH_LEN("ASWKB"), GEOM_BUILDER(Create_func_as_wkb)}, { { C_STRING_WITH_LEN("ASWKB") }, GEOM_BUILDER(Create_func_as_wkb)},
{ C_STRING_WITH_LEN("ASWKT"), GEOM_BUILDER(Create_func_as_wkt)}, { { C_STRING_WITH_LEN("ASWKT") }, GEOM_BUILDER(Create_func_as_wkt)},
{ C_STRING_WITH_LEN("ATAN"), BUILDER(Create_func_atan)}, { { C_STRING_WITH_LEN("ATAN") }, BUILDER(Create_func_atan)},
{ C_STRING_WITH_LEN("ATAN2"), BUILDER(Create_func_atan)}, { { C_STRING_WITH_LEN("ATAN2") }, BUILDER(Create_func_atan)},
{ C_STRING_WITH_LEN("BENCHMARK"), BUILDER(Create_func_benchmark)}, { { C_STRING_WITH_LEN("BENCHMARK") }, BUILDER(Create_func_benchmark)},
{ C_STRING_WITH_LEN("BIN"), BUILDER(Create_func_bin)}, { { C_STRING_WITH_LEN("BIN") }, BUILDER(Create_func_bin)},
{ C_STRING_WITH_LEN("BIT_COUNT"), BUILDER(Create_func_bit_count)}, { { C_STRING_WITH_LEN("BIT_COUNT") }, BUILDER(Create_func_bit_count)},
{ C_STRING_WITH_LEN("BIT_LENGTH"), BUILDER(Create_func_bit_length)}, { { C_STRING_WITH_LEN("BIT_LENGTH") }, BUILDER(Create_func_bit_length)},
{ C_STRING_WITH_LEN("CEIL"), BUILDER(Create_func_ceiling)}, { { C_STRING_WITH_LEN("CEIL") }, BUILDER(Create_func_ceiling)},
{ C_STRING_WITH_LEN("CEILING"), BUILDER(Create_func_ceiling)}, { { C_STRING_WITH_LEN("CEILING") }, BUILDER(Create_func_ceiling)},
{ C_STRING_WITH_LEN("CENTROID"), GEOM_BUILDER(Create_func_centroid)}, { { C_STRING_WITH_LEN("CENTROID") }, GEOM_BUILDER(Create_func_centroid)},
{ C_STRING_WITH_LEN("CHARACTER_LENGTH"), BUILDER(Create_func_char_length)}, { { C_STRING_WITH_LEN("CHARACTER_LENGTH") }, BUILDER(Create_func_char_length)},
{ C_STRING_WITH_LEN("CHAR_LENGTH"), BUILDER(Create_func_char_length)}, { { C_STRING_WITH_LEN("CHAR_LENGTH") }, BUILDER(Create_func_char_length)},
{ C_STRING_WITH_LEN("COERCIBILITY"), BUILDER(Create_func_coercibility)}, { { C_STRING_WITH_LEN("COERCIBILITY") }, BUILDER(Create_func_coercibility)},
{ C_STRING_WITH_LEN("COMPRESS"), BUILDER(Create_func_compress)}, { { C_STRING_WITH_LEN("COMPRESS") }, BUILDER(Create_func_compress)},
{ C_STRING_WITH_LEN("CONCAT"), BUILDER(Create_func_concat)}, { { C_STRING_WITH_LEN("CONCAT") }, BUILDER(Create_func_concat)},
{ C_STRING_WITH_LEN("CONCAT_WS"), BUILDER(Create_func_concat_ws)}, { { C_STRING_WITH_LEN("CONCAT_WS") }, BUILDER(Create_func_concat_ws)},
{ C_STRING_WITH_LEN("CONNECTION_ID"), BUILDER(Create_func_connection_id)}, { { C_STRING_WITH_LEN("CONNECTION_ID") }, BUILDER(Create_func_connection_id)},
{ C_STRING_WITH_LEN("CONV"), BUILDER(Create_func_conv)}, { { C_STRING_WITH_LEN("CONV") }, BUILDER(Create_func_conv)},
{ C_STRING_WITH_LEN("CONVERT_TZ"), BUILDER(Create_func_convert_tz)}, { { C_STRING_WITH_LEN("CONVERT_TZ") }, BUILDER(Create_func_convert_tz)},
{ C_STRING_WITH_LEN("COS"), BUILDER(Create_func_cos)}, { { C_STRING_WITH_LEN("COS") }, BUILDER(Create_func_cos)},
{ C_STRING_WITH_LEN("COT"), BUILDER(Create_func_cot)}, { { C_STRING_WITH_LEN("COT") }, BUILDER(Create_func_cot)},
{ C_STRING_WITH_LEN("CRC32"), BUILDER(Create_func_crc32)}, { { C_STRING_WITH_LEN("CRC32") }, BUILDER(Create_func_crc32)},
{ C_STRING_WITH_LEN("CROSSES"), GEOM_BUILDER(Create_func_crosses)}, { { C_STRING_WITH_LEN("CROSSES") }, GEOM_BUILDER(Create_func_crosses)},
{ C_STRING_WITH_LEN("DATEDIFF"), BUILDER(Create_func_datediff)}, { { C_STRING_WITH_LEN("DATEDIFF") }, BUILDER(Create_func_datediff)},
{ C_STRING_WITH_LEN("DATE_FORMAT"), BUILDER(Create_func_date_format)}, { { C_STRING_WITH_LEN("DATE_FORMAT") }, BUILDER(Create_func_date_format)},
{ C_STRING_WITH_LEN("DAYNAME"), BUILDER(Create_func_dayname)}, { { C_STRING_WITH_LEN("DAYNAME") }, BUILDER(Create_func_dayname)},
{ C_STRING_WITH_LEN("DAYOFMONTH"), BUILDER(Create_func_dayofmonth)}, { { C_STRING_WITH_LEN("DAYOFMONTH") }, BUILDER(Create_func_dayofmonth)},
{ C_STRING_WITH_LEN("DAYOFWEEK"), BUILDER(Create_func_dayofweek)}, { { C_STRING_WITH_LEN("DAYOFWEEK") }, BUILDER(Create_func_dayofweek)},
{ C_STRING_WITH_LEN("DAYOFYEAR"), BUILDER(Create_func_dayofyear)}, { { C_STRING_WITH_LEN("DAYOFYEAR") }, BUILDER(Create_func_dayofyear)},
{ C_STRING_WITH_LEN("DECODE"), BUILDER(Create_func_decode)}, { { C_STRING_WITH_LEN("DECODE") }, BUILDER(Create_func_decode)},
{ C_STRING_WITH_LEN("DEGREES"), BUILDER(Create_func_degrees)}, { { C_STRING_WITH_LEN("DEGREES") }, BUILDER(Create_func_degrees)},
{ C_STRING_WITH_LEN("DES_DECRYPT"), BUILDER(Create_func_des_decrypt)}, { { C_STRING_WITH_LEN("DES_DECRYPT") }, BUILDER(Create_func_des_decrypt)},
{ C_STRING_WITH_LEN("DES_ENCRYPT"), BUILDER(Create_func_des_encrypt)}, { { C_STRING_WITH_LEN("DES_ENCRYPT") }, BUILDER(Create_func_des_encrypt)},
{ C_STRING_WITH_LEN("DIMENSION"), GEOM_BUILDER(Create_func_dimension)}, { { C_STRING_WITH_LEN("DIMENSION") }, GEOM_BUILDER(Create_func_dimension)},
{ C_STRING_WITH_LEN("DISJOINT"), GEOM_BUILDER(Create_func_disjoint)}, { { C_STRING_WITH_LEN("DISJOINT") }, GEOM_BUILDER(Create_func_disjoint)},
{ C_STRING_WITH_LEN("ELT"), BUILDER(Create_func_elt)}, { { C_STRING_WITH_LEN("ELT") }, BUILDER(Create_func_elt)},
{ C_STRING_WITH_LEN("ENCODE"), BUILDER(Create_func_encode)}, { { C_STRING_WITH_LEN("ENCODE") }, BUILDER(Create_func_encode)},
{ C_STRING_WITH_LEN("ENCRYPT"), BUILDER(Create_func_encrypt)}, { { C_STRING_WITH_LEN("ENCRYPT") }, BUILDER(Create_func_encrypt)},
{ C_STRING_WITH_LEN("ENDPOINT"), GEOM_BUILDER(Create_func_endpoint)}, { { C_STRING_WITH_LEN("ENDPOINT") }, GEOM_BUILDER(Create_func_endpoint)},
{ C_STRING_WITH_LEN("ENVELOPE"), GEOM_BUILDER(Create_func_envelope)}, { { C_STRING_WITH_LEN("ENVELOPE") }, GEOM_BUILDER(Create_func_envelope)},
{ C_STRING_WITH_LEN("EQUALS"), GEOM_BUILDER(Create_func_equals)}, { { C_STRING_WITH_LEN("EQUALS") }, GEOM_BUILDER(Create_func_equals)},
{ C_STRING_WITH_LEN("EXP"), BUILDER(Create_func_exp)}, { { C_STRING_WITH_LEN("EXP") }, BUILDER(Create_func_exp)},
{ C_STRING_WITH_LEN("EXPORT_SET"), BUILDER(Create_func_export_set)}, { { C_STRING_WITH_LEN("EXPORT_SET") }, BUILDER(Create_func_export_set)},
{ C_STRING_WITH_LEN("EXTERIORRING"), GEOM_BUILDER(Create_func_exteriorring)}, { { C_STRING_WITH_LEN("EXTERIORRING") }, GEOM_BUILDER(Create_func_exteriorring)},
{ C_STRING_WITH_LEN("EXTRACTVALUE"), BUILDER(Create_func_xml_extractvalue)}, { { C_STRING_WITH_LEN("EXTRACTVALUE") }, BUILDER(Create_func_xml_extractvalue)},
{ C_STRING_WITH_LEN("FIELD"), BUILDER(Create_func_field)}, { { C_STRING_WITH_LEN("FIELD") }, BUILDER(Create_func_field)},
{ C_STRING_WITH_LEN("FIND_IN_SET"), BUILDER(Create_func_find_in_set)}, { { C_STRING_WITH_LEN("FIND_IN_SET") }, BUILDER(Create_func_find_in_set)},
{ C_STRING_WITH_LEN("FLOOR"), BUILDER(Create_func_floor)}, { { C_STRING_WITH_LEN("FLOOR") }, BUILDER(Create_func_floor)},
{ C_STRING_WITH_LEN("FORMAT"), BUILDER(Create_func_format)}, { { C_STRING_WITH_LEN("FORMAT") }, BUILDER(Create_func_format)},
{ C_STRING_WITH_LEN("FOUND_ROWS"), BUILDER(Create_func_found_rows)}, { { C_STRING_WITH_LEN("FOUND_ROWS") }, BUILDER(Create_func_found_rows)},
{ C_STRING_WITH_LEN("FROM_DAYS"), BUILDER(Create_func_from_days)}, { { C_STRING_WITH_LEN("FROM_DAYS") }, BUILDER(Create_func_from_days)},
{ C_STRING_WITH_LEN("FROM_UNIXTIME"), BUILDER(Create_func_from_unixtime)}, { { C_STRING_WITH_LEN("FROM_UNIXTIME") }, BUILDER(Create_func_from_unixtime)},
{ C_STRING_WITH_LEN("GEOMCOLLFROMTEXT"), GEOM_BUILDER(Create_func_geometry_from_text)}, { { C_STRING_WITH_LEN("GEOMCOLLFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
{ C_STRING_WITH_LEN("GEOMCOLLFROMWKB"), GEOM_BUILDER(Create_func_geometry_from_wkb)}, { { C_STRING_WITH_LEN("GEOMCOLLFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ C_STRING_WITH_LEN("GEOMETRYCOLLECTIONFROMTEXT"), GEOM_BUILDER(Create_func_geometry_from_text)}, { { C_STRING_WITH_LEN("GEOMETRYCOLLECTIONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
{ C_STRING_WITH_LEN("GEOMETRYCOLLECTIONFROMWKB"), GEOM_BUILDER(Create_func_geometry_from_wkb)}, { { C_STRING_WITH_LEN("GEOMETRYCOLLECTIONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ C_STRING_WITH_LEN("GEOMETRYFROMTEXT"), GEOM_BUILDER(Create_func_geometry_from_text)}, { { C_STRING_WITH_LEN("GEOMETRYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
{ C_STRING_WITH_LEN("GEOMETRYFROMWKB"), GEOM_BUILDER(Create_func_geometry_from_wkb)}, { { C_STRING_WITH_LEN("GEOMETRYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ C_STRING_WITH_LEN("GEOMETRYN"), GEOM_BUILDER(Create_func_geometryn)}, { { C_STRING_WITH_LEN("GEOMETRYN") }, GEOM_BUILDER(Create_func_geometryn)},
{ C_STRING_WITH_LEN("GEOMETRYTYPE"), GEOM_BUILDER(Create_func_geometry_type)}, { { C_STRING_WITH_LEN("GEOMETRYTYPE") }, GEOM_BUILDER(Create_func_geometry_type)},
{ C_STRING_WITH_LEN("GEOMFROMTEXT"), GEOM_BUILDER(Create_func_geometry_from_text)}, { { C_STRING_WITH_LEN("GEOMFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
{ C_STRING_WITH_LEN("GEOMFROMWKB"), GEOM_BUILDER(Create_func_geometry_from_wkb)}, { { C_STRING_WITH_LEN("GEOMFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ C_STRING_WITH_LEN("GET_LOCK"), BUILDER(Create_func_get_lock)}, { { C_STRING_WITH_LEN("GET_LOCK") }, BUILDER(Create_func_get_lock)},
{ C_STRING_WITH_LEN("GLENGTH"), GEOM_BUILDER(Create_func_glength)}, { { C_STRING_WITH_LEN("GLENGTH") }, GEOM_BUILDER(Create_func_glength)},
{ C_STRING_WITH_LEN("GREATEST"), BUILDER(Create_func_greatest)}, { { C_STRING_WITH_LEN("GREATEST") }, BUILDER(Create_func_greatest)},
{ C_STRING_WITH_LEN("HEX"), BUILDER(Create_func_hex)}, { { C_STRING_WITH_LEN("HEX") }, BUILDER(Create_func_hex)},
{ C_STRING_WITH_LEN("IFNULL"), BUILDER(Create_func_ifnull)}, { { C_STRING_WITH_LEN("IFNULL") }, BUILDER(Create_func_ifnull)},
{ C_STRING_WITH_LEN("INET_ATON"), BUILDER(Create_func_inet_aton)}, { { C_STRING_WITH_LEN("INET_ATON") }, BUILDER(Create_func_inet_aton)},
{ C_STRING_WITH_LEN("INET_NTOA"), BUILDER(Create_func_inet_ntoa)}, { { C_STRING_WITH_LEN("INET_NTOA") }, BUILDER(Create_func_inet_ntoa)},
{ C_STRING_WITH_LEN("INSTR"), BUILDER(Create_func_instr)}, { { C_STRING_WITH_LEN("INSTR") }, BUILDER(Create_func_instr)},
{ C_STRING_WITH_LEN("INTERIORRINGN"), GEOM_BUILDER(Create_func_interiorringn)}, { { C_STRING_WITH_LEN("INTERIORRINGN") }, GEOM_BUILDER(Create_func_interiorringn)},
{ C_STRING_WITH_LEN("INTERSECTS"), GEOM_BUILDER(Create_func_intersects)}, { { C_STRING_WITH_LEN("INTERSECTS") }, GEOM_BUILDER(Create_func_intersects)},
{ C_STRING_WITH_LEN("ISCLOSED"), GEOM_BUILDER(Create_func_isclosed)}, { { C_STRING_WITH_LEN("ISCLOSED") }, GEOM_BUILDER(Create_func_isclosed)},
{ C_STRING_WITH_LEN("ISEMPTY"), GEOM_BUILDER(Create_func_isempty)}, { { C_STRING_WITH_LEN("ISEMPTY") }, GEOM_BUILDER(Create_func_isempty)},
{ C_STRING_WITH_LEN("ISNULL"), BUILDER(Create_func_isnull)}, { { C_STRING_WITH_LEN("ISNULL") }, BUILDER(Create_func_isnull)},
{ C_STRING_WITH_LEN("ISSIMPLE"), GEOM_BUILDER(Create_func_issimple)}, { { C_STRING_WITH_LEN("ISSIMPLE") }, GEOM_BUILDER(Create_func_issimple)},
{ C_STRING_WITH_LEN("IS_FREE_LOCK"), BUILDER(Create_func_is_free_lock)}, { { C_STRING_WITH_LEN("IS_FREE_LOCK") }, BUILDER(Create_func_is_free_lock)},
{ C_STRING_WITH_LEN("IS_USED_LOCK"), BUILDER(Create_func_is_used_lock)}, { { C_STRING_WITH_LEN("IS_USED_LOCK") }, BUILDER(Create_func_is_used_lock)},
{ C_STRING_WITH_LEN("LAST_DAY"), BUILDER(Create_func_last_day)}, { { C_STRING_WITH_LEN("LAST_DAY") }, BUILDER(Create_func_last_day)},
{ C_STRING_WITH_LEN("LAST_INSERT_ID"), BUILDER(Create_func_last_insert_id)}, { { C_STRING_WITH_LEN("LAST_INSERT_ID") }, BUILDER(Create_func_last_insert_id)},
{ C_STRING_WITH_LEN("LCASE"), BUILDER(Create_func_lcase)}, { { C_STRING_WITH_LEN("LCASE") }, BUILDER(Create_func_lcase)},
{ C_STRING_WITH_LEN("LEAST"), BUILDER(Create_func_least)}, { { C_STRING_WITH_LEN("LEAST") }, BUILDER(Create_func_least)},
{ C_STRING_WITH_LEN("LENGTH"), BUILDER(Create_func_length)}, { { C_STRING_WITH_LEN("LENGTH") }, BUILDER(Create_func_length)},
{ C_STRING_WITH_LEN("LINEFROMTEXT"), GEOM_BUILDER(Create_func_geometry_from_text)}, { { C_STRING_WITH_LEN("LINEFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
{ C_STRING_WITH_LEN("LINEFROMWKB"), GEOM_BUILDER(Create_func_geometry_from_wkb)}, { { C_STRING_WITH_LEN("LINEFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ C_STRING_WITH_LEN("LINESTRINGFROMTEXT"), GEOM_BUILDER(Create_func_geometry_from_text)}, { { C_STRING_WITH_LEN("LINESTRINGFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
{ C_STRING_WITH_LEN("LINESTRINGFROMWKB"), GEOM_BUILDER(Create_func_geometry_from_wkb)}, { { C_STRING_WITH_LEN("LINESTRINGFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ C_STRING_WITH_LEN("LN"), BUILDER(Create_func_ln)}, { { C_STRING_WITH_LEN("LN") }, BUILDER(Create_func_ln)},
{ C_STRING_WITH_LEN("LOAD_FILE"), BUILDER(Create_func_load_file)}, { { C_STRING_WITH_LEN("LOAD_FILE") }, BUILDER(Create_func_load_file)},
{ C_STRING_WITH_LEN("LOCATE"), BUILDER(Create_func_locate)}, { { C_STRING_WITH_LEN("LOCATE") }, BUILDER(Create_func_locate)},
{ C_STRING_WITH_LEN("LOG"), BUILDER(Create_func_log)}, { { C_STRING_WITH_LEN("LOG") }, BUILDER(Create_func_log)},
{ C_STRING_WITH_LEN("LOG10"), BUILDER(Create_func_log10)}, { { C_STRING_WITH_LEN("LOG10") }, BUILDER(Create_func_log10)},
{ C_STRING_WITH_LEN("LOG2"), BUILDER(Create_func_log2)}, { { C_STRING_WITH_LEN("LOG2") }, BUILDER(Create_func_log2)},
{ C_STRING_WITH_LEN("LOWER"), BUILDER(Create_func_lcase)}, { { C_STRING_WITH_LEN("LOWER") }, BUILDER(Create_func_lcase)},
{ C_STRING_WITH_LEN("LPAD"), BUILDER(Create_func_lpad)}, { { C_STRING_WITH_LEN("LPAD") }, BUILDER(Create_func_lpad)},
{ C_STRING_WITH_LEN("LTRIM"), BUILDER(Create_func_ltrim)}, { { C_STRING_WITH_LEN("LTRIM") }, BUILDER(Create_func_ltrim)},
{ C_STRING_WITH_LEN("MAKEDATE"), BUILDER(Create_func_makedate)}, { { C_STRING_WITH_LEN("MAKEDATE") }, BUILDER(Create_func_makedate)},
{ C_STRING_WITH_LEN("MAKETIME"), BUILDER(Create_func_maketime)}, { { C_STRING_WITH_LEN("MAKETIME") }, BUILDER(Create_func_maketime)},
{ C_STRING_WITH_LEN("MAKE_SET"), BUILDER(Create_func_make_set)}, { { C_STRING_WITH_LEN("MAKE_SET") }, BUILDER(Create_func_make_set)},
{ C_STRING_WITH_LEN("MASTER_POS_WAIT"), BUILDER(Create_func_master_pos_wait)}, { { C_STRING_WITH_LEN("MASTER_POS_WAIT") }, BUILDER(Create_func_master_pos_wait)},
{ C_STRING_WITH_LEN("MBRCONTAINS"), GEOM_BUILDER(Create_func_contains)}, { { C_STRING_WITH_LEN("MBRCONTAINS") }, GEOM_BUILDER(Create_func_contains)},
{ C_STRING_WITH_LEN("MBRDISJOINT"), GEOM_BUILDER(Create_func_disjoint)}, { { C_STRING_WITH_LEN("MBRDISJOINT") }, GEOM_BUILDER(Create_func_disjoint)},
{ C_STRING_WITH_LEN("MBREQUAL"), GEOM_BUILDER(Create_func_equals)}, { { C_STRING_WITH_LEN("MBREQUAL") }, GEOM_BUILDER(Create_func_equals)},
{ C_STRING_WITH_LEN("MBRINTERSECTS"), GEOM_BUILDER(Create_func_intersects)}, { { C_STRING_WITH_LEN("MBRINTERSECTS") }, GEOM_BUILDER(Create_func_intersects)},
{ C_STRING_WITH_LEN("MBROVERLAPS"), GEOM_BUILDER(Create_func_overlaps)}, { { C_STRING_WITH_LEN("MBROVERLAPS") }, GEOM_BUILDER(Create_func_overlaps)},
{ C_STRING_WITH_LEN("MBRTOUCHES"), GEOM_BUILDER(Create_func_touches)}, { { C_STRING_WITH_LEN("MBRTOUCHES") }, GEOM_BUILDER(Create_func_touches)},
{ C_STRING_WITH_LEN("MBRWITHIN"), GEOM_BUILDER(Create_func_within)}, { { C_STRING_WITH_LEN("MBRWITHIN") }, GEOM_BUILDER(Create_func_within)},
{ C_STRING_WITH_LEN("MD5"), BUILDER(Create_func_md5)}, { { C_STRING_WITH_LEN("MD5") }, BUILDER(Create_func_md5)},
{ C_STRING_WITH_LEN("MLINEFROMTEXT"), GEOM_BUILDER(Create_func_geometry_from_text)}, { { C_STRING_WITH_LEN("MLINEFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
{ C_STRING_WITH_LEN("MLINEFROMWKB"), GEOM_BUILDER(Create_func_geometry_from_wkb)}, { { C_STRING_WITH_LEN("MLINEFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ C_STRING_WITH_LEN("MONTHNAME"), BUILDER(Create_func_monthname)}, { { C_STRING_WITH_LEN("MONTHNAME") }, BUILDER(Create_func_monthname)},
{ C_STRING_WITH_LEN("MPOINTFROMTEXT"), GEOM_BUILDER(Create_func_geometry_from_text)}, { { C_STRING_WITH_LEN("MPOINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
{ C_STRING_WITH_LEN("MPOINTFROMWKB"), GEOM_BUILDER(Create_func_geometry_from_wkb)}, { { C_STRING_WITH_LEN("MPOINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ C_STRING_WITH_LEN("MPOLYFROMTEXT"), GEOM_BUILDER(Create_func_geometry_from_text)}, { { C_STRING_WITH_LEN("MPOLYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
{ C_STRING_WITH_LEN("MPOLYFROMWKB"), GEOM_BUILDER(Create_func_geometry_from_wkb)}, { { C_STRING_WITH_LEN("MPOLYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ C_STRING_WITH_LEN("MULTILINESTRINGFROMTEXT"), GEOM_BUILDER(Create_func_geometry_from_text)}, { { C_STRING_WITH_LEN("MULTILINESTRINGFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
{ C_STRING_WITH_LEN("MULTILINESTRINGFROMWKB"), GEOM_BUILDER(Create_func_geometry_from_wkb)}, { { C_STRING_WITH_LEN("MULTILINESTRINGFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ C_STRING_WITH_LEN("MULTIPOINTFROMTEXT"), GEOM_BUILDER(Create_func_geometry_from_text)}, { { C_STRING_WITH_LEN("MULTIPOINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
{ C_STRING_WITH_LEN("MULTIPOINTFROMWKB"), GEOM_BUILDER(Create_func_geometry_from_wkb)}, { { C_STRING_WITH_LEN("MULTIPOINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ C_STRING_WITH_LEN("MULTIPOLYGONFROMTEXT"), GEOM_BUILDER(Create_func_geometry_from_text)}, { { C_STRING_WITH_LEN("MULTIPOLYGONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
{ C_STRING_WITH_LEN("MULTIPOLYGONFROMWKB"), GEOM_BUILDER(Create_func_geometry_from_wkb)}, { { C_STRING_WITH_LEN("MULTIPOLYGONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ C_STRING_WITH_LEN("NAME_CONST"), BUILDER(Create_func_name_const)}, { { C_STRING_WITH_LEN("NAME_CONST") }, BUILDER(Create_func_name_const)},
{ C_STRING_WITH_LEN("NULLIF"), BUILDER(Create_func_nullif)}, { { C_STRING_WITH_LEN("NULLIF") }, BUILDER(Create_func_nullif)},
{ C_STRING_WITH_LEN("NUMGEOMETRIES"), GEOM_BUILDER(Create_func_numgeometries)}, { { C_STRING_WITH_LEN("NUMGEOMETRIES") }, GEOM_BUILDER(Create_func_numgeometries)},
{ C_STRING_WITH_LEN("NUMINTERIORRINGS"), GEOM_BUILDER(Create_func_numinteriorring)}, { { C_STRING_WITH_LEN("NUMINTERIORRINGS") }, GEOM_BUILDER(Create_func_numinteriorring)},
{ C_STRING_WITH_LEN("NUMPOINTS"), GEOM_BUILDER(Create_func_numpoints)}, { { C_STRING_WITH_LEN("NUMPOINTS") }, GEOM_BUILDER(Create_func_numpoints)},
{ C_STRING_WITH_LEN("OCT"), BUILDER(Create_func_oct)}, { { C_STRING_WITH_LEN("OCT") }, BUILDER(Create_func_oct)},
{ C_STRING_WITH_LEN("OCTET_LENGTH"), BUILDER(Create_func_length)}, { { C_STRING_WITH_LEN("OCTET_LENGTH") }, BUILDER(Create_func_length)},
{ C_STRING_WITH_LEN("ORD"), BUILDER(Create_func_ord)}, { { C_STRING_WITH_LEN("ORD") }, BUILDER(Create_func_ord)},
{ C_STRING_WITH_LEN("OVERLAPS"), GEOM_BUILDER(Create_func_overlaps)}, { { C_STRING_WITH_LEN("OVERLAPS") }, GEOM_BUILDER(Create_func_overlaps)},
{ C_STRING_WITH_LEN("PERIOD_ADD"), BUILDER(Create_func_period_add)}, { { C_STRING_WITH_LEN("PERIOD_ADD") }, BUILDER(Create_func_period_add)},
{ C_STRING_WITH_LEN("PERIOD_DIFF"), BUILDER(Create_func_period_diff)}, { { C_STRING_WITH_LEN("PERIOD_DIFF") }, BUILDER(Create_func_period_diff)},
{ C_STRING_WITH_LEN("PI"), BUILDER(Create_func_pi)}, { { C_STRING_WITH_LEN("PI") }, BUILDER(Create_func_pi)},
{ C_STRING_WITH_LEN("POINTFROMTEXT"), GEOM_BUILDER(Create_func_geometry_from_text)}, { { C_STRING_WITH_LEN("POINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
{ C_STRING_WITH_LEN("POINTFROMWKB"), GEOM_BUILDER(Create_func_geometry_from_wkb)}, { { C_STRING_WITH_LEN("POINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ C_STRING_WITH_LEN("POINTN"), GEOM_BUILDER(Create_func_pointn)}, { { C_STRING_WITH_LEN("POINTN") }, GEOM_BUILDER(Create_func_pointn)},
{ C_STRING_WITH_LEN("POLYFROMTEXT"), GEOM_BUILDER(Create_func_geometry_from_text)}, { { C_STRING_WITH_LEN("POLYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
{ C_STRING_WITH_LEN("POLYFROMWKB"), GEOM_BUILDER(Create_func_geometry_from_wkb)}, { { C_STRING_WITH_LEN("POLYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ C_STRING_WITH_LEN("POLYGONFROMTEXT"), GEOM_BUILDER(Create_func_geometry_from_text)}, { { C_STRING_WITH_LEN("POLYGONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
{ C_STRING_WITH_LEN("POLYGONFROMWKB"), GEOM_BUILDER(Create_func_geometry_from_wkb)}, { { C_STRING_WITH_LEN("POLYGONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ C_STRING_WITH_LEN("POW"), BUILDER(Create_func_pow)}, { { C_STRING_WITH_LEN("POW") }, BUILDER(Create_func_pow)},
{ C_STRING_WITH_LEN("POWER"), BUILDER(Create_func_pow)}, { { C_STRING_WITH_LEN("POWER") }, BUILDER(Create_func_pow)},
{ C_STRING_WITH_LEN("QUOTE"), BUILDER(Create_func_quote)}, { { C_STRING_WITH_LEN("QUOTE") }, BUILDER(Create_func_quote)},
{ C_STRING_WITH_LEN("RADIANS"), BUILDER(Create_func_radians)}, { { C_STRING_WITH_LEN("RADIANS") }, BUILDER(Create_func_radians)},
{ C_STRING_WITH_LEN("RAND"), BUILDER(Create_func_rand)}, { { C_STRING_WITH_LEN("RAND") }, BUILDER(Create_func_rand)},
{ C_STRING_WITH_LEN("RELEASE_LOCK"), BUILDER(Create_func_release_lock)}, { { C_STRING_WITH_LEN("RELEASE_LOCK") }, BUILDER(Create_func_release_lock)},
{ C_STRING_WITH_LEN("REVERSE"), BUILDER(Create_func_reverse)}, { { C_STRING_WITH_LEN("REVERSE") }, BUILDER(Create_func_reverse)},
{ C_STRING_WITH_LEN("ROUND"), BUILDER(Create_func_round)}, { { C_STRING_WITH_LEN("ROUND") }, BUILDER(Create_func_round)},
{ C_STRING_WITH_LEN("ROW_COUNT"), BUILDER(Create_func_row_count)}, { { C_STRING_WITH_LEN("ROW_COUNT") }, BUILDER(Create_func_row_count)},
{ C_STRING_WITH_LEN("RPAD"), BUILDER(Create_func_rpad)}, { { C_STRING_WITH_LEN("RPAD") }, BUILDER(Create_func_rpad)},
{ C_STRING_WITH_LEN("RTRIM"), BUILDER(Create_func_rtrim)}, { { C_STRING_WITH_LEN("RTRIM") }, BUILDER(Create_func_rtrim)},
{ C_STRING_WITH_LEN("SEC_TO_TIME"), BUILDER(Create_func_sec_to_time)}, { { C_STRING_WITH_LEN("SEC_TO_TIME") }, BUILDER(Create_func_sec_to_time)},
{ C_STRING_WITH_LEN("SHA"), BUILDER(Create_func_sha)}, { { C_STRING_WITH_LEN("SHA") }, BUILDER(Create_func_sha)},
{ C_STRING_WITH_LEN("SHA1"), BUILDER(Create_func_sha)}, { { C_STRING_WITH_LEN("SHA1") }, BUILDER(Create_func_sha)},
{ C_STRING_WITH_LEN("SIGN"), BUILDER(Create_func_sign)}, { { C_STRING_WITH_LEN("SIGN") }, BUILDER(Create_func_sign)},
{ C_STRING_WITH_LEN("SIN"), BUILDER(Create_func_sin)}, { { C_STRING_WITH_LEN("SIN") }, BUILDER(Create_func_sin)},
{ C_STRING_WITH_LEN("SLEEP"), BUILDER(Create_func_sleep)}, { { C_STRING_WITH_LEN("SLEEP") }, BUILDER(Create_func_sleep)},
{ C_STRING_WITH_LEN("SOUNDEX"), BUILDER(Create_func_soundex)}, { { C_STRING_WITH_LEN("SOUNDEX") }, BUILDER(Create_func_soundex)},
{ C_STRING_WITH_LEN("SPACE"), BUILDER(Create_func_space)}, { { C_STRING_WITH_LEN("SPACE") }, BUILDER(Create_func_space)},
{ C_STRING_WITH_LEN("SQRT"), BUILDER(Create_func_sqrt)}, { { C_STRING_WITH_LEN("SQRT") }, BUILDER(Create_func_sqrt)},
{ C_STRING_WITH_LEN("SRID"), GEOM_BUILDER(Create_func_srid)}, { { C_STRING_WITH_LEN("SRID") }, GEOM_BUILDER(Create_func_srid)},
{ C_STRING_WITH_LEN("STARTPOINT"), GEOM_BUILDER(Create_func_startpoint)}, { { C_STRING_WITH_LEN("STARTPOINT") }, GEOM_BUILDER(Create_func_startpoint)},
{ C_STRING_WITH_LEN("STRCMP"), BUILDER(Create_func_strcmp)}, { { C_STRING_WITH_LEN("STRCMP") }, BUILDER(Create_func_strcmp)},
{ C_STRING_WITH_LEN("STR_TO_DATE"), BUILDER(Create_func_str_to_date)}, { { C_STRING_WITH_LEN("STR_TO_DATE") }, BUILDER(Create_func_str_to_date)},
{ C_STRING_WITH_LEN("SUBSTRING_INDEX"), BUILDER(Create_func_substr_index)}, { { C_STRING_WITH_LEN("SUBSTRING_INDEX") }, BUILDER(Create_func_substr_index)},
{ C_STRING_WITH_LEN("SUBTIME"), BUILDER(Create_func_subtime)}, { { C_STRING_WITH_LEN("SUBTIME") }, BUILDER(Create_func_subtime)},
{ C_STRING_WITH_LEN("TAN"), BUILDER(Create_func_tan)}, { { C_STRING_WITH_LEN("TAN") }, BUILDER(Create_func_tan)},
{ C_STRING_WITH_LEN("TIMEDIFF"), BUILDER(Create_func_timediff)}, { { C_STRING_WITH_LEN("TIMEDIFF") }, BUILDER(Create_func_timediff)},
{ C_STRING_WITH_LEN("TIME_FORMAT"), BUILDER(Create_func_time_format)}, { { C_STRING_WITH_LEN("TIME_FORMAT") }, BUILDER(Create_func_time_format)},
{ C_STRING_WITH_LEN("TIME_TO_SEC"), BUILDER(Create_func_time_to_sec)}, { { C_STRING_WITH_LEN("TIME_TO_SEC") }, BUILDER(Create_func_time_to_sec)},
{ C_STRING_WITH_LEN("TOUCHES"), GEOM_BUILDER(Create_func_touches)}, { { C_STRING_WITH_LEN("TOUCHES") }, GEOM_BUILDER(Create_func_touches)},
{ C_STRING_WITH_LEN("TO_DAYS"), BUILDER(Create_func_to_days)}, { { C_STRING_WITH_LEN("TO_DAYS") }, BUILDER(Create_func_to_days)},
{ C_STRING_WITH_LEN("UCASE"), BUILDER(Create_func_ucase)}, { { C_STRING_WITH_LEN("UCASE") }, BUILDER(Create_func_ucase)},
{ C_STRING_WITH_LEN("UNCOMPRESS"), BUILDER(Create_func_uncompress)}, { { C_STRING_WITH_LEN("UNCOMPRESS") }, BUILDER(Create_func_uncompress)},
{ C_STRING_WITH_LEN("UNCOMPRESSED_LENGTH"), BUILDER(Create_func_uncompressed_length)}, { { C_STRING_WITH_LEN("UNCOMPRESSED_LENGTH") }, BUILDER(Create_func_uncompressed_length)},
{ C_STRING_WITH_LEN("UNHEX"), BUILDER(Create_func_unhex)}, { { C_STRING_WITH_LEN("UNHEX") }, BUILDER(Create_func_unhex)},
{ C_STRING_WITH_LEN("UNIX_TIMESTAMP"), BUILDER(Create_func_unix_timestamp)}, { { C_STRING_WITH_LEN("UNIX_TIMESTAMP") }, BUILDER(Create_func_unix_timestamp)},
{ C_STRING_WITH_LEN("UPDATEXML"), BUILDER(Create_func_xml_update)}, { { C_STRING_WITH_LEN("UPDATEXML") }, BUILDER(Create_func_xml_update)},
{ C_STRING_WITH_LEN("UPPER"), BUILDER(Create_func_ucase)}, { { C_STRING_WITH_LEN("UPPER") }, BUILDER(Create_func_ucase)},
{ C_STRING_WITH_LEN("UUID"), BUILDER(Create_func_uuid)}, { { C_STRING_WITH_LEN("UUID") }, BUILDER(Create_func_uuid)},
{ C_STRING_WITH_LEN("VERSION"), BUILDER(Create_func_version)}, { { C_STRING_WITH_LEN("VERSION") }, BUILDER(Create_func_version)},
{ C_STRING_WITH_LEN("WEEKDAY"), BUILDER(Create_func_weekday)}, { { C_STRING_WITH_LEN("WEEKDAY") }, BUILDER(Create_func_weekday)},
{ C_STRING_WITH_LEN("WEEKOFYEAR"), BUILDER(Create_func_weekofyear)}, { { C_STRING_WITH_LEN("WEEKOFYEAR") }, BUILDER(Create_func_weekofyear)},
{ C_STRING_WITH_LEN("WITHIN"), GEOM_BUILDER(Create_func_within)}, { { C_STRING_WITH_LEN("WITHIN") }, GEOM_BUILDER(Create_func_within)},
{ C_STRING_WITH_LEN("X"), GEOM_BUILDER(Create_func_x)}, { { C_STRING_WITH_LEN("X") }, GEOM_BUILDER(Create_func_x)},
{ C_STRING_WITH_LEN("Y"), GEOM_BUILDER(Create_func_y)}, { { C_STRING_WITH_LEN("Y") }, GEOM_BUILDER(Create_func_y)},
{ C_STRING_WITH_LEN("YEARWEEK"), BUILDER(Create_func_year_week)}, { { C_STRING_WITH_LEN("YEARWEEK") }, BUILDER(Create_func_year_week)},
{ {0, 0}, NULL} { {0, 0}, NULL}
}; };

View File

@ -4905,7 +4905,7 @@ Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
component_name= &component; // Empty string component_name= &component; // Empty string
} }
if (!(var= find_sys_var(base_name->str, base_name->length))) if (!(var= find_sys_var(thd, base_name->str, base_name->length)))
return 0; return 0;
if (component.str) if (component.str)
{ {

View File

@ -2479,7 +2479,7 @@ bool Item_sum_count_distinct::setup(THD *thd)
table->file->extra(HA_EXTRA_NO_ROWS); // Don't update rows table->file->extra(HA_EXTRA_NO_ROWS); // Don't update rows
table->no_rows=1; table->no_rows=1;
if (table->s->db_type == heap_hton) if (table->s->db_type() == heap_hton)
{ {
/* /*
No blobs, otherwise it would have been MyISAM: set up a compare No blobs, otherwise it would have been MyISAM: set up a compare

View File

@ -1916,8 +1916,8 @@ shutdown the MySQL server and restart it.", name, errno);
} }
MYSQL_LOG::MYSQL_LOG() MYSQL_LOG::MYSQL_LOG()
: name(0), log_type(LOG_UNKNOWN), log_state(LOG_CLOSED), write_error(FALSE), : name(0), write_error(FALSE), inited(FALSE), log_type(LOG_UNKNOWN),
inited(FALSE) log_state(LOG_CLOSED)
{ {
/* /*
We don't want to initialize LOCK_Log here as such initialization depends on We don't want to initialize LOCK_Log here as such initialization depends on

View File

@ -38,6 +38,7 @@
#include <queues.h> #include <queues.h>
#include "sql_bitmap.h" #include "sql_bitmap.h"
#include "sql_array.h" #include "sql_array.h"
#include "sql_plugin.h"
#include "scheduler.h" #include "scheduler.h"
/* TODO convert all these three maps to Bitmap classes */ /* TODO convert all these three maps to Bitmap classes */
@ -545,11 +546,6 @@ inline THD *_current_thd(void)
} }
#define current_thd _current_thd() #define current_thd _current_thd()
/* below functions are required for plugins as THD class is opaque */
my_bool thd_in_lock_tables(const THD *thd);
my_bool thd_tablespace_op(const THD *thd);
const char *thd_proc_info(THD *thd, const char *info);
void **thd_ha_data(const THD *thd, const struct handlerton *hton);
/* /*
External variables External variables
@ -564,7 +560,6 @@ typedef my_bool (*qc_engine_callback)(THD *thd, char *table_key,
#include "sql_list.h" #include "sql_list.h"
#include "sql_map.h" #include "sql_map.h"
#include "my_decimal.h" #include "my_decimal.h"
#include "sql_plugin.h"
#include "handler.h" #include "handler.h"
#include "parse_file.h" #include "parse_file.h"
#include "table.h" #include "table.h"
@ -1113,6 +1108,7 @@ int add_status_vars(SHOW_VAR *list);
void remove_status_vars(SHOW_VAR *list); void remove_status_vars(SHOW_VAR *list);
void init_status_vars(); void init_status_vars();
void free_status_vars(); void free_status_vars();
void reset_status_vars();
/* information schema */ /* information schema */
extern LEX_STRING INFORMATION_SCHEMA_NAME; extern LEX_STRING INFORMATION_SCHEMA_NAME;
@ -1709,6 +1705,7 @@ extern pthread_mutex_t LOCK_server_started;
extern pthread_cond_t COND_server_started; extern pthread_cond_t COND_server_started;
extern int mysqld_server_started; extern int mysqld_server_started;
extern rw_lock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave; extern rw_lock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
extern rw_lock_t LOCK_system_variables_hash;
extern pthread_cond_t COND_refresh, COND_thread_count, COND_manager; extern pthread_cond_t COND_refresh, COND_thread_count, COND_manager;
extern pthread_cond_t COND_global_read_lock; extern pthread_cond_t COND_global_read_lock;
extern pthread_attr_t connection_attrib; extern pthread_attr_t connection_attrib;
@ -1717,7 +1714,7 @@ extern I_List<NAMED_LIST> key_caches;
extern MY_BITMAP temp_pool; extern MY_BITMAP temp_pool;
extern String my_empty_string; extern String my_empty_string;
extern const String my_null_string; extern const String my_null_string;
extern SHOW_VAR init_vars[], status_vars[], internal_vars[]; extern SHOW_VAR status_vars[];
extern struct system_variables global_system_variables; extern struct system_variables global_system_variables;
extern struct system_variables max_system_variables; extern struct system_variables max_system_variables;
extern struct system_status_var global_status_var; extern struct system_status_var global_status_var;
@ -1740,11 +1737,6 @@ extern TYPELIB log_output_typelib;
/* optional things, have_* variables */ /* 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 *partition_hton;
extern handlerton *myisam_hton; extern handlerton *myisam_hton;
extern handlerton *heap_hton; extern handlerton *heap_hton;

View File

@ -30,22 +30,13 @@
#include "rpl_injector.h" #include "rpl_injector.h"
#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 #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
#define OPT_NDBCLUSTER_DEFAULT 0
#if defined(NOT_ENOUGH_TESTED) \ #if defined(NOT_ENOUGH_TESTED) \
&& defined(NDB_SHM_TRANSPORTER) && MYSQL_VERSION_ID >= 50000 && defined(NDB_SHM_TRANSPORTER) && MYSQL_VERSION_ID >= 50000
#define OPT_NDB_SHM_DEFAULT 1 #define OPT_NDB_SHM_DEFAULT 1
#else #else
#define OPT_NDB_SHM_DEFAULT 0 #define OPT_NDB_SHM_DEFAULT 0
#endif #endif
#else
#define OPT_NDBCLUSTER_DEFAULT 0
#endif #endif
#ifndef DEFAULT_SKIP_THREAD_PRIORITY #ifndef DEFAULT_SKIP_THREAD_PRIORITY
@ -322,7 +313,6 @@ static bool lower_case_table_names_used= 0;
static bool volatile select_thread_in_use, signal_thread_in_use; static bool volatile select_thread_in_use, signal_thread_in_use;
static bool volatile ready_to_exit; static bool volatile ready_to_exit;
static my_bool opt_debugging= 0, opt_external_locking= 0, opt_console= 0; 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 my_bool opt_short_log_format= 0;
static uint kill_cached_threads, wake_thread; static uint kill_cached_threads, wake_thread;
static ulong killed_threads, thread_created; static ulong killed_threads, thread_created;
@ -366,7 +356,6 @@ my_bool opt_local_infile, opt_slave_compressed_protocol;
my_bool opt_safe_user_create = 0, opt_no_mix_types = 0; 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_show_slave_auth_info, opt_sql_bin_update = 0;
my_bool opt_log_slave_updates= 0; my_bool opt_log_slave_updates= 0;
my_bool opt_innodb;
bool slave_warning_issued = false; bool slave_warning_issued = false;
/* /*
@ -376,45 +365,6 @@ handlerton *heap_hton;
handlerton *myisam_hton; handlerton *myisam_hton;
handlerton *partition_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_rollback_on_timeout,
innobase_stats_on_metadata,
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
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
const char *opt_ndbcluster_connectstring= 0; const char *opt_ndbcluster_connectstring= 0;
const char *opt_ndb_connectstring= 0; const char *opt_ndb_connectstring= 0;
@ -600,6 +550,7 @@ pthread_mutex_t LOCK_prepared_stmt_count;
pthread_mutex_t LOCK_des_key_file; pthread_mutex_t LOCK_des_key_file;
#endif #endif
rw_lock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave; rw_lock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
rw_lock_t LOCK_system_variables_hash;
pthread_cond_t COND_refresh, COND_thread_count, COND_global_read_lock; pthread_cond_t COND_refresh, COND_thread_count, COND_global_read_lock;
pthread_t signal_thread; pthread_t signal_thread;
pthread_attr_t connection_attrib; pthread_attr_t connection_attrib;
@ -631,6 +582,7 @@ static ulong opt_specialflag, opt_myisam_block_size;
static char *opt_update_logname, *opt_binlog_index_name; static char *opt_update_logname, *opt_binlog_index_name;
static char *opt_tc_heuristic_recover; static char *opt_tc_heuristic_recover;
static char *mysql_home_ptr, *pidfile_name_ptr; static char *mysql_home_ptr, *pidfile_name_ptr;
static int defaults_argc;
static char **defaults_argv; static char **defaults_argv;
static char *opt_bin_logname; static char *opt_bin_logname;
@ -723,7 +675,9 @@ struct st_VioSSLFd *ssl_acceptor_fd;
pthread_handler_t signal_hand(void *arg); pthread_handler_t signal_hand(void *arg);
static void mysql_init_variables(void); static void mysql_init_variables(void);
static void get_options(int argc,char **argv); static void get_options(int *argc,char **argv);
static my_bool get_one_option(int, const struct my_option *, char *);
static void usage(void);
static void set_server_version(void); static void set_server_version(void);
static int init_thread_environment(); static int init_thread_environment();
static char *get_relative_path(const char *path); static char *get_relative_path(const char *path);
@ -1171,6 +1125,8 @@ extern "C" void unireg_abort(int exit_code)
DBUG_ENTER("unireg_abort"); DBUG_ENTER("unireg_abort");
if (exit_code) if (exit_code)
sql_print_error("Aborting\n"); sql_print_error("Aborting\n");
else if (opt_help)
usage();
clean_up(exit_code || !opt_bootstrap); /* purecov: inspected */ clean_up(exit_code || !opt_bootstrap); /* purecov: inspected */
DBUG_PRINT("quit",("done with cleanup in unireg_abort")); DBUG_PRINT("quit",("done with cleanup in unireg_abort"));
wait_for_signal_thread_to_end(); wait_for_signal_thread_to_end();
@ -1356,6 +1312,7 @@ static void clean_up_mutexes()
(void) rwlock_destroy(&LOCK_sys_init_connect); (void) rwlock_destroy(&LOCK_sys_init_connect);
(void) rwlock_destroy(&LOCK_sys_init_slave); (void) rwlock_destroy(&LOCK_sys_init_slave);
(void) pthread_mutex_destroy(&LOCK_global_system_variables); (void) pthread_mutex_destroy(&LOCK_global_system_variables);
(void) rwlock_destroy(&LOCK_system_variables_hash);
(void) pthread_mutex_destroy(&LOCK_global_read_lock); (void) pthread_mutex_destroy(&LOCK_global_read_lock);
(void) pthread_mutex_destroy(&LOCK_uuid_generator); (void) pthread_mutex_destroy(&LOCK_uuid_generator);
(void) pthread_mutex_destroy(&LOCK_prepared_stmt_count); (void) pthread_mutex_destroy(&LOCK_prepared_stmt_count);
@ -2356,7 +2313,7 @@ static void init_signals(void)
sigaddset(&set,SIGTSTP); sigaddset(&set,SIGTSTP);
#endif #endif
if (thd_lib_detected != THD_LIB_LT) if (thd_lib_detected != THD_LIB_LT)
sigaddset(&set,THR_SERVER_ALARM); sigaddset(&set,THR_SERVER_ALARM);
if (test_flags & TEST_SIGINT) if (test_flags & TEST_SIGINT)
{ {
// May be SIGINT // May be SIGINT
@ -2714,7 +2671,7 @@ static bool init_global_datetime_format(timestamp_type format_type,
static int init_common_variables(const char *conf_file_name, int argc, static int init_common_variables(const char *conf_file_name, int argc,
char **argv, const char **groups) char **argv, const char **groups)
{ {
char buff[FN_REFLEN]; char buff[FN_REFLEN], *s;
umask(((~my_umask) & 0666)); umask(((~my_umask) & 0666));
my_decimal_set_zero(&decimal_zero); // set decimal_zero constant; my_decimal_set_zero(&decimal_zero); // set decimal_zero constant;
tzset(); // Set tzname tzset(); // Set tzname
@ -2766,7 +2723,7 @@ static int init_common_variables(const char *conf_file_name, int argc,
strmake(pidfile_name, STRING_WITH_LEN("mysql")); strmake(pidfile_name, STRING_WITH_LEN("mysql"));
} }
else else
strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5); strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
strmov(fn_ext(pidfile_name),".pid"); // Add proper extension strmov(fn_ext(pidfile_name),".pid"); // Add proper extension
/* /*
@ -2780,7 +2737,8 @@ static int init_common_variables(const char *conf_file_name, int argc,
load_defaults(conf_file_name, groups, &argc, &argv); load_defaults(conf_file_name, groups, &argc, &argv);
defaults_argv=argv; defaults_argv=argv;
get_options(argc,argv); defaults_argc=argc;
get_options(&defaults_argc, defaults_argv);
set_server_version(); set_server_version();
DBUG_PRINT("info",("%s Ver %s for %s on %s\n",my_progname, DBUG_PRINT("info",("%s Ver %s for %s on %s\n",my_progname,
@ -2792,10 +2750,6 @@ static int init_common_variables(const char *conf_file_name, int argc,
{ {
my_use_large_pages= 1; my_use_large_pages= 1;
my_large_page_size= opt_large_page_size; 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 */ #endif /* HAVE_LARGE_PAGES */
@ -2858,7 +2812,12 @@ static int init_common_variables(const char *conf_file_name, int argc,
if (item_create_init()) if (item_create_init())
return 1; return 1;
item_init(); 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; mysys_uses_curses=0;
#ifdef USE_REGEX #ifdef USE_REGEX
my_regex_init(&my_charset_latin1); my_regex_init(&my_charset_latin1);
@ -2955,15 +2914,13 @@ static int init_common_variables(const char *conf_file_name, int argc,
"--log-slow-queries option, log tables are used. " "--log-slow-queries option, log tables are used. "
"To enable logging to files use the --log-output option."); "To enable logging to files use the --log-output option.");
if (!opt_logname) s= opt_logname ? opt_logname : make_default_log_name(buff, ".log");
opt_logname= make_default_log_name(buff, ".log"); sys_var_general_log_path.value= my_strdup(s, MYF(0));
sys_var_general_log_path.value= my_strdup(opt_logname, MYF(0)); sys_var_general_log_path.value_length= strlen(s);
sys_var_general_log_path.value_length= strlen(opt_logname);
if (!opt_slow_logname) s= opt_slow_logname ? opt_slow_logname : make_default_log_name(buff, "-slow.log");
opt_slow_logname= make_default_log_name(buff, "-slow.log"); sys_var_slow_log_path.value= my_strdup(s, MYF(0));
sys_var_slow_log_path.value= my_strdup(opt_slow_logname, MYF(0)); sys_var_slow_log_path.value_length= strlen(s);
sys_var_slow_log_path.value_length= strlen(opt_slow_logname);
if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1)) if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1))
return 1; return 1;
@ -3042,6 +2999,7 @@ static int init_thread_environment()
(void) pthread_mutex_init(&LOCK_user_conn, MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_user_conn, MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_active_mi, MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_active_mi, MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_global_system_variables, MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_global_system_variables, MY_MUTEX_INIT_FAST);
(void) my_rwlock_init(&LOCK_system_variables_hash, NULL);
(void) pthread_mutex_init(&LOCK_global_read_lock, MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_global_read_lock, MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_prepared_stmt_count, MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_prepared_stmt_count, MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_uuid_generator, MY_MUTEX_INIT_FAST); (void) pthread_mutex_init(&LOCK_uuid_generator, MY_MUTEX_INIT_FAST);
@ -3316,13 +3274,13 @@ with --log-bin instead.");
} }
if (!opt_bin_log) if (!opt_bin_log)
if (opt_binlog_format_id != BINLOG_FORMAT_UNSPEC) if (opt_binlog_format_id != BINLOG_FORMAT_UNSPEC)
{ {
sql_print_error("You need to use --log-bin to make " sql_print_error("You need to use --log-bin to make "
"--binlog-format work."); "--binlog-format work.");
unireg_abort(1); unireg_abort(1);
} }
else else
{ {
global_system_variables.binlog_format= BINLOG_FORMAT_UNSPEC; global_system_variables.binlog_format= BINLOG_FORMAT_UNSPEC;
} }
else else
@ -3331,7 +3289,7 @@ with --log-bin instead.");
else else
{ {
DBUG_ASSERT(global_system_variables.binlog_format != BINLOG_FORMAT_UNSPEC); DBUG_ASSERT(global_system_variables.binlog_format != BINLOG_FORMAT_UNSPEC);
} }
/* Check that we have not let the format to unspecified at this point */ /* Check that we have not let the format to unspecified at this point */
DBUG_ASSERT((uint)global_system_variables.binlog_format <= DBUG_ASSERT((uint)global_system_variables.binlog_format <=
@ -3385,10 +3343,45 @@ server.");
using_update_log=1; using_update_log=1;
} }
if (plugin_init(opt_bootstrap)) if (plugin_init(&defaults_argc, defaults_argv,
(opt_noacl ? PLUGIN_INIT_SKIP_PLUGIN_TABLE : 0) |
(opt_help ? PLUGIN_INIT_SKIP_INITIALIZATION : 0)))
{ {
sql_print_error("Failed to init plugins."); sql_print_error("Failed to initialize 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_argc > 1)
{
int ho_error;
char **tmp_argv= defaults_argv;
struct my_option no_opts[]=
{
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
/*
We need to eat any 'loose' arguments first before we conclude
that there are unprocessed options.
But we need to preserve defaults_argv pointer intact for
free_defaults() to work. Thus we use a copy here.
*/
my_getopt_skip_unknown= 0;
if ((ho_error= handle_options(&defaults_argc, &tmp_argv, no_opts,
get_one_option)))
unireg_abort(ho_error);
if (defaults_argc)
{
fprintf(stderr, "%s: Too many arguments (first extra is '%s').\n"
"Use --verbose --help to get a list of available options\n",
my_progname, *tmp_argv);
unireg_abort(1);
}
} }
/* We have to initialize the storage engines before CSV logging */ /* We have to initialize the storage engines before CSV logging */
@ -3419,7 +3412,8 @@ server.");
else else
{ {
/* fall back to the log files if tables are not present */ /* 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 */ /* purecov: begin inspected */
sql_print_error("CSV engine is not present, falling back to the " sql_print_error("CSV engine is not present, falling back to the "
@ -3439,11 +3433,16 @@ server.");
/* /*
Check that the default storage engine is actually available. Check that the default storage engine is actually available.
*/ */
if (default_storage_engine_str)
{ {
LEX_STRING name= { default_storage_engine_str, LEX_STRING name= { default_storage_engine_str,
strlen(default_storage_engine_str) }; strlen(default_storage_engine_str) };
handlerton *hton= ha_resolve_by_name(0, &name); plugin_ref plugin;
if (hton == NULL) handlerton *hton;
if ((plugin= ha_resolve_by_name(0, &name)))
hton= plugin_data(plugin, handlerton*);
else
{ {
sql_print_error("Unknown/unsupported table type: %s", sql_print_error("Unknown/unsupported table type: %s",
default_storage_engine_str); default_storage_engine_str);
@ -3457,9 +3456,17 @@ server.");
default_storage_engine_str); default_storage_engine_str);
unireg_abort(1); unireg_abort(1);
} }
hton= myisam_hton; DBUG_ASSERT(global_system_variables.table_plugin);
}
else
{
/*
Need to unlock as global_system_variables.table_plugin
was acquired during plugin_init()
*/
plugin_unlock(0, global_system_variables.table_plugin);
global_system_variables.table_plugin= plugin;
} }
global_system_variables.table_type= hton;
} }
tc_log= (total_ha_2pc > 1 ? (opt_bin_log ? tc_log= (total_ha_2pc > 1 ? (opt_bin_log ?
@ -4870,11 +4877,6 @@ enum options_mysqld
OPT_STORAGE_ENGINE, OPT_INIT_FILE, OPT_STORAGE_ENGINE, OPT_INIT_FILE,
OPT_DELAY_KEY_WRITE_ALL, OPT_SLOW_QUERY_LOG, OPT_DELAY_KEY_WRITE_ALL, OPT_SLOW_QUERY_LOG,
OPT_DELAY_KEY_WRITE, OPT_CHARSETS_DIR, 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_HOST, OPT_MASTER_USER,
OPT_MASTER_PASSWORD, OPT_MASTER_PORT, OPT_MASTER_PASSWORD, OPT_MASTER_PORT,
OPT_MASTER_INFO_FILE, OPT_MASTER_CONNECT_RETRY, OPT_MASTER_INFO_FILE, OPT_MASTER_CONNECT_RETRY,
@ -4893,28 +4895,14 @@ enum options_mysqld
OPT_WANT_CORE, OPT_CONCURRENT_INSERT, OPT_WANT_CORE, OPT_CONCURRENT_INSERT,
OPT_MEMLOCK, OPT_MYISAM_RECOVER, OPT_MEMLOCK, OPT_MYISAM_RECOVER,
OPT_REPLICATE_REWRITE_DB, OPT_SERVER_ID, 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_SAFEMALLOC_MEM_LIMIT, OPT_REPLICATE_DO_TABLE,
OPT_REPLICATE_IGNORE_TABLE, OPT_REPLICATE_WILD_DO_TABLE, OPT_REPLICATE_IGNORE_TABLE, OPT_REPLICATE_WILD_DO_TABLE,
OPT_REPLICATE_WILD_IGNORE_TABLE, OPT_REPLICATE_SAME_SERVER_ID, OPT_REPLICATE_WILD_IGNORE_TABLE, OPT_REPLICATE_SAME_SERVER_ID,
OPT_DISCONNECT_SLAVE_EVENT_COUNT, OPT_TC_HEURISTIC_RECOVER, OPT_DISCONNECT_SLAVE_EVENT_COUNT, OPT_TC_HEURISTIC_RECOVER,
OPT_ABORT_SLAVE_EVENT_COUNT, 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_LOG_BIN_TRUST_FUNCTION_CREATORS,
OPT_SAFE_SHOW_DB, OPT_INNODB_SAFE_BINLOG, OPT_ENGINE_CONDITION_PUSHDOWN, OPT_NDB_CONNECTSTRING,
OPT_INNODB, OPT_ISAM,
OPT_ENGINE_CONDITION_PUSHDOWN, OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING,
OPT_NDB_USE_EXACT_COUNT, OPT_NDB_USE_TRANSACTIONS, OPT_NDB_USE_EXACT_COUNT, OPT_NDB_USE_TRANSACTIONS,
OPT_NDB_FORCE_SEND, OPT_NDB_AUTOINCREMENT_PREFETCH_SZ, OPT_NDB_FORCE_SEND, OPT_NDB_AUTOINCREMENT_PREFETCH_SZ,
OPT_NDB_SHM, OPT_NDB_OPTIMIZED_NODE_SELECTION, OPT_NDB_CACHE_CHECK_TIME, OPT_NDB_SHM, OPT_NDB_OPTIMIZED_NODE_SELECTION, OPT_NDB_CACHE_CHECK_TIME,
@ -4977,34 +4965,6 @@ enum options_mysqld
OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE, OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE,
OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK, OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK,
OPT_WAIT_TIMEOUT, OPT_MYISAM_REPAIR_THREADS, 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_INNODB_STATS_ON_METADATA,
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_ERROR_LOG_FILE,
OPT_DEFAULT_WEEK_FORMAT, OPT_DEFAULT_WEEK_FORMAT,
OPT_RANGE_ALLOC_BLOCK_SIZE, OPT_ALLOW_SUSPICIOUS_UDFS, OPT_RANGE_ALLOC_BLOCK_SIZE, OPT_ALLOW_SUSPICIOUS_UDFS,
@ -5014,7 +4974,6 @@ enum options_mysqld
OPT_SYNC_REPLICATION, OPT_SYNC_REPLICATION,
OPT_SYNC_REPLICATION_SLAVE_ID, OPT_SYNC_REPLICATION_SLAVE_ID,
OPT_SYNC_REPLICATION_TIMEOUT, OPT_SYNC_REPLICATION_TIMEOUT,
OPT_BDB_NOSYNC,
OPT_ENABLE_SHARED_MEMORY, OPT_ENABLE_SHARED_MEMORY,
OPT_SHARED_MEMORY_BASE_NAME, OPT_SHARED_MEMORY_BASE_NAME,
OPT_OLD_PASSWORDS, OPT_OLD_PASSWORDS,
@ -5045,12 +5004,12 @@ enum options_mysqld
OPT_OLD_STYLE_USER_LIMITS, OPT_OLD_STYLE_USER_LIMITS,
OPT_LOG_SLOW_ADMIN_STATEMENTS, OPT_LOG_SLOW_ADMIN_STATEMENTS,
OPT_TABLE_LOCK_WAIT_TIMEOUT, OPT_TABLE_LOCK_WAIT_TIMEOUT,
OPT_PLUGIN_LOAD,
OPT_PLUGIN_DIR, OPT_PLUGIN_DIR,
OPT_LOG_OUTPUT, OPT_LOG_OUTPUT,
OPT_PORT_OPEN_TIMEOUT, OPT_PORT_OPEN_TIMEOUT,
OPT_GENERAL_LOG, OPT_GENERAL_LOG,
OPT_SLOW_LOG, OPT_SLOW_LOG,
OPT_MERGE,
OPT_THREAD_HANDLING, OPT_THREAD_HANDLING,
OPT_INNODB_ROLLBACK_ON_TIMEOUT, OPT_INNODB_ROLLBACK_ON_TIMEOUT,
OPT_SECURE_FILE_PRIV, OPT_SECURE_FILE_PRIV,
@ -5117,8 +5076,7 @@ struct my_option my_long_options[] =
" to 'row' and back implicitly per each query accessing a NDB table." " to 'row' and back implicitly per each query accessing a NDB table."
#endif #endif
,(gptr*) &opt_binlog_format, (gptr*) &opt_binlog_format, ,(gptr*) &opt_binlog_format, (gptr*) &opt_binlog_format,
0, GET_STR, REQUIRED_ARG, BINLOG_FORMAT_MIXED, BINLOG_FORMAT_STMT, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
BINLOG_FORMAT_MIXED, 0, 0, 0},
{"binlog-do-db", OPT_BINLOG_DO_DB, {"binlog-do-db", OPT_BINLOG_DO_DB,
"Tells the master it should log updates for the specified database, and exclude all others not explicitly mentioned.", "Tells the master it should log updates for the specified database, and exclude all others not explicitly mentioned.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -5272,98 +5230,6 @@ Disable with --skip-large-pages.",
{"init-slave", OPT_INIT_SLAVE, "Command(s) that are executed when a slave connects to this master", {"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, (gptr*) &opt_init_slave, (gptr*) &opt_init_slave, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 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_rollback_on_timeout", OPT_INNODB_ROLLBACK_ON_TIMEOUT,
"Roll back the complete transaction on lock wait timeout, for 4.x compatibility (disabled by default)",
(gptr*) &innobase_rollback_on_timeout, (gptr*) &innobase_rollback_on_timeout,
0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 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_stats_on_metadata", OPT_INNODB_STATS_ON_METADATA,
"Enable statistics gathering for metadata commands such as SHOW TABLE STATUS (on by default)",
(gptr*) &innobase_stats_on_metadata, (gptr*) &innobase_stats_on_metadata,
0, GET_BOOL, NO_ARG, 1, 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', {"language", 'L',
"Client error messages in given language. May be given as a full path.", "Client error messages in given language. May be given as a full path.",
(gptr*) &language_ptr, (gptr*) &language_ptr, 0, GET_STR, REQUIRED_ARG, (gptr*) &language_ptr, (gptr*) &language_ptr, 0, GET_STR, REQUIRED_ARG,
@ -5542,10 +5408,6 @@ master-ssl",
"Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.", "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, (gptr*) &myisam_recover_options_str, (gptr*) &myisam_recover_options_str, 0,
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 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 #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
{"ndb-connectstring", OPT_NDB_CONNECTSTRING, {"ndb-connectstring", OPT_NDB_CONNECTSTRING,
"Connect string for ndbcluster.", "Connect string for ndbcluster.",
@ -6005,84 +5867,6 @@ log and this option does nothing anymore.",
(gptr*) &global_system_variables.group_concat_max_len, (gptr*) &global_system_variables.group_concat_max_len,
(gptr*) &max_system_variables.group_concat_max_len, 0, GET_ULONG, (gptr*) &max_system_variables.group_concat_max_len, 0, GET_ULONG,
REQUIRED_ARG, 1024, 4, (long) ~0, 0, 1, 0}, 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, {"interactive_timeout", OPT_INTERACTIVE_TIMEOUT,
"The number of seconds the server waits for activity on an interactive connection before closing it.", "The number of seconds the server waits for activity on an interactive connection before closing it.",
(gptr*) &global_system_variables.net_interactive_timeout, (gptr*) &global_system_variables.net_interactive_timeout,
@ -6312,6 +6096,11 @@ The minimum value for this variable is 4096.",
"Directory for plugins.", "Directory for plugins.",
(gptr*) &opt_plugin_dir_ptr, (gptr*) &opt_plugin_dir_ptr, 0, (gptr*) &opt_plugin_dir_ptr, (gptr*) &opt_plugin_dir_ptr, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"plugin_load", OPT_PLUGIN_LOAD,
"Optional colon separated 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, {"preload_buffer_size", OPT_PRELOAD_BUFFER_SIZE,
"The size of the buffer that is allocated when preloading indexes", "The size of the buffer that is allocated when preloading indexes",
(gptr*) &global_system_variables.preload_buff_size, (gptr*) &global_system_variables.preload_buff_size,
@ -7123,11 +6912,10 @@ Starts the MySQL database server\n");
#endif #endif
print_defaults(MYSQL_CONFIG_NAME,load_default_groups); print_defaults(MYSQL_CONFIG_NAME,load_default_groups);
puts(""); puts("");
fix_paths();
set_ports(); set_ports();
my_print_help(my_long_options); /* Print out all the options including plugin supplied options */
my_print_variables(my_long_options); my_print_help_inc_plugins(my_long_options, sizeof(my_long_options)/sizeof(my_option));
puts("\n\ puts("\n\
To see what values a running MySQL server is using, type\n\ To see what values a running MySQL server is using, type\n\
@ -7170,6 +6958,7 @@ static void mysql_init_variables(void)
mqh_used= 0; mqh_used= 0;
segfaulted= kill_in_progress= 0; segfaulted= kill_in_progress= 0;
cleanup_done= 0; cleanup_done= 0;
defaults_argc= 0;
defaults_argv= 0; defaults_argv= 0;
server_id_supplied= 0; server_id_supplied= 0;
test_flags= select_errors= dropping_tables= ha_open_options=0; test_flags= select_errors= dropping_tables= ha_open_options=0;
@ -7257,7 +7046,7 @@ static void mysql_init_variables(void)
lc_time_names_name= (char*) "en_US"; lc_time_names_name= (char*) "en_US";
/* Set default values for some option variables */ /* Set default values for some option variables */
default_storage_engine_str= (char*) "MyISAM"; default_storage_engine_str= (char*) "MyISAM";
global_system_variables.table_type= myisam_hton; global_system_variables.table_plugin= NULL;
global_system_variables.tx_isolation= ISO_REPEATABLE_READ; global_system_variables.tx_isolation= ISO_REPEATABLE_READ;
global_system_variables.select_limit= (ulonglong) HA_POS_ERROR; global_system_variables.select_limit= (ulonglong) HA_POS_ERROR;
max_system_variables.select_limit= (ulonglong) HA_POS_ERROR; max_system_variables.select_limit= (ulonglong) HA_POS_ERROR;
@ -7278,36 +7067,13 @@ static void mysql_init_variables(void)
"d:t:i:o,/tmp/mysqld.trace"); "d:t:i:o,/tmp/mysqld.trace");
#endif #endif
opt_error_log= IF_WIN(1,0); 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 #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 WITH_NDBCLUSTER_STORAGE_ENGINE
have_ndbcluster=SHOW_OPTION_DISABLED;
global_system_variables.ndb_index_stat_enable=FALSE; global_system_variables.ndb_index_stat_enable=FALSE;
max_system_variables.ndb_index_stat_enable=TRUE; max_system_variables.ndb_index_stat_enable=TRUE;
global_system_variables.ndb_index_stat_cache_entries=32; global_system_variables.ndb_index_stat_cache_entries=32;
max_system_variables.ndb_index_stat_cache_entries=~0L; max_system_variables.ndb_index_stat_cache_entries=~0L;
global_system_variables.ndb_index_stat_update_freq=20; global_system_variables.ndb_index_stat_update_freq=20;
max_system_variables.ndb_index_stat_update_freq=~0L; max_system_variables.ndb_index_stat_update_freq=~0L;
#else
have_ndbcluster=SHOW_OPTION_NO;
#endif #endif
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
have_ssl=SHOW_OPTION_YES; have_ssl=SHOW_OPTION_YES;
@ -7600,7 +7366,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
#endif #endif
case OPT_EVENT_SCHEDULER: case OPT_EVENT_SCHEDULER:
if (Events::set_opt_event_scheduler(argument)) if (Events::set_opt_event_scheduler(argument))
exit(1); exit(1);
break; break;
case (int) OPT_SKIP_NEW: case (int) OPT_SKIP_NEW:
opt_specialflag|= SPECIAL_NO_NEW_FUNC; opt_specialflag|= SPECIAL_NO_NEW_FUNC;
@ -7752,17 +7518,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
global_system_variables.tx_isolation= (type-1); global_system_variables.tx_isolation= (type-1);
break; 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 #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
case OPT_NDB_MGMD: case OPT_NDB_MGMD:
case OPT_NDB_NODEID: case OPT_NDB_NODEID:
@ -7801,24 +7556,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
ndb_extra_logging= atoi(argument); ndb_extra_logging= atoi(argument);
break; break;
#endif #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: case OPT_MYISAM_RECOVER:
{ {
if (!argument || !argument[0]) if (!argument || !argument[0])
@ -7949,7 +7686,7 @@ static void option_error_reporter(enum loglevel level, const char *format, ...)
} }
static void get_options(int argc,char **argv) static void get_options(int *argc,char **argv)
{ {
int ho_error; int ho_error;
@ -7957,34 +7694,20 @@ static void get_options(int argc,char **argv)
strmake(def_ft_boolean_syntax, ft_boolean_syntax, strmake(def_ft_boolean_syntax, ft_boolean_syntax,
sizeof(ft_boolean_syntax)-1); sizeof(ft_boolean_syntax)-1);
my_getopt_error_reporter= option_error_reporter; my_getopt_error_reporter= option_error_reporter;
if ((ho_error= handle_options(&argc, &argv, my_long_options,
/* 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))) get_one_option)))
exit(ho_error); exit(ho_error);
(*argc)++; /* add back one for the progname handle_options removes */
/* no need to do this for argv as we are discarding it. */
#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) && if ((opt_log_slow_admin_statements || opt_log_queries_not_using_indexes) &&
!opt_slow_log) !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"); 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) #if defined(HAVE_BROKEN_REALPATH)
my_use_symdir=0; my_use_symdir=0;
my_disable_symlinks=1; my_disable_symlinks=1;
@ -8337,12 +8060,7 @@ void refresh_status(THD *thd)
bzero((char*) &thd->status_var, sizeof(thd->status_var)); bzero((char*) &thd->status_var, sizeof(thd->status_var));
/* Reset some global variables */ /* Reset some global variables */
for (SHOW_VAR *ptr= status_vars; ptr->name; ptr++) reset_status_vars();
{
/* Note that SHOW_LONG_NOFLUSH variables are not reset */
if (ptr->type == SHOW_LONG)
*(ulong*) ptr->value= 0;
}
/* Reset the counters of all key caches (default and named). */ /* Reset the counters of all key caches (default and named). */
process_key_caches(reset_key_cache_counters); process_key_caches(reset_key_cache_counters);
@ -8361,51 +8079,9 @@ void refresh_status(THD *thd)
/***************************************************************************** /*****************************************************************************
Instantiate have_xyx for missing storage engines Instantiate variables for missing storage engines
This section should go away soon
*****************************************************************************/ *****************************************************************************/
#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,
innobase_rollback_on_timeout,
innobase_stats_on_metadata;
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 #ifndef WITH_NDBCLUSTER_STORAGE_ENGINE
ulong ndb_cache_check_time; ulong ndb_cache_check_time;

View File

@ -1552,8 +1552,8 @@ QUICK_ROR_UNION_SELECT::~QUICK_ROR_UNION_SELECT()
QUICK_RANGE::QUICK_RANGE() QUICK_RANGE::QUICK_RANGE()
:min_key(0),max_key(0),min_length(0),max_length(0), :min_key(0),max_key(0),min_length(0),max_length(0),
min_keypart_map(0), max_keypart_map(0), flag(NO_MIN_RANGE | NO_MAX_RANGE),
flag(NO_MIN_RANGE | NO_MAX_RANGE) min_keypart_map(0), max_keypart_map(0)
{} {}
SEL_ARG::SEL_ARG(SEL_ARG &arg) :Sql_alloc() SEL_ARG::SEL_ARG(SEL_ARG &arg) :Sql_alloc()
@ -10008,11 +10008,12 @@ QUICK_GROUP_MIN_MAX_SELECT(TABLE *table, JOIN *join_arg, bool have_min_arg,
ha_rows records_arg, uint key_infix_len_arg, ha_rows records_arg, uint key_infix_len_arg,
byte *key_infix_arg, MEM_ROOT *parent_alloc) byte *key_infix_arg, MEM_ROOT *parent_alloc)
:join(join_arg), index_info(index_info_arg), :join(join_arg), index_info(index_info_arg),
group_prefix_len(group_prefix_len_arg), have_min(have_min_arg), group_prefix_len(group_prefix_len_arg),
group_key_parts(group_key_parts_arg), have_min(have_min_arg),
have_max(have_max_arg), seen_first_key(FALSE), have_max(have_max_arg), seen_first_key(FALSE),
min_max_arg_part(min_max_arg_part_arg), key_infix(key_infix_arg), min_max_arg_part(min_max_arg_part_arg), key_infix(key_infix_arg),
key_infix_len(key_infix_len_arg), min_functions_it(NULL), key_infix_len(key_infix_len_arg), min_functions_it(NULL),
max_functions_it(NULL), group_key_parts(group_key_parts_arg) max_functions_it(NULL)
{ {
head= table; head= table;
file= head->file; file= head->file;

View File

@ -52,9 +52,9 @@ class QUICK_RANGE :public Sql_alloc {
max_key((char*) sql_memdup(max_key_arg,max_length_arg+1)), max_key((char*) sql_memdup(max_key_arg,max_length_arg+1)),
min_length((uint16) min_length_arg), min_length((uint16) min_length_arg),
max_length((uint16) max_length_arg), max_length((uint16) max_length_arg),
flag((uint16) flag_arg),
min_keypart_map(min_keypart_map_arg), min_keypart_map(min_keypart_map_arg),
max_keypart_map(max_keypart_map_arg), max_keypart_map(max_keypart_map_arg)
flag((uint16) flag_arg)
{ {
#ifdef HAVE_purify #ifdef HAVE_purify
dummy=0; dummy=0;

View File

@ -84,9 +84,9 @@ public:
partition_element(partition_element *part_elem) partition_element(partition_element *part_elem)
: part_max_rows(part_elem->part_max_rows), : part_max_rows(part_elem->part_max_rows),
part_min_rows(part_elem->part_min_rows), part_min_rows(part_elem->part_min_rows),
partition_name(NULL), range_value(0), partition_name(NULL),
tablespace_name(part_elem->tablespace_name), tablespace_name(part_elem->tablespace_name),
range_value(0), part_comment(part_elem->part_comment), part_comment(part_elem->part_comment),
data_file_name(part_elem->data_file_name), data_file_name(part_elem->data_file_name),
index_file_name(part_elem->index_file_name), index_file_name(part_elem->index_file_name),
engine_type(part_elem->engine_type), engine_type(part_elem->engine_type),

View File

@ -29,8 +29,8 @@ int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
MASTER_INFO::MASTER_INFO() MASTER_INFO::MASTER_INFO()
:ssl(0), fd(-1), io_thd(0), inited(0), :ssl(0), fd(-1), io_thd(0), inited(0),
abort_slave(0),slave_running(0), slave_run_id(0), abort_slave(0),slave_running(0),
ssl_verify_server_cert(0) ssl_verify_server_cert(0), slave_run_id(0)
{ {
host[0] = 0; user[0] = 0; password[0] = 0; host[0] = 0; user[0] = 0; password[0] = 0;
ssl_ca[0]= 0; ssl_capath[0]= 0; ssl_cert[0]= 0; ssl_ca[0]= 0; ssl_capath[0]= 0; ssl_cert[0]= 0;

View File

@ -59,7 +59,7 @@ public:
@param size Number of elements in array 'types' @param size Number of elements in array 'types'
*/ */
table_def(field_type *types, my_size_t size) table_def(field_type *types, my_size_t size)
: m_type(new unsigned char [size]), m_size(size) : m_size(size), m_type(new unsigned char [size])
{ {
if (m_type) if (m_type)
memcpy(m_type, types, size); memcpy(m_type, types, size);

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,7 @@
class sys_var; class sys_var;
class set_var; class set_var;
class sys_var_pluginvar; /* opaque */
typedef struct system_variables SV; typedef struct system_variables SV;
typedef struct my_locale_st MY_LOCALE; typedef struct my_locale_st MY_LOCALE;
@ -37,11 +38,15 @@ typedef void (*sys_after_update_func)(THD *,enum_var_type);
typedef void (*sys_set_default_func)(THD *, enum_var_type); typedef void (*sys_set_default_func)(THD *, enum_var_type);
typedef byte *(*sys_value_ptr_func)(THD *thd); typedef byte *(*sys_value_ptr_func)(THD *thd);
struct sys_var_chain
{
sys_var *first;
sys_var *last;
};
class sys_var class sys_var
{ {
public: public:
static sys_var *first;
static uint sys_vars;
sys_var *next; sys_var *next;
struct my_option *option_limits; /* Updated by by set_var_init() */ struct my_option *option_limits; /* Updated by by set_var_init() */
uint name_length; /* Updated by by set_var_init() */ uint name_length; /* Updated by by set_var_init() */
@ -52,13 +57,15 @@ public:
sys_var(const char *name_arg,sys_after_update_func func= NULL) sys_var(const char *name_arg,sys_after_update_func func= NULL)
:name(name_arg), after_update(func) :name(name_arg), after_update(func)
, no_support_one_shot(1) , no_support_one_shot(1)
{ add_sys_var(); } {}
virtual ~sys_var() {} virtual ~sys_var() {}
void add_sys_var() void chain_sys_var(sys_var_chain *chain_arg)
{ {
next= first; if (chain_arg->last)
first= this; chain_arg->last->next= this;
sys_vars++; else
chain_arg->first= this;
chain_arg->last= this;
} }
virtual bool check(THD *thd, set_var *var); virtual bool check(THD *thd, set_var *var);
bool check_enum(THD *thd, set_var *var, const TYPELIB *enum_names); bool check_enum(THD *thd, set_var *var, const TYPELIB *enum_names);
@ -77,6 +84,7 @@ public:
Item *item(THD *thd, enum_var_type type, LEX_STRING *base); Item *item(THD *thd, enum_var_type type, LEX_STRING *base);
virtual bool is_struct() { return 0; } virtual bool is_struct() { return 0; }
virtual bool is_readonly() const { return 0; } virtual bool is_readonly() const { return 0; }
virtual sys_var_pluginvar *cast_pluginvar() { return 0; }
}; };
@ -105,12 +113,12 @@ class sys_var_long_ptr_global: public sys_var_global
{ {
public: public:
ulong *value; ulong *value;
sys_var_long_ptr_global(const char *name_arg, ulong *value_ptr_arg, sys_var_long_ptr_global(sys_var_chain *chain, const char *name_arg, ulong *value_ptr_arg,
pthread_mutex_t *guard_arg, pthread_mutex_t *guard_arg,
sys_after_update_func after_update_arg= NULL) sys_after_update_func after_update_arg= NULL)
:sys_var_global(name_arg, after_update_arg, guard_arg), :sys_var_global(name_arg, after_update_arg, guard_arg),
value(value_ptr_arg) value(value_ptr_arg)
{} { chain_sys_var(chain); }
bool check(THD *thd, set_var *var); bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type); void set_default(THD *thd, enum_var_type type);
@ -127,7 +135,7 @@ public:
class sys_var_long_ptr :public sys_var_long_ptr_global class sys_var_long_ptr :public sys_var_long_ptr_global
{ {
public: 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); sys_after_update_func after_update_arg= NULL);
}; };
@ -136,11 +144,13 @@ class sys_var_ulonglong_ptr :public sys_var
{ {
public: public:
ulonglong *value; ulonglong *value;
sys_var_ulonglong_ptr(const char *name_arg, ulonglong *value_ptr_arg) sys_var_ulonglong_ptr(sys_var_chain *chain, const char *name_arg, ulonglong *value_ptr_arg)
:sys_var(name_arg),value(value_ptr_arg) {} :sys_var(name_arg),value(value_ptr_arg)
sys_var_ulonglong_ptr(const char *name_arg, ulonglong *value_ptr_arg, { chain_sys_var(chain); }
sys_var_ulonglong_ptr(sys_var_chain *chain, const char *name_arg, ulonglong *value_ptr_arg,
sys_after_update_func func) sys_after_update_func func)
:sys_var(name_arg,func), value(value_ptr_arg) {} :sys_var(name_arg,func), value(value_ptr_arg)
{ chain_sys_var(chain); }
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type); void set_default(THD *thd, enum_var_type type);
SHOW_TYPE show_type() { return SHOW_LONGLONG; } SHOW_TYPE show_type() { return SHOW_LONGLONG; }
@ -153,9 +163,9 @@ class sys_var_bool_ptr :public sys_var
{ {
public: public:
my_bool *value; my_bool *value;
sys_var_bool_ptr(const char *name_arg, my_bool *value_arg) sys_var_bool_ptr(sys_var_chain *chain, const char *name_arg, my_bool *value_arg)
:sys_var(name_arg),value(value_arg) :sys_var(name_arg),value(value_arg)
{} { chain_sys_var(chain); }
bool check(THD *thd, set_var *var) bool check(THD *thd, set_var *var)
{ {
return check_enum(thd, var, &bool_typelib); return check_enum(thd, var, &bool_typelib);
@ -172,8 +182,9 @@ public:
class sys_var_bool_ptr_readonly :public sys_var_bool_ptr class sys_var_bool_ptr_readonly :public sys_var_bool_ptr
{ {
public: public:
sys_var_bool_ptr_readonly(const char *name_arg, my_bool *value_arg) sys_var_bool_ptr_readonly(sys_var_chain *chain, const char *name_arg,
:sys_var_bool_ptr(name_arg, value_arg) my_bool *value_arg)
:sys_var_bool_ptr(chain, name_arg, value_arg)
{} {}
bool is_readonly() const { return 1; } bool is_readonly() const { return 1; }
}; };
@ -187,14 +198,14 @@ public:
sys_check_func check_func; sys_check_func check_func;
sys_update_func update_func; sys_update_func update_func;
sys_set_default_func set_default_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_check_func check_func_arg,
sys_update_func update_func_arg, sys_update_func update_func_arg,
sys_set_default_func set_default_func_arg, sys_set_default_func set_default_func_arg,
char *value_arg) char *value_arg)
:sys_var(name_arg), value(value_arg), check_func(check_func_arg), :sys_var(name_arg), value(value_arg), check_func(check_func_arg),
update_func(update_func_arg),set_default_func(set_default_func_arg) update_func(update_func_arg),set_default_func(set_default_func_arg)
{} { chain_sys_var(chain); }
bool check(THD *thd, set_var *var); bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var) bool update(THD *thd, set_var *var)
{ {
@ -219,9 +230,9 @@ class sys_var_const_str :public sys_var
{ {
public: public:
char *value; // Pointer to const value char *value; // Pointer to const value
sys_var_const_str(const char *name_arg, const char *value_arg) sys_var_const_str(sys_var_chain *chain, const char *name_arg, const char *value_arg)
:sys_var(name_arg),value((char*) value_arg) :sys_var(name_arg),value((char*) value_arg)
{} { chain_sys_var(chain); }
bool check(THD *thd, set_var *var) bool check(THD *thd, set_var *var)
{ {
return 1; return 1;
@ -248,9 +259,9 @@ class sys_var_const_str_ptr :public sys_var
{ {
public: public:
char **value; // Pointer to const value char **value; // Pointer to const value
sys_var_const_str_ptr(const char *name_arg, char **value_arg) sys_var_const_str_ptr(sys_var_chain *chain, const char *name_arg, char **value_arg)
:sys_var(name_arg),value(value_arg) :sys_var(name_arg),value(value_arg)
{} { chain_sys_var(chain); }
bool check(THD *thd, set_var *var) bool check(THD *thd, set_var *var)
{ {
return 1; return 1;
@ -278,10 +289,10 @@ class sys_var_enum :public sys_var
uint *value; uint *value;
TYPELIB *enum_names; TYPELIB *enum_names;
public: 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) TYPELIB *typelib, sys_after_update_func func)
:sys_var(name_arg,func), value(value_arg), enum_names(typelib) :sys_var(name_arg,func), value(value_arg), enum_names(typelib)
{} { chain_sys_var(chain); }
bool check(THD *thd, set_var *var) bool check(THD *thd, set_var *var)
{ {
return check_enum(thd, var, enum_names); return check_enum(thd, var, enum_names);
@ -296,7 +307,8 @@ public:
class sys_var_thd :public sys_var class sys_var_thd :public sys_var
{ {
public: public:
sys_var_thd(const char *name_arg, sys_after_update_func func= NULL) sys_var_thd(const char *name_arg,
sys_after_update_func func= NULL)
:sys_var(name_arg,func) :sys_var(name_arg,func)
{} {}
bool check_type(enum_var_type type) { return 0; } bool check_type(enum_var_type type) { return 0; }
@ -312,13 +324,13 @@ class sys_var_thd_ulong :public sys_var_thd
sys_check_func check_func; sys_check_func check_func;
public: public:
ulong SV::*offset; ulong SV::*offset;
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_var_thd(name_arg), check_func(0), offset(offset_arg) :sys_var_thd(name_arg), check_func(0), offset(offset_arg)
{} { chain_sys_var(chain); }
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_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(name_arg,au_func), check_func(c_func), offset(offset_arg)
{} { chain_sys_var(chain); }
bool check(THD *thd, set_var *var); bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type); void set_default(THD *thd, enum_var_type type);
@ -331,13 +343,15 @@ class sys_var_thd_ha_rows :public sys_var_thd
{ {
public: public:
ha_rows SV::*offset; ha_rows SV::*offset;
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_var_thd(name_arg), offset(offset_arg) :sys_var_thd(name_arg), offset(offset_arg)
{} { chain_sys_var(chain); }
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_after_update_func func)
:sys_var_thd(name_arg,func), offset(offset_arg) :sys_var_thd(name_arg,func), offset(offset_arg)
{} { chain_sys_var(chain); }
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type); void set_default(THD *thd, enum_var_type type);
SHOW_TYPE show_type() { return SHOW_HA_ROWS; } SHOW_TYPE show_type() { return SHOW_HA_ROWS; }
@ -350,14 +364,16 @@ class sys_var_thd_ulonglong :public sys_var_thd
public: public:
ulonglong SV::*offset; ulonglong SV::*offset;
bool only_global; bool only_global;
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_var_thd(name_arg), offset(offset_arg) :sys_var_thd(name_arg), offset(offset_arg)
{} { chain_sys_var(chain); }
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_after_update_func func, bool only_global_arg)
:sys_var_thd(name_arg, func), offset(offset_arg), :sys_var_thd(name_arg, func), offset(offset_arg),
only_global(only_global_arg) only_global(only_global_arg)
{} { chain_sys_var(chain); }
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type); void set_default(THD *thd, enum_var_type type);
SHOW_TYPE show_type() { return SHOW_LONGLONG; } SHOW_TYPE show_type() { return SHOW_LONGLONG; }
@ -377,13 +393,13 @@ class sys_var_thd_bool :public sys_var_thd
{ {
public: public:
my_bool SV::*offset; my_bool SV::*offset;
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_var_thd(name_arg), offset(offset_arg) :sys_var_thd(name_arg), offset(offset_arg)
{} { chain_sys_var(chain); }
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_after_update_func func)
:sys_var_thd(name_arg,func), offset(offset_arg) :sys_var_thd(name_arg,func), offset(offset_arg)
{} { chain_sys_var(chain); }
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type); void set_default(THD *thd, enum_var_type type);
SHOW_TYPE show_type() { return SHOW_MY_BOOL; } SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
@ -403,23 +419,23 @@ protected:
TYPELIB *enum_names; TYPELIB *enum_names;
sys_check_func check_func; sys_check_func check_func;
public: 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) TYPELIB *typelib)
:sys_var_thd(name_arg), offset(offset_arg), enum_names(typelib), :sys_var_thd(name_arg), offset(offset_arg), enum_names(typelib),
check_func(0) check_func(0)
{} { chain_sys_var(chain); }
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, TYPELIB *typelib,
sys_after_update_func func) sys_after_update_func func)
:sys_var_thd(name_arg,func), offset(offset_arg), enum_names(typelib), :sys_var_thd(name_arg,func), offset(offset_arg), enum_names(typelib),
check_func(0) check_func(0)
{} { chain_sys_var(chain); }
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, TYPELIB *typelib, sys_after_update_func func,
sys_check_func check) sys_check_func check)
:sys_var_thd(name_arg,func), offset(offset_arg), enum_names(typelib), :sys_var_thd(name_arg,func), offset(offset_arg), enum_names(typelib),
check_func(check) check_func(check)
{} { chain_sys_var(chain); }
bool check(THD *thd, set_var *var) bool check(THD *thd, set_var *var)
{ {
int ret= 0; int ret= 0;
@ -440,8 +456,9 @@ extern void fix_sql_mode_var(THD *thd, enum_var_type type);
class sys_var_thd_sql_mode :public sys_var_thd_enum class sys_var_thd_sql_mode :public sys_var_thd_enum
{ {
public: public:
sys_var_thd_sql_mode(const char *name_arg, ulong SV::*offset_arg) sys_var_thd_sql_mode(sys_var_chain *chain, const char *name_arg,
:sys_var_thd_enum(name_arg, offset_arg, &sql_mode_typelib, ulong SV::*offset_arg)
:sys_var_thd_enum(chain, name_arg, offset_arg, &sql_mode_typelib,
fix_sql_mode_var) fix_sql_mode_var)
{} {}
bool check(THD *thd, set_var *var) bool check(THD *thd, set_var *var)
@ -458,11 +475,12 @@ public:
class sys_var_thd_storage_engine :public sys_var_thd class sys_var_thd_storage_engine :public sys_var_thd
{ {
protected: protected:
handlerton *SV::*offset; plugin_ref SV::*offset;
public: public:
sys_var_thd_storage_engine(const char *name_arg, handlerton *SV::*offset_arg) sys_var_thd_storage_engine(sys_var_chain *chain, const char *name_arg,
plugin_ref SV::*offset_arg)
:sys_var_thd(name_arg), offset(offset_arg) :sys_var_thd(name_arg), offset(offset_arg)
{} { chain_sys_var(chain); }
bool check(THD *thd, set_var *var); bool check(THD *thd, set_var *var);
SHOW_TYPE show_type() { return SHOW_CHAR; } SHOW_TYPE show_type() { return SHOW_CHAR; }
bool check_update_type(Item_result type) bool check_update_type(Item_result type)
@ -477,8 +495,9 @@ public:
class sys_var_thd_table_type :public sys_var_thd_storage_engine class sys_var_thd_table_type :public sys_var_thd_storage_engine
{ {
public: public:
sys_var_thd_table_type(const char *name_arg, handlerton *SV::*offset_arg) sys_var_thd_table_type(sys_var_chain *chain, const char *name_arg,
:sys_var_thd_storage_engine(name_arg, offset_arg) plugin_ref SV::*offset_arg)
:sys_var_thd_storage_engine(chain, name_arg, offset_arg)
{} {}
void warn_deprecated(THD *thd); void warn_deprecated(THD *thd);
void set_default(THD *thd, enum_var_type type); void set_default(THD *thd, enum_var_type type);
@ -492,12 +511,12 @@ class sys_var_thd_bit :public sys_var_thd
public: public:
ulonglong bit_flag; ulonglong bit_flag;
bool reverse; 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, sys_check_func c_func, sys_update_func u_func,
ulonglong bit, bool reverse_arg=0) ulonglong bit, bool reverse_arg=0)
:sys_var_thd(name_arg), check_func(c_func), update_func(u_func), :sys_var_thd(name_arg), check_func(c_func), update_func(u_func),
bit_flag(bit), reverse(reverse_arg) bit_flag(bit), reverse(reverse_arg)
{} { chain_sys_var(chain); }
bool check(THD *thd, set_var *var); bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
bool check_update_type(Item_result type) { return 0; } bool check_update_type(Item_result type) { return 0; }
@ -509,7 +528,9 @@ public:
class sys_var_thd_dbug :public sys_var_thd class sys_var_thd_dbug :public sys_var_thd
{ {
public: 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(name_arg)
{ chain_sys_var(chain); }
bool check_update_type(Item_result type) { return type != STRING_RESULT; } bool check_update_type(Item_result type) { return type != STRING_RESULT; }
bool check(THD *thd, set_var *var); bool check(THD *thd, set_var *var);
SHOW_TYPE show_type() { return SHOW_CHAR; } SHOW_TYPE show_type() { return SHOW_CHAR; }
@ -525,7 +546,9 @@ public:
class sys_var_timestamp :public sys_var class sys_var_timestamp :public sys_var
{ {
public: 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(name_arg)
{ chain_sys_var(chain); }
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type); void set_default(THD *thd, enum_var_type type);
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; } bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
@ -538,7 +561,9 @@ public:
class sys_var_last_insert_id :public sys_var class sys_var_last_insert_id :public sys_var
{ {
public: 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(name_arg)
{ chain_sys_var(chain); }
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; } bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
SHOW_TYPE show_type() { return SHOW_LONGLONG; } SHOW_TYPE show_type() { return SHOW_LONGLONG; }
@ -549,7 +574,9 @@ public:
class sys_var_insert_id :public sys_var class sys_var_insert_id :public sys_var
{ {
public: 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(name_arg)
{ chain_sys_var(chain); }
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; } bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
SHOW_TYPE show_type() { return SHOW_LONGLONG; } SHOW_TYPE show_type() { return SHOW_LONGLONG; }
@ -557,33 +584,12 @@ public:
}; };
#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
show_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_arg)
:sys_var_long_ptr(name_arg,value_ptr_arg) {}
bool update(THD *thd, set_var *var);
};
#endif
class sys_var_rand_seed1 :public sys_var class sys_var_rand_seed1 :public sys_var
{ {
public: 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(name_arg)
{ chain_sys_var(chain); }
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; } bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
}; };
@ -591,7 +597,9 @@ public:
class sys_var_rand_seed2 :public sys_var class sys_var_rand_seed2 :public sys_var
{ {
public: 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(name_arg)
{ chain_sys_var(chain); }
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; } bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
}; };
@ -600,7 +608,8 @@ public:
class sys_var_collation :public sys_var_thd class sys_var_collation :public sys_var_thd
{ {
public: public:
sys_var_collation(const char *name_arg) :sys_var_thd(name_arg) sys_var_collation(const char *name_arg)
:sys_var_thd(name_arg)
{ {
no_support_one_shot= 0; no_support_one_shot= 0;
} }
@ -618,10 +627,9 @@ class sys_var_character_set :public sys_var_thd
{ {
public: public:
bool nullable; bool nullable;
sys_var_character_set(const char *name_arg) : sys_var_character_set(const char *name_arg, bool is_nullable= 0) :
sys_var_thd(name_arg) sys_var_thd(name_arg), nullable(is_nullable)
{ {
nullable= 0;
/* /*
In fact only almost all variables derived from sys_var_character_set In fact only almost all variables derived from sys_var_character_set
support ONE_SHOT; character_set_results doesn't. But that's good enough. support ONE_SHOT; character_set_results doesn't. But that's good enough.
@ -641,83 +649,47 @@ public:
virtual CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type)= 0; virtual CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type)= 0;
}; };
class sys_var_character_set_filesystem :public sys_var_character_set
class sys_var_character_set_sv :public sys_var_character_set
{ {
CHARSET_INFO *SV::*offset;
CHARSET_INFO **global_default;
public: public:
sys_var_character_set_filesystem(const char *name_arg) : sys_var_character_set_sv(sys_var_chain *chain, const char *name_arg,
sys_var_character_set(name_arg) {} CHARSET_INFO *SV::*offset_arg,
CHARSET_INFO **global_default_arg,
bool is_nullable= 0)
: sys_var_character_set(name_arg, is_nullable),
offset(offset_arg), global_default(global_default_arg)
{ chain_sys_var(chain); }
void set_default(THD *thd, enum_var_type type); void set_default(THD *thd, enum_var_type type);
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type); CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
}; };
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) {}
void set_default(THD *thd, enum_var_type type);
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
};
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)
{ nullable= 1; }
void set_default(THD *thd, enum_var_type type);
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
};
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) {}
void set_default(THD *thd, enum_var_type type);
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
};
class sys_var_character_set_database :public sys_var_character_set class sys_var_character_set_database :public sys_var_character_set
{ {
public: public:
sys_var_character_set_database(const char *name_arg) : sys_var_character_set_database(sys_var_chain *chain, const char *name_arg) :
sys_var_character_set(name_arg) {} sys_var_character_set(name_arg)
{ chain_sys_var(chain); }
void set_default(THD *thd, enum_var_type type); void set_default(THD *thd, enum_var_type type);
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type); CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
}; };
class sys_var_character_set_connection :public sys_var_character_set class sys_var_collation_sv :public sys_var_collation
{ {
CHARSET_INFO *SV::*offset;
CHARSET_INFO **global_default;
public: public:
sys_var_character_set_connection(const char *name_arg) : sys_var_collation_sv(sys_var_chain *chain, const char *name_arg,
sys_var_character_set(name_arg) {} CHARSET_INFO *SV::*offset_arg,
void set_default(THD *thd, enum_var_type type); CHARSET_INFO **global_default_arg)
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type); :sys_var_collation(name_arg),
}; offset(offset_arg), global_default(global_default_arg)
{
class sys_var_collation_connection :public sys_var_collation chain_sys_var(chain);
{ }
public:
sys_var_collation_connection(const char *name_arg) :sys_var_collation(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);
};
class sys_var_collation_server :public sys_var_collation
{
public:
sys_var_collation_server(const char *name_arg) :sys_var_collation(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);
};
class sys_var_collation_database :public sys_var_collation
{
public:
sys_var_collation_database(const char *name_arg) :sys_var_collation(name_arg) {}
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type); void set_default(THD *thd, enum_var_type type);
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
@ -729,9 +701,10 @@ class sys_var_key_cache_param :public sys_var
protected: protected:
size_t offset; size_t offset;
public: public:
sys_var_key_cache_param(const char *name_arg, size_t offset_arg) sys_var_key_cache_param(sys_var_chain *chain, const char *name_arg,
size_t offset_arg)
:sys_var(name_arg), offset(offset_arg) :sys_var(name_arg), offset(offset_arg)
{} { chain_sys_var(chain); }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
bool check_default(enum_var_type type) { return 1; } bool check_default(enum_var_type type) { return 1; }
bool is_struct() { return 1; } bool is_struct() { return 1; }
@ -741,8 +714,9 @@ public:
class sys_var_key_buffer_size :public sys_var_key_cache_param class sys_var_key_buffer_size :public sys_var_key_cache_param
{ {
public: public:
sys_var_key_buffer_size(const char *name_arg) sys_var_key_buffer_size(sys_var_chain *chain, const char *name_arg)
:sys_var_key_cache_param(name_arg, offsetof(KEY_CACHE, param_buff_size)) :sys_var_key_cache_param(chain, name_arg,
offsetof(KEY_CACHE, param_buff_size))
{} {}
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
SHOW_TYPE show_type() { return SHOW_LONGLONG; } SHOW_TYPE show_type() { return SHOW_LONGLONG; }
@ -752,8 +726,8 @@ public:
class sys_var_key_cache_long :public sys_var_key_cache_param class sys_var_key_cache_long :public sys_var_key_cache_param
{ {
public: public:
sys_var_key_cache_long(const char *name_arg, size_t offset_arg) sys_var_key_cache_long(sys_var_chain *chain, const char *name_arg, size_t offset_arg)
:sys_var_key_cache_param(name_arg, offset_arg) :sys_var_key_cache_param(chain, name_arg, offset_arg)
{} {}
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
SHOW_TYPE show_type() { return SHOW_LONG; } SHOW_TYPE show_type() { return SHOW_LONG; }
@ -765,12 +739,12 @@ class sys_var_thd_date_time_format :public sys_var_thd
DATE_TIME_FORMAT *SV::*offset; DATE_TIME_FORMAT *SV::*offset;
timestamp_type date_time_type; timestamp_type date_time_type;
public: 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, DATE_TIME_FORMAT *SV::*offset_arg,
timestamp_type date_time_type_arg) timestamp_type date_time_type_arg)
:sys_var_thd(name_arg), offset(offset_arg), :sys_var_thd(name_arg), offset(offset_arg),
date_time_type(date_time_type_arg) date_time_type(date_time_type_arg)
{} { chain_sys_var(chain); }
SHOW_TYPE show_type() { return SHOW_CHAR; } SHOW_TYPE show_type() { return SHOW_CHAR; }
bool check_update_type(Item_result type) bool check_update_type(Item_result type)
{ {
@ -789,8 +763,9 @@ class sys_var_log_state :public sys_var_bool_ptr
{ {
uint log_type; uint log_type;
public: public:
sys_var_log_state(const char *name_arg, my_bool *value_arg, uint log_type_arg) sys_var_log_state(sys_var_chain *chain, const char *name_arg, my_bool *value_arg,
:sys_var_bool_ptr(name_arg, value_arg), log_type(log_type_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); bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type); void set_default(THD *thd, enum_var_type type);
}; };
@ -801,10 +776,10 @@ class sys_var_log_output :public sys_var
ulong *value; ulong *value;
TYPELIB *enum_names; TYPELIB *enum_names;
public: 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) TYPELIB *typelib, sys_after_update_func func)
:sys_var(name_arg,func), value(value_arg), enum_names(typelib) :sys_var(name_arg,func), value(value_arg), enum_names(typelib)
{} { chain_sys_var(chain); }
bool check(THD *thd, set_var *var) bool check(THD *thd, set_var *var)
{ {
return check_set(thd, var, enum_names); return check_set(thd, var, enum_names);
@ -825,12 +800,12 @@ public:
enum_var_type var_type; enum_var_type var_type;
SHOW_TYPE show_type_value; SHOW_TYPE show_type_value;
sys_value_ptr_func value_ptr_func; 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, SHOW_TYPE show_type_arg,
sys_value_ptr_func value_ptr_func_arg) sys_value_ptr_func value_ptr_func_arg)
:sys_var(name_arg), var_type(type), :sys_var(name_arg), var_type(type),
show_type_value(show_type_arg), value_ptr_func(value_ptr_func_arg) show_type_value(show_type_arg), value_ptr_func(value_ptr_func_arg)
{} { chain_sys_var(chain); }
bool update(THD *thd, set_var *var) { return 1; } bool update(THD *thd, set_var *var) { return 1; }
bool check_default(enum_var_type type) { return 1; } bool check_default(enum_var_type type) { return 1; }
bool check_type(enum_var_type type) { return type != var_type; } bool check_type(enum_var_type type) { return type != var_type; }
@ -844,19 +819,17 @@ public:
}; };
class sys_var_have_variable: public sys_var class sys_var_have_option: public sys_var
{ {
SHOW_COMP_OPTION *have_variable; protected:
virtual SHOW_COMP_OPTION get_option() = 0;
public: public:
sys_var_have_variable(const char *variable_name, sys_var_have_option(sys_var_chain *chain, const char *variable_name):
SHOW_COMP_OPTION *have_variable_arg): sys_var(variable_name)
sys_var(variable_name), { chain_sys_var(chain); }
have_variable(have_variable_arg)
{ }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
{ {
return (byte*) show_comp_option_name[*have_variable]; return (byte*) show_comp_option_name[get_option()];
} }
bool update(THD *thd, set_var *var) { return 1; } bool update(THD *thd, set_var *var) { return 1; }
bool check_default(enum_var_type type) { return 1; } bool check_default(enum_var_type type) { return 1; }
@ -867,13 +840,47 @@ public:
}; };
class sys_var_have_variable: public sys_var_have_option
{
SHOW_COMP_OPTION *have_variable;
public:
sys_var_have_variable(sys_var_chain *chain, const char *variable_name,
SHOW_COMP_OPTION *have_variable_arg):
sys_var_have_option(chain, variable_name),
have_variable(have_variable_arg)
{ }
SHOW_COMP_OPTION get_option() { return *have_variable; }
};
class sys_var_have_plugin: public sys_var_have_option
{
const char *plugin_name_str;
const uint plugin_name_len;
const int plugin_type;
public:
sys_var_have_plugin(sys_var_chain *chain, const char *variable_name,
const char *plugin_name_str_arg, uint plugin_name_len_arg,
int plugin_type_arg):
sys_var_have_option(chain, variable_name),
plugin_name_str(plugin_name_str_arg), plugin_name_len(plugin_name_len_arg),
plugin_type(plugin_type_arg)
{ }
/* the following method is declared in sql_plugin.cc */
SHOW_COMP_OPTION get_option();
};
class sys_var_thd_time_zone :public sys_var_thd class sys_var_thd_time_zone :public sys_var_thd
{ {
public: public:
sys_var_thd_time_zone(const char *name_arg): sys_var_thd_time_zone(sys_var_chain *chain, const char *name_arg):
sys_var_thd(name_arg) sys_var_thd(name_arg)
{ {
no_support_one_shot= 0; no_support_one_shot= 0;
chain_sys_var(chain);
} }
bool check(THD *thd, set_var *var); bool check(THD *thd, set_var *var);
SHOW_TYPE show_type() { return SHOW_CHAR; } SHOW_TYPE show_type() { return SHOW_CHAR; }
@ -891,8 +898,9 @@ public:
class sys_var_max_user_conn : public sys_var_thd class sys_var_max_user_conn : public sys_var_thd
{ {
public: public:
sys_var_max_user_conn(const char *name_arg): sys_var_max_user_conn(sys_var_chain *chain, const char *name_arg):
sys_var_thd(name_arg) {} sys_var_thd(name_arg)
{ chain_sys_var(chain); }
bool check(THD *thd, set_var *var); bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
bool check_default(enum_var_type type) bool check_default(enum_var_type type)
@ -908,8 +916,9 @@ class sys_var_trust_routine_creators :public sys_var_bool_ptr
{ {
/* We need a derived class only to have a warn_deprecated() */ /* We need a derived class only to have a warn_deprecated() */
public: public:
sys_var_trust_routine_creators(const char *name_arg, my_bool *value_arg) : sys_var_trust_routine_creators(sys_var_chain *chain, const char *name_arg,
sys_var_bool_ptr(name_arg, value_arg) {}; my_bool *value_arg) :
sys_var_bool_ptr(chain, name_arg, value_arg) {};
void warn_deprecated(THD *thd); void warn_deprecated(THD *thd);
void set_default(THD *thd, enum_var_type type); void set_default(THD *thd, enum_var_type type);
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
@ -923,8 +932,9 @@ public:
class sys_var_opt_readonly :public sys_var_bool_ptr class sys_var_opt_readonly :public sys_var_bool_ptr
{ {
public: public:
sys_var_opt_readonly(const char *name_arg, my_bool *value_arg) : sys_var_opt_readonly(sys_var_chain *chain, const char *name_arg,
sys_var_bool_ptr(name_arg, value_arg) {}; my_bool *value_arg) :
sys_var_bool_ptr(chain, name_arg, value_arg) {};
~sys_var_opt_readonly() {}; ~sys_var_opt_readonly() {};
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
}; };
@ -933,12 +943,13 @@ public:
class sys_var_thd_lc_time_names :public sys_var_thd class sys_var_thd_lc_time_names :public sys_var_thd
{ {
public: public:
sys_var_thd_lc_time_names(const char *name_arg): sys_var_thd_lc_time_names(sys_var_chain *chain, const char *name_arg):
sys_var_thd(name_arg) sys_var_thd(name_arg)
{ {
#if MYSQL_VERSION_ID < 50000 #if MYSQL_VERSION_ID < 50000
no_support_one_shot= 0; no_support_one_shot= 0;
#endif #endif
chain_sys_var(chain);
} }
bool check(THD *thd, set_var *var); bool check(THD *thd, set_var *var);
SHOW_TYPE show_type() { return SHOW_CHAR; } SHOW_TYPE show_type() { return SHOW_CHAR; }
@ -957,8 +968,8 @@ class sys_var_event_scheduler :public sys_var_long_ptr
{ {
/* We need a derived class only to have a warn_deprecated() */ /* We need a derived class only to have a warn_deprecated() */
public: public:
sys_var_event_scheduler(const char *name_arg) : sys_var_event_scheduler(sys_var_chain *chain, const char *name_arg) :
sys_var_long_ptr(name_arg, NULL, NULL) {}; sys_var_long_ptr(chain, name_arg, NULL, NULL) {};
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
SHOW_TYPE show_type() { return SHOW_CHAR; } SHOW_TYPE show_type() { return SHOW_CHAR; }
@ -974,8 +985,9 @@ extern void fix_binlog_format_after_update(THD *thd, enum_var_type type);
class sys_var_thd_binlog_format :public sys_var_thd_enum class sys_var_thd_binlog_format :public sys_var_thd_enum
{ {
public: public:
sys_var_thd_binlog_format(const char *name_arg, ulong SV::*offset_arg) sys_var_thd_binlog_format(sys_var_chain *chain, const char *name_arg,
:sys_var_thd_enum(name_arg, offset_arg, ulong SV::*offset_arg)
:sys_var_thd_enum(chain, name_arg, offset_arg,
&binlog_format_typelib &binlog_format_typelib
, fix_binlog_format_after_update , fix_binlog_format_after_update
) )
@ -1013,7 +1025,7 @@ public:
CHARSET_INFO *charset; CHARSET_INFO *charset;
ulong ulong_value; ulong ulong_value;
ulonglong ulonglong_value; ulonglong ulonglong_value;
handlerton *hton; plugin_ref plugin;
DATE_TIME_FORMAT *date_time_format; DATE_TIME_FORMAT *date_time_format;
Time_zone *time_zone; Time_zone *time_zone;
MY_LOCALE *locale_value; MY_LOCALE *locale_value;
@ -1142,9 +1154,13 @@ struct sys_var_with_base
Prototypes for helper functions Prototypes for helper functions
*/ */
void set_var_init(); int set_var_init();
void set_var_free(); void set_var_free();
sys_var *find_sys_var(const char *str, uint length=0); 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(THD *thd, const char *str, uint length=0);
int sql_set_variables(THD *thd, List<set_var_base> *var_list); int sql_set_variables(THD *thd, List<set_var_base> *var_list);
bool not_all_support_one_shot(List<set_var_base> *var_list); bool not_all_support_one_shot(List<set_var_base> *var_list);
void fix_delay_key_write(THD *thd, enum_var_type type); void fix_delay_key_write(THD *thd, enum_var_type type);

View File

@ -1716,7 +1716,7 @@ void close_temporary_table(THD *thd, TABLE *table,
void close_temporary(TABLE *table, bool free_share, bool delete_table) void close_temporary(TABLE *table, bool free_share, bool delete_table)
{ {
handlerton *table_type= table->s->db_type; handlerton *table_type= table->s->db_type();
DBUG_ENTER("close_temporary"); DBUG_ENTER("close_temporary");
free_io_cache(table); free_io_cache(table);
@ -6507,7 +6507,7 @@ my_bool mysql_rm_tmp_tables(void)
init_tmp_table_share(&share, "", 0, "", filePathCopy); init_tmp_table_share(&share, "", 0, "", filePathCopy);
if (!open_table_def(thd, &share, 0) && if (!open_table_def(thd, &share, 0) &&
((handler_file= get_new_handler(&share, thd->mem_root, ((handler_file= get_new_handler(&share, thd->mem_root,
share.db_type)))) share.db_type()))))
{ {
handler_file->delete_table(filePathCopy); handler_file->delete_table(filePathCopy);
delete handler_file; delete handler_file;

View File

@ -2411,7 +2411,12 @@ Query_cache::register_tables_from_list(TABLE_LIST *tables_used,
tables_used->engine_data)) tables_used->engine_data))
DBUG_RETURN(0); DBUG_RETURN(0);
if (tables_used->table->s->db_type->db_type == DB_TYPE_MRG_MYISAM) #ifdef WITH_MYISAMMRG_STORAGE_ENGINE
/*
XXX FIXME: Some generic mechanism is required here instead of this
MYISAMMRG-specific implementation.
*/
if (tables_used->table->s->db_type()->db_type == DB_TYPE_MRG_MYISAM)
{ {
ha_myisammrg *handler = (ha_myisammrg *) tables_used->table->file; ha_myisammrg *handler = (ha_myisammrg *) tables_used->table->file;
MYRG_INFO *file = handler->myrg_info(); MYRG_INFO *file = handler->myrg_info();
@ -2434,6 +2439,7 @@ Query_cache::register_tables_from_list(TABLE_LIST *tables_used,
DBUG_RETURN(0); DBUG_RETURN(0);
} }
} }
#endif
} }
} }
DBUG_RETURN(n - counter); DBUG_RETURN(n - counter);
@ -3010,7 +3016,7 @@ static TABLE_COUNTER_TYPE process_and_count_tables(TABLE_LIST *tables_used,
DBUG_PRINT("qcache", ("table: %s db: %s type: %u", DBUG_PRINT("qcache", ("table: %s db: %s type: %u",
tables_used->table->s->table_name.str, tables_used->table->s->table_name.str,
tables_used->table->s->db.str, tables_used->table->s->db.str,
tables_used->table->s->db_type->db_type)); tables_used->table->s->db_type()->db_type));
if (tables_used->derived) if (tables_used->derived)
{ {
table_count--; table_count--;
@ -3035,12 +3041,18 @@ static TABLE_COUNTER_TYPE process_and_count_tables(TABLE_LIST *tables_used,
"other non-cacheable table(s)")); "other non-cacheable table(s)"));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
if (tables_used->table->s->db_type->db_type == DB_TYPE_MRG_MYISAM) #ifdef WITH_MYISAMMRG_STORAGE_ENGINE
/*
XXX FIXME: Some generic mechanism is required here instead of this
MYISAMMRG-specific implementation.
*/
if (tables_used->table->s->db_type()->db_type == DB_TYPE_MRG_MYISAM)
{ {
ha_myisammrg *handler = (ha_myisammrg *)tables_used->table->file; ha_myisammrg *handler = (ha_myisammrg *)tables_used->table->file;
MYRG_INFO *file = handler->myrg_info(); MYRG_INFO *file = handler->myrg_info();
table_count+= (file->end_table - file->open_tables); table_count+= (file->end_table - file->open_tables);
} }
#endif
} }
} }
DBUG_RETURN(table_count); DBUG_RETURN(table_count);

View File

@ -169,18 +169,25 @@ Open_tables_state::Open_tables_state(ulong version_arg)
reset_open_tables_state(); reset_open_tables_state();
} }
my_bool thd_in_lock_tables(const THD *thd) /*
The following functions form part of the C plugin API
*/
extern "C"
int thd_in_lock_tables(const THD *thd)
{ {
return thd->in_lock_tables; return test(thd->in_lock_tables);
} }
my_bool thd_tablespace_op(const THD *thd) extern "C"
int thd_tablespace_op(const THD *thd)
{ {
return thd->tablespace_op; return test(thd->tablespace_op);
} }
extern "C"
const char *thd_proc_info(THD *thd, const char *info) const char *thd_proc_info(THD *thd, const char *info)
{ {
const char *old_info= thd->proc_info; const char *old_info= thd->proc_info;
@ -188,11 +195,98 @@ const char *thd_proc_info(THD *thd, const char *info)
return old_info; return old_info;
} }
extern "C"
void **thd_ha_data(const THD *thd, const struct handlerton *hton) void **thd_ha_data(const THD *thd, const struct handlerton *hton)
{ {
return (void **) thd->ha_data + hton->slot; return (void **) thd->ha_data + hton->slot;
} }
extern "C"
long long thd_test_options(const THD *thd, long long test_options)
{
return thd->options & test_options;
}
extern "C"
int thd_sql_command(const THD *thd)
{
return (int) thd->lex->sql_command;
}
extern "C"
int thd_tx_isolation(const THD *thd)
{
return (int) thd->variables.tx_isolation;
}
/*
Dumps a text description of a thread, its security context
(user, host) and the current query.
SYNOPSIS
thd_security_context()
thd current thread context
buffer pointer to preferred result buffer
length length of buffer
max_query_len how many chars of query to copy (0 for all)
RETURN VALUES
pointer to string
*/
extern "C"
char *thd_security_context(THD *thd, char *buffer, unsigned int length,
unsigned int max_query_len)
{
String str(buffer, length, &my_charset_latin1);
const Security_context *sctx= &thd->main_security_ctx;
char header[64];
int len;
len= my_snprintf(header, sizeof(header),
"MySQL thread id %lu, query id %lu",
thd->thread_id, (ulong) thd->query_id);
str.length(0);
str.append(header, len);
if (sctx->host)
{
str.append(' ');
str.append(sctx->host);
}
if (sctx->ip)
{
str.append(' ');
str.append(sctx->ip);
}
if (sctx->user)
{
str.append(' ');
str.append(sctx->user);
}
if (thd->proc_info)
{
str.append(' ');
str.append(thd->proc_info);
}
if (thd->query)
{
if (max_query_len < 1)
len= thd->query_length;
else
len= min(thd->query_length, max_query_len);
str.append('\n');
str.append(thd->query, len);
}
if (str.c_ptr_safe() == buffer)
return buffer;
return thd->strmake(str.ptr(), str.length());
}
THD::THD() THD::THD()
@ -202,14 +296,18 @@ THD::THD()
lock_id(&main_lock_id), lock_id(&main_lock_id),
user_time(0), in_sub_stmt(0), user_time(0), in_sub_stmt(0),
binlog_table_maps(0), binlog_table_maps(0),
global_read_lock(0), is_fatal_error(0),
rand_used(0), time_zone_used(0),
arg_of_last_insert_id_function(FALSE), arg_of_last_insert_id_function(FALSE),
first_successful_insert_id_in_prev_stmt(0), first_successful_insert_id_in_prev_stmt(0),
first_successful_insert_id_in_prev_stmt_for_binlog(0), first_successful_insert_id_in_prev_stmt_for_binlog(0),
first_successful_insert_id_in_cur_stmt(0), first_successful_insert_id_in_cur_stmt(0),
in_lock_tables(0), bootstrap(0), derived_tables_processing(FALSE),
stmt_depends_on_first_successful_insert_id_in_prev_stmt(FALSE), stmt_depends_on_first_successful_insert_id_in_prev_stmt(FALSE),
global_read_lock(0),
is_fatal_error(0),
rand_used(0),
time_zone_used(0),
in_lock_tables(0),
bootstrap(0),
derived_tables_processing(FALSE),
spcont(NULL) spcont(NULL)
{ {
ulong tmp; ulong tmp;
@ -358,6 +456,8 @@ void THD::init(void)
{ {
pthread_mutex_lock(&LOCK_global_system_variables); pthread_mutex_lock(&LOCK_global_system_variables);
variables= global_system_variables; variables= global_system_variables;
variables.table_plugin= NULL;
plugin_thdvar_init(this);
variables.time_format= date_time_format_copy((THD*) 0, variables.time_format= date_time_format_copy((THD*) 0,
variables.time_format); variables.time_format);
variables.date_format= date_time_format_copy((THD*) 0, variables.date_format= date_time_format_copy((THD*) 0,
@ -506,6 +606,7 @@ THD::~THD()
cleanup(); cleanup();
ha_close_connection(this); ha_close_connection(this);
plugin_thdvar_cleanup(this);
DBUG_PRINT("info", ("freeing security context")); DBUG_PRINT("info", ("freeing security context"));
main_security_ctx.destroy(); main_security_ctx.destroy();
@ -1736,7 +1837,7 @@ void Query_arena::cleanup_stmt()
} }
/* /*
Statement functions Statement functions
*/ */
Statement::Statement(LEX *lex_arg, MEM_ROOT *mem_root_arg, Statement::Statement(LEX *lex_arg, MEM_ROOT *mem_root_arg,

View File

@ -182,6 +182,20 @@ class Time_zone;
struct system_variables 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_head; /* largest valid variable offset */
uint dynamic_variables_size; /* how many bytes are in use */
ulonglong myisam_max_extra_sort_file_size; ulonglong myisam_max_extra_sort_file_size;
ulonglong myisam_max_sort_file_size; ulonglong myisam_max_sort_file_size;
ulonglong max_heap_table_size; ulonglong max_heap_table_size;
@ -252,8 +266,6 @@ struct system_variables
my_bool old_mode; my_bool old_mode;
my_bool query_cache_wlock_invalidate; my_bool query_cache_wlock_invalidate;
my_bool engine_condition_pushdown; my_bool engine_condition_pushdown;
my_bool innodb_table_locks;
my_bool innodb_support_xa;
my_bool ndb_force_send; my_bool ndb_force_send;
my_bool ndb_use_copying_alter_table; my_bool ndb_use_copying_alter_table;
my_bool ndb_use_exact_count; my_bool ndb_use_exact_count;
@ -263,7 +275,7 @@ struct system_variables
my_bool old_alter_table; my_bool old_alter_table;
my_bool old_passwords; my_bool old_passwords;
handlerton *table_type; plugin_ref table_plugin;
/* Only charset part of these variables is sensible */ /* Only charset part of these variables is sensible */
CHARSET_INFO *character_set_filesystem; CHARSET_INFO *character_set_filesystem;

View File

@ -967,6 +967,7 @@ bool login_connection(THD *thd)
void end_connection(THD *thd) void end_connection(THD *thd)
{ {
NET *net= &thd->net; NET *net= &thd->net;
plugin_thdvar_cleanup(thd);
if (thd->user_connect) if (thd->user_connect)
decrease_user_connections(thd->user_connect); decrease_user_connections(thd->user_connect);
if (net->error && net->vio != 0 && net->report_error) if (net->error && net->vio != 0 && net->report_error)

View File

@ -903,7 +903,7 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
/* If it is a temporary table, close and regenerate it */ /* If it is a temporary table, close and regenerate it */
if (!dont_send_ok && (table= find_temporary_table(thd, table_list))) if (!dont_send_ok && (table= find_temporary_table(thd, table_list)))
{ {
handlerton *table_type= table->s->db_type; handlerton *table_type= table->s->db_type();
TABLE_SHARE *share= table->s; TABLE_SHARE *share= table->s;
if (!ha_check_storage_engine_flag(table_type, HTON_CAN_RECREATE)) if (!ha_check_storage_engine_flag(table_type, HTON_CAN_RECREATE))
goto trunc_by_del; goto trunc_by_del;

View File

@ -3364,7 +3364,7 @@ void select_create::abort()
{ {
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE); table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
handlerton *table_type=table->s->db_type; handlerton *table_type=table->s->db_type();
if (!table->s->tmp_table) if (!table->s->tmp_table)
{ {
ulong version= table->s->version; ulong version= table->s->version;

View File

@ -193,6 +193,7 @@ void lex_start(THD *thd, const char *buf, uint length)
lex->spcont= NULL; lex->spcont= NULL;
lex->proc_list.first= 0; lex->proc_list.first= 0;
lex->escape_used= FALSE; lex->escape_used= FALSE;
lex->query_tables= 0;
lex->reset_query_tables_list(FALSE); lex->reset_query_tables_list(FALSE);
lex->expr_allows_subselect= TRUE; lex->expr_allows_subselect= TRUE;
@ -232,6 +233,12 @@ void lex_end(LEX *lex)
lex->yacc_yyss= 0; lex->yacc_yyss= 0;
lex->yacc_yyvs= 0; lex->yacc_yyvs= 0;
} }
/* release used plugins */
plugin_unlock_list(0, (plugin_ref*)lex->plugins.buffer,
lex->plugins.elements);
reset_dynamic(&lex->plugins);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
@ -1700,6 +1707,17 @@ void st_lex::cleanup_lex_after_parse_error(THD *thd)
void Query_tables_list::reset_query_tables_list(bool init) void Query_tables_list::reset_query_tables_list(bool init)
{ {
if (!init && query_tables)
{
TABLE_LIST *table= query_tables;
for (;;)
{
delete table->view;
if (query_tables_last == &table->next_global ||
!(table= table->next_global))
break;
}
}
query_tables= 0; query_tables= 0;
query_tables_last= &query_tables; query_tables_last= &query_tables;
query_tables_own_last= 0; query_tables_own_last= 0;
@ -1754,6 +1772,13 @@ st_lex::st_lex()
:result(0), yacc_yyss(0), yacc_yyvs(0), :result(0), yacc_yyss(0), yacc_yyvs(0),
sql_command(SQLCOM_END) sql_command(SQLCOM_END)
{ {
/* Check that plugins_static_buffer is declared immediately after plugins */
compile_time_assert((&plugins + 1) == (DYNAMIC_ARRAY*)plugins_static_buffer);
my_init_dynamic_array2(&plugins, sizeof(plugin_ref),
plugins_static_buffer,
INITIAL_LEX_PLUGIN_LIST_SIZE,
INITIAL_LEX_PLUGIN_LIST_SIZE);
reset_query_tables_list(TRUE); reset_query_tables_list(TRUE);
} }

View File

@ -1027,6 +1027,11 @@ typedef struct st_lex : public Query_tables_list
XID *xid; XID *xid;
gptr yacc_yyss,yacc_yyvs; gptr yacc_yyss,yacc_yyvs;
THD *thd; THD *thd;
/* maintain a list of used plugins for this LEX */
DYNAMIC_ARRAY plugins;
plugin_ref plugins_static_buffer[INITIAL_LEX_PLUGIN_LIST_SIZE];
CHARSET_INFO *charset, *underscore_charset; CHARSET_INFO *charset, *underscore_charset;
/* store original leaf_tables for INSERT SELECT and PS/SP */ /* store original leaf_tables for INSERT SELECT and PS/SP */
TABLE_LIST *leaf_tables_insert; TABLE_LIST *leaf_tables_insert;
@ -1225,6 +1230,8 @@ typedef struct st_lex : public Query_tables_list
virtual ~st_lex() virtual ~st_lex()
{ {
destroy_query_tables_list(); destroy_query_tables_list();
plugin_unlock_list(NULL, (plugin_ref *)plugins.buffer, plugins.elements);
delete_dynamic(&plugins);
} }
inline void uncacheable(uint8 cause) inline void uncacheable(uint8 cause)

View File

@ -43,37 +43,37 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables);
const char *any_db="*any*"; // Special symbol for check_access const char *any_db="*any*"; // Special symbol for check_access
const LEX_STRING command_name[]={ const LEX_STRING command_name[]={
C_STRING_WITH_LEN("Sleep"), { STRING_WITH_LEN("Sleep") },
C_STRING_WITH_LEN("Quit"), { STRING_WITH_LEN("Quit") },
C_STRING_WITH_LEN("Init DB"), { STRING_WITH_LEN("Init DB") },
C_STRING_WITH_LEN("Query"), { STRING_WITH_LEN("Query") },
C_STRING_WITH_LEN("Field List"), { STRING_WITH_LEN("Field List") },
C_STRING_WITH_LEN("Create DB"), { STRING_WITH_LEN("Create DB") },
C_STRING_WITH_LEN("Drop DB"), { STRING_WITH_LEN("Drop DB") },
C_STRING_WITH_LEN("Refresh"), { STRING_WITH_LEN("Refresh") },
C_STRING_WITH_LEN("Shutdown"), { STRING_WITH_LEN("Shutdown") },
C_STRING_WITH_LEN("Statistics"), { STRING_WITH_LEN("Statistics") },
C_STRING_WITH_LEN("Processlist"), { STRING_WITH_LEN("Processlist") },
C_STRING_WITH_LEN("Connect"), { STRING_WITH_LEN("Connect") },
C_STRING_WITH_LEN("Kill"), { STRING_WITH_LEN("Kill") },
C_STRING_WITH_LEN("Debug"), { STRING_WITH_LEN("Debug") },
C_STRING_WITH_LEN("Ping"), { STRING_WITH_LEN("Ping") },
C_STRING_WITH_LEN("Time"), { STRING_WITH_LEN("Time") },
C_STRING_WITH_LEN("Delayed insert"), { STRING_WITH_LEN("Delayed insert") },
C_STRING_WITH_LEN("Change user"), { STRING_WITH_LEN("Change user") },
C_STRING_WITH_LEN("Binlog Dump"), { STRING_WITH_LEN("Binlog Dump") },
C_STRING_WITH_LEN("Table Dump"), { STRING_WITH_LEN("Table Dump") },
C_STRING_WITH_LEN("Connect Out"), { STRING_WITH_LEN("Connect Out") },
C_STRING_WITH_LEN("Register Slave"), { STRING_WITH_LEN("Register Slave") },
C_STRING_WITH_LEN("Prepare"), { STRING_WITH_LEN("Prepare") },
C_STRING_WITH_LEN("Execute"), { STRING_WITH_LEN("Execute") },
C_STRING_WITH_LEN("Long Data"), { STRING_WITH_LEN("Long Data") },
C_STRING_WITH_LEN("Close stmt"), { STRING_WITH_LEN("Close stmt") },
C_STRING_WITH_LEN("Reset stmt"), { STRING_WITH_LEN("Reset stmt") },
C_STRING_WITH_LEN("Set option"), { STRING_WITH_LEN("Set option") },
C_STRING_WITH_LEN("Fetch"), { STRING_WITH_LEN("Fetch") },
C_STRING_WITH_LEN("Daemon"), { STRING_WITH_LEN("Daemon") },
C_STRING_WITH_LEN("Error") // Last command number { STRING_WITH_LEN("Error") } // Last command number
}; };
const char *xa_state_names[]={ const char *xa_state_names[]={

View File

@ -784,9 +784,9 @@ static bool handle_list_of_fields(List_iterator<char> it,
} }
else else
{ {
if (table->s->db_type->partition_flags && if (table->s->db_type()->partition_flags &&
(table->s->db_type->partition_flags() & HA_USE_AUTO_PARTITION) && (table->s->db_type()->partition_flags() & HA_USE_AUTO_PARTITION) &&
(table->s->db_type->partition_flags() & HA_CAN_PARTITION)) (table->s->db_type()->partition_flags() & HA_CAN_PARTITION))
{ {
/* /*
This engine can handle automatic partitioning and there is no This engine can handle automatic partitioning and there is no
@ -1664,8 +1664,8 @@ bool fix_partition_func(THD *thd, TABLE *table,
goto end; goto end;
if (unlikely(check_primary_key(table))) if (unlikely(check_primary_key(table)))
goto end; goto end;
if (unlikely((!(table->s->db_type->partition_flags && if (unlikely((!(table->s->db_type()->partition_flags &&
(table->s->db_type->partition_flags() & HA_CAN_PARTITION_UNIQUE))) && (table->s->db_type()->partition_flags() & HA_CAN_PARTITION_UNIQUE))) &&
check_unique_keys(table))) check_unique_keys(table)))
goto end; goto end;
if (unlikely(set_up_partition_bitmap(thd, part_info))) if (unlikely(set_up_partition_bitmap(thd, part_info)))
@ -1872,7 +1872,7 @@ static int add_keyword_int(File fptr, const char *keyword, longlong num)
static int add_engine(File fptr, handlerton *engine_type) static int add_engine(File fptr, handlerton *engine_type)
{ {
const char *engine_str= hton2plugin[engine_type->slot]->name.str; const char *engine_str= ha_resolve_storage_engine_name(engine_type);
DBUG_PRINT("info", ("ENGINE: %s", engine_str)); DBUG_PRINT("info", ("ENGINE: %s", engine_str));
int err= add_string(fptr, "ENGINE = "); int err= add_string(fptr, "ENGINE = ");
return err + add_string(fptr, engine_str); return err + add_string(fptr, engine_str);
@ -2188,8 +2188,8 @@ bool partition_key_modified(TABLE *table, const MY_BITMAP *fields)
if (!part_info) if (!part_info)
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
if (table->s->db_type->partition_flags && if (table->s->db_type()->partition_flags &&
(table->s->db_type->partition_flags() & HA_CAN_UPDATE_PARTITION_KEY)) (table->s->db_type()->partition_flags() & HA_CAN_UPDATE_PARTITION_KEY))
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
for (fld= part_info->full_part_field_array; *fld; fld++) for (fld= part_info->full_part_field_array; *fld; fld++)
if (bitmap_is_set(fields, (*fld)->field_index)) if (bitmap_is_set(fields, (*fld)->field_index))
@ -4204,8 +4204,8 @@ uint prep_alter_part_table(THD *thd, TABLE *table, ALTER_INFO *alter_info,
alter_info->no_parts= curr_part_no - new_part_no; alter_info->no_parts= curr_part_no - new_part_no;
} }
} }
if (table->s->db_type->alter_table_flags && if (table->s->db_type()->alter_table_flags &&
(!(flags= table->s->db_type->alter_table_flags(alter_info->flags)))) (!(flags= table->s->db_type()->alter_table_flags(alter_info->flags))))
{ {
my_error(ER_PARTITION_FUNCTION_FAILURE, MYF(0)); my_error(ER_PARTITION_FUNCTION_FAILURE, MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
@ -4951,7 +4951,7 @@ the generated partition syntax in a correct manner.
create_info->db_type= table->part_info->default_engine_type; create_info->db_type= table->part_info->default_engine_type;
} }
DBUG_PRINT("info", ("New engine type: %s", DBUG_PRINT("info", ("New engine type: %s",
hton2plugin[create_info->db_type->slot]->name.str)); ha_resolve_storage_engine_name(create_info->db_type)));
thd->work_part_info= NULL; thd->work_part_info= NULL;
*partition_changed= TRUE; *partition_changed= TRUE;
} }

File diff suppressed because it is too large Load Diff

View File

@ -16,6 +16,17 @@
#ifndef _sql_plugin_h #ifndef _sql_plugin_h
#define _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
#define INITIAL_LEX_PLUGIN_LIST_SIZE 16
/* /*
the following #define adds server-only members to enum_mysql_show_type, the following #define adds server-only members to enum_mysql_show_type,
that is defined in plugin.h that is defined in plugin.h
@ -41,6 +52,7 @@ typedef struct st_mysql_show_var SHOW_VAR;
#define PLUGIN_IS_DELETED 2 #define PLUGIN_IS_DELETED 2
#define PLUGIN_IS_UNINITIALIZED 4 #define PLUGIN_IS_UNINITIALIZED 4
#define PLUGIN_IS_READY 8 #define PLUGIN_IS_READY 8
#define PLUGIN_IS_DYING 16
/* A handle for the dynamic library containing a plugin or plugins. */ /* A handle for the dynamic library containing a plugin or plugins. */
@ -63,25 +75,64 @@ struct st_plugin_int
uint state; uint state;
uint ref_count; /* number of threads using the plugin */ uint ref_count; /* number of threads using the plugin */
void *data; /* plugin type specific, e.g. handlerton */ 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 */
}; };
/*
See intern_plugin_lock() for the explanation for the
conditionally defined plugin_ref type
*/
#ifdef DBUG_OFF
typedef struct st_plugin_int *plugin_ref;
#define plugin_decl(pi) ((pi)->plugin)
#define plugin_dlib(pi) ((pi)->plugin_dl)
#define plugin_data(pi,cast) ((cast)((pi)->data))
#define plugin_name(pi) (&((pi)->name))
#define plugin_state(pi) ((pi)->state)
#define plugin_equals(p1,p2) ((p1) == (p2))
#else
typedef struct st_plugin_int **plugin_ref;
#define plugin_decl(pi) ((pi)[0]->plugin)
#define plugin_dlib(pi) ((pi)[0]->plugin_dl)
#define plugin_data(pi,cast) ((cast)((pi)[0]->data))
#define plugin_name(pi) (&((pi)[0]->name))
#define plugin_state(pi) ((pi)[0]->state)
#define plugin_equals(p1,p2) ((p1) && (p2) && (p1)[0] == (p2)[0])
#endif
typedef int (*plugin_type_init)(struct st_plugin_int *); 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_ptr;
extern char opt_plugin_dir[FN_REFLEN]; extern char opt_plugin_dir[FN_REFLEN];
extern const LEX_STRING plugin_type_names[]; extern const LEX_STRING plugin_type_names[];
extern int plugin_init(int);
extern int plugin_init(int *argc, char **argv, int init_flags);
extern void plugin_shutdown(void); extern void plugin_shutdown(void);
extern my_bool plugin_is_ready(const LEX_STRING *name, int type); extern void my_print_help_inc_plugins(struct my_option *options, uint size);
extern st_plugin_int *plugin_lock(const LEX_STRING *name, int type); extern bool plugin_is_ready(const LEX_STRING *name, int type);
extern void plugin_unlock(struct st_plugin_int *plugin); #define my_plugin_lock_by_name(A,B,C) plugin_lock_by_name(A,B,C CALLER_INFO)
extern my_bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING *dl); #define my_plugin_lock_by_name_ci(A,B,C) plugin_lock_by_name(A,B,C ORIG_CALLER_INFO)
extern my_bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name); #define my_plugin_lock(A,B) plugin_lock(A,B CALLER_INFO)
#define my_plugin_lock_ci(A,B) plugin_lock(A,B ORIG_CALLER_INFO)
extern plugin_ref plugin_lock(THD *thd, plugin_ref *ptr CALLER_INFO_PROTO);
extern plugin_ref plugin_lock_by_name(THD *thd, const LEX_STRING *name,
int type CALLER_INFO_PROTO);
extern void plugin_unlock(THD *thd, plugin_ref plugin);
extern void plugin_unlock_list(THD *thd, plugin_ref *list, uint count);
extern bool mysql_install_plugin(THD *thd, const LEX_STRING *name,
const LEX_STRING *dl);
extern bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name);
extern bool plugin_register_builtin(struct st_mysql_plugin *plugin);
extern void plugin_thdvar_init(THD *thd);
extern void plugin_thdvar_cleanup(THD *thd);
typedef my_bool (plugin_foreach_func)(THD *thd, typedef my_bool (plugin_foreach_func)(THD *thd,
st_plugin_int *plugin, plugin_ref plugin,
void *arg); void *arg);
#define plugin_foreach(A,B,C,D) plugin_foreach_with_mask(A,B,C,PLUGIN_IS_READY,D) #define plugin_foreach(A,B,C,D) plugin_foreach_with_mask(A,B,C,PLUGIN_IS_READY,D)
extern my_bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func, extern bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func,
int type, uint state_mask, void *arg); int type, uint state_mask, void *arg);
#endif #endif

View File

@ -1607,6 +1607,149 @@ int log_loaded_block(IO_CACHE* file)
return 0; 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(name_arg)
{ chain_sys_var(chain); }
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 */ #endif /* HAVE_REPLICATION */

View File

@ -67,6 +67,7 @@ typedef struct st_load_file_info
} LOAD_FILE_INFO; } LOAD_FILE_INFO;
int log_loaded_block(IO_CACHE* file); int log_loaded_block(IO_CACHE* file);
int init_replication_sys_vars();
#endif /* HAVE_REPLICATION */ #endif /* HAVE_REPLICATION */

View File

@ -9625,12 +9625,14 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
share->fields= field_count; share->fields= field_count;
/* If result table is small; use a heap */ /* If result table is small; use a heap */
/* future: storage engine selection can be made dynamic? */
if (blob_count || using_unique_constraint || if (blob_count || using_unique_constraint ||
(select_options & (OPTION_BIG_TABLES | SELECT_SMALL_RESULT)) == (select_options & (OPTION_BIG_TABLES | SELECT_SMALL_RESULT)) ==
OPTION_BIG_TABLES || (select_options & TMP_TABLE_FORCE_MYISAM)) OPTION_BIG_TABLES || (select_options & TMP_TABLE_FORCE_MYISAM))
{ {
share->db_plugin= ha_lock_engine(0, myisam_hton);
table->file= get_new_handler(share, &table->mem_root, table->file= get_new_handler(share, &table->mem_root,
share->db_type= myisam_hton); share->db_type());
if (group && if (group &&
(param->group_parts > table->file->max_key_parts() || (param->group_parts > table->file->max_key_parts() ||
param->group_length > table->file->max_key_length())) param->group_length > table->file->max_key_length()))
@ -9638,8 +9640,9 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
} }
else else
{ {
share->db_plugin= ha_lock_engine(0, heap_hton);
table->file= get_new_handler(share, &table->mem_root, table->file= get_new_handler(share, &table->mem_root,
share->db_type= heap_hton); share->db_type());
} }
if (!table->file) if (!table->file)
goto err; goto err;
@ -9801,7 +9804,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
if (thd->variables.tmp_table_size == ~ (ulonglong) 0) // No limit if (thd->variables.tmp_table_size == ~ (ulonglong) 0) // No limit
share->max_rows= ~(ha_rows) 0; share->max_rows= ~(ha_rows) 0;
else else
share->max_rows= (ha_rows) (((share->db_type == heap_hton) ? share->max_rows= (ha_rows) (((share->db_type() == heap_hton) ?
min(thd->variables.tmp_table_size, min(thd->variables.tmp_table_size,
thd->variables.max_heap_table_size) : thd->variables.max_heap_table_size) :
thd->variables.tmp_table_size) / thd->variables.tmp_table_size) /
@ -9949,7 +9952,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
if (thd->is_fatal_error) // If end of memory if (thd->is_fatal_error) // If end of memory
goto err; /* purecov: inspected */ goto err; /* purecov: inspected */
share->db_record_offset= 1; share->db_record_offset= 1;
if (share->db_type == myisam_hton) if (share->db_type() == myisam_hton)
{ {
if (create_myisam_tmp_table(table,param,select_options)) if (create_myisam_tmp_table(table,param,select_options))
goto err; goto err;
@ -10256,6 +10259,8 @@ free_tmp_table(THD *thd, TABLE *entry)
if (entry->temp_pool_slot != MY_BIT_NONE) if (entry->temp_pool_slot != MY_BIT_NONE)
bitmap_lock_clear_bit(&temp_pool, entry->temp_pool_slot); bitmap_lock_clear_bit(&temp_pool, entry->temp_pool_slot);
plugin_unlock(0, entry->s->db_plugin);
free_root(&own_root, MYF(0)); /* the table is allocated in its own root */ free_root(&own_root, MYF(0)); /* the table is allocated in its own root */
thd->proc_info=save_proc_info; thd->proc_info=save_proc_info;
@ -10275,7 +10280,7 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param,
int write_err; int write_err;
DBUG_ENTER("create_myisam_from_heap"); DBUG_ENTER("create_myisam_from_heap");
if (table->s->db_type != heap_hton || if (table->s->db_type() != heap_hton ||
error != HA_ERR_RECORD_FILE_FULL) error != HA_ERR_RECORD_FILE_FULL)
{ {
table->file->print_error(error,MYF(0)); table->file->print_error(error,MYF(0));
@ -10284,9 +10289,9 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param,
new_table= *table; new_table= *table;
share= *table->s; share= *table->s;
new_table.s= &share; new_table.s= &share;
new_table.s->db_type= myisam_hton; new_table.s->db_plugin= ha_lock_engine(thd, myisam_hton);
if (!(new_table.file= get_new_handler(&share, &new_table.mem_root, if (!(new_table.file= get_new_handler(&share, &new_table.mem_root,
myisam_hton))) new_table.s->db_type())))
DBUG_RETURN(1); // End of memory DBUG_RETURN(1); // End of memory
save_proc_info=thd->proc_info; save_proc_info=thd->proc_info;
@ -10344,9 +10349,12 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param,
(void) table->file->delete_table(table->s->table_name.str); (void) table->file->delete_table(table->s->table_name.str);
delete table->file; delete table->file;
table->file=0; table->file=0;
plugin_unlock(0, table->s->db_plugin);
share.db_plugin= my_plugin_lock(0, &share.db_plugin);
new_table.s= table->s; // Keep old share new_table.s= table->s; // Keep old share
*table= new_table; *table= new_table;
*table->s= share; *table->s= share;
table->file->change_table_ptr(table, table->s); table->file->change_table_ptr(table, table->s);
table->use_all_columns(); table->use_all_columns();
if (save_proc_info) if (save_proc_info)
@ -12934,7 +12942,7 @@ remove_duplicates(JOIN *join, TABLE *entry,List<Item> &fields, Item *having)
free_io_cache(entry); // Safety free_io_cache(entry); // Safety
entry->file->info(HA_STATUS_VARIABLE); entry->file->info(HA_STATUS_VARIABLE);
if (entry->s->db_type == heap_hton || if (entry->s->db_type() == heap_hton ||
(!entry->s->blob_fields && (!entry->s->blob_fields &&
((ALIGN_SIZE(reclength) + HASH_OVERHEAD) * entry->file->stats.records < ((ALIGN_SIZE(reclength) + HASH_OVERHEAD) * entry->file->stats.records <
thd->variables.sortbuff_size))) thd->variables.sortbuff_size)))

View File

@ -79,24 +79,24 @@ append_algorithm(TABLE_LIST *table, String *buff);
** List all table types supported ** List all table types supported
***************************************************************************/ ***************************************************************************/
static my_bool show_handlerton(THD *thd, st_plugin_int *plugin, static my_bool show_handlerton(THD *thd, plugin_ref plugin,
void *arg) void *arg)
{ {
handlerton *default_type= (handlerton *) arg; handlerton *default_type= (handlerton *) arg;
Protocol *protocol= thd->protocol; Protocol *protocol= thd->protocol;
handlerton *hton= (handlerton *)plugin->data; handlerton *hton= plugin_data(plugin, handlerton *);
if (!(hton->flags & HTON_HIDDEN)) if (!(hton->flags & HTON_HIDDEN))
{ {
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(plugin->name.str, plugin->name.length, protocol->store(plugin_name(plugin)->str, plugin_name(plugin)->length,
system_charset_info); system_charset_info);
const char *option_name= show_comp_option_name[(int) hton->state]; const char *option_name= show_comp_option_name[(int) hton->state];
if (hton->state == SHOW_OPTION_YES && default_type == hton) if (hton->state == SHOW_OPTION_YES && default_type == hton)
option_name= "DEFAULT"; option_name= "DEFAULT";
protocol->store(option_name, system_charset_info); protocol->store(option_name, system_charset_info);
protocol->store(plugin->plugin->descr, system_charset_info); protocol->store(plugin_decl(plugin)->descr, system_charset_info);
protocol->store(hton->commit ? "YES" : "NO", system_charset_info); protocol->store(hton->commit ? "YES" : "NO", system_charset_info);
protocol->store(hton->prepare ? "YES" : "NO", system_charset_info); protocol->store(hton->prepare ? "YES" : "NO", system_charset_info);
protocol->store(hton->savepoint_set ? "YES" : "NO", system_charset_info); protocol->store(hton->savepoint_set ? "YES" : "NO", system_charset_info);
@ -124,7 +124,7 @@ bool mysqld_show_storage_engines(THD *thd)
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
if (plugin_foreach(thd, show_handlerton, if (plugin_foreach(thd, show_handlerton,
MYSQL_STORAGE_ENGINE_PLUGIN, thd->variables.table_type)) MYSQL_STORAGE_ENGINE_PLUGIN, ha_default_handlerton(thd)))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
send_eof(thd); send_eof(thd);
@ -136,24 +136,26 @@ static int make_version_string(char *buf, int buf_length, uint version)
return my_snprintf(buf, buf_length, "%d.%d", version>>8,version&0xff); return my_snprintf(buf, buf_length, "%d.%d", version>>8,version&0xff);
} }
static my_bool show_plugins(THD *thd, st_plugin_int *plugin, static my_bool show_plugins(THD *thd, plugin_ref plugin,
void *arg) void *arg)
{ {
TABLE *table= (TABLE*) arg; TABLE *table= (TABLE*) arg;
struct st_mysql_plugin *plug= plugin->plugin; struct st_mysql_plugin *plug= plugin_decl(plugin);
struct st_plugin_dl *plugin_dl= plugin_dlib(plugin);
CHARSET_INFO *cs= system_charset_info; CHARSET_INFO *cs= system_charset_info;
char version_buf[20]; char version_buf[20];
restore_record(table, s->default_values); restore_record(table, s->default_values);
table->field[0]->store(plugin->name.str, plugin->name.length, cs); table->field[0]->store(plugin_name(plugin)->str,
plugin_name(plugin)->length, cs);
table->field[1]->store(version_buf, table->field[1]->store(version_buf,
make_version_string(version_buf, sizeof(version_buf), plug->version), make_version_string(version_buf, sizeof(version_buf), plug->version),
cs); cs);
switch (plugin->state) { switch (plugin_state(plugin)) {
/* case PLUGIN_IS_FREED: does not happen */ /* case PLUGIN_IS_FREED: does not happen */
case PLUGIN_IS_DELETED: case PLUGIN_IS_DELETED:
table->field[2]->store(STRING_WITH_LEN("DELETED"), cs); table->field[2]->store(STRING_WITH_LEN("DELETED"), cs);
@ -175,14 +177,13 @@ static my_bool show_plugins(THD *thd, st_plugin_int *plugin,
make_version_string(version_buf, sizeof(version_buf), make_version_string(version_buf, sizeof(version_buf),
*(uint *)plug->info), cs); *(uint *)plug->info), cs);
if (plugin->plugin_dl) if (plugin_dl)
{ {
table->field[5]->store(plugin->plugin_dl->dl.str, table->field[5]->store(plugin_dl->dl.str, plugin_dl->dl.length, cs);
plugin->plugin_dl->dl.length, cs);
table->field[5]->set_notnull(); table->field[5]->set_notnull();
table->field[6]->store(version_buf, table->field[6]->store(version_buf,
make_version_string(version_buf, sizeof(version_buf), make_version_string(version_buf, sizeof(version_buf),
plugin->plugin_dl->version), plugin_dl->version),
cs); cs);
table->field[6]->set_notnull(); table->field[6]->set_notnull();
} }
@ -1239,9 +1240,9 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
store_key_options(thd, packet, table, key_info); store_key_options(thd, packet, table, key_info);
if (key_info->parser) if (key_info->parser)
{ {
LEX_STRING *parser_name= plugin_name(key_info->parser);
packet->append(STRING_WITH_LEN(" /*!50100 WITH PARSER ")); packet->append(STRING_WITH_LEN(" /*!50100 WITH PARSER "));
append_identifier(thd, packet, key_info->parser->name.str, append_identifier(thd, packet, parser_name->str, parser_name->length);
key_info->parser->name.length);
packet->append(STRING_WITH_LEN(" */ ")); packet->append(STRING_WITH_LEN(" */ "));
} }
} }
@ -1936,6 +1937,18 @@ void init_status_vars()
sort_dynamic(&all_status_vars, show_var_cmp); 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 catch-all cleanup function, cleans up everything no matter what
@ -2066,6 +2079,8 @@ static bool show_status_array(THD *thd, const char *wild,
char *value=var->value; char *value=var->value;
const char *pos, *end; // We assign a lot of const's const char *pos, *end; // We assign a lot of const's
pthread_mutex_lock(&LOCK_global_system_variables);
if (show_type == SHOW_SYS) if (show_type == SHOW_SYS)
{ {
show_type= ((sys_var*) value)->show_type(); show_type= ((sys_var*) value)->show_type();
@ -2148,6 +2163,9 @@ static bool show_status_array(THD *thd, const char *wild,
system_charset_info); system_charset_info);
table->field[1]->store(pos, (uint32) (end - pos), system_charset_info); table->field[1]->store(pos, (uint32) (end - pos), system_charset_info);
table->field[1]->set_notnull(); table->field[1]->set_notnull();
pthread_mutex_unlock(&LOCK_global_system_variables);
if (schema_table_store_record(thd, table)) if (schema_table_store_record(thd, table))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
@ -2457,13 +2475,13 @@ struct st_add_schema_table
const char *wild; const char *wild;
}; };
static my_bool add_schema_table(THD *thd, st_plugin_int *plugin, static my_bool add_schema_table(THD *thd, plugin_ref plugin,
void* p_data) void* p_data)
{ {
st_add_schema_table *data= (st_add_schema_table *)p_data; st_add_schema_table *data= (st_add_schema_table *)p_data;
List<char> *file_list= data->files; List<char> *file_list= data->files;
const char *wild= data->wild; const char *wild= data->wild;
ST_SCHEMA_TABLE *schema_table= (ST_SCHEMA_TABLE *)plugin->data; ST_SCHEMA_TABLE *schema_table= plugin_data(plugin, ST_SCHEMA_TABLE *);
DBUG_ENTER("add_schema_table"); DBUG_ENTER("add_schema_table");
if (schema_table->hidden) if (schema_table->hidden)
@ -3011,7 +3029,7 @@ static int get_schema_tables_record(THD *thd, struct st_table_list *tables,
ha_row_type[(uint) share->row_type], ha_row_type[(uint) share->row_type],
NullS); NullS);
#ifdef WITH_PARTITION_STORAGE_ENGINE #ifdef WITH_PARTITION_STORAGE_ENGINE
if (show_table->s->db_type == partition_hton && if (show_table->s->db_type() == partition_hton &&
show_table->part_info != NULL && show_table->part_info != NULL &&
show_table->part_info->no_parts > 0) show_table->part_info->no_parts > 0)
ptr= strmov(ptr, " partitioned"); ptr= strmov(ptr, " partitioned");
@ -3286,19 +3304,20 @@ int fill_schema_charsets(THD *thd, TABLE_LIST *tables, COND *cond)
} }
static my_bool iter_schema_engines(THD *thd, st_plugin_int *plugin, static my_bool iter_schema_engines(THD *thd, plugin_ref plugin,
void *ptable) void *ptable)
{ {
TABLE *table= (TABLE *) ptable; TABLE *table= (TABLE *) ptable;
handlerton *hton= (handlerton *)plugin->data; handlerton *hton= plugin_data(plugin, handlerton *);
const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : NullS; const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : NullS;
CHARSET_INFO *scs= system_charset_info; CHARSET_INFO *scs= system_charset_info;
DBUG_ENTER("iter_schema_engines"); DBUG_ENTER("iter_schema_engines");
if (!(hton->flags & HTON_HIDDEN)) if (!(hton->flags & HTON_HIDDEN))
{ {
LEX_STRING *name= plugin_name(plugin);
if (!(wild && wild[0] && if (!(wild && wild[0] &&
wild_case_compare(scs, plugin->name.str,wild))) wild_case_compare(scs, name->str,wild)))
{ {
LEX_STRING state[2]= {{ C_STRING_WITH_LEN("ENABLED") }, LEX_STRING state[2]= {{ C_STRING_WITH_LEN("ENABLED") },
{ C_STRING_WITH_LEN("DISABLED") }}; { C_STRING_WITH_LEN("DISABLED") }};
@ -3307,11 +3326,11 @@ static my_bool iter_schema_engines(THD *thd, st_plugin_int *plugin,
LEX_STRING *tmp; LEX_STRING *tmp;
restore_record(table, s->default_values); restore_record(table, s->default_values);
table->field[0]->store(plugin->name.str, plugin->name.length, scs); table->field[0]->store(name->str, name->length, scs);
tmp= &state[test(hton->state)]; tmp= &state[test(hton->state)];
table->field[1]->store(tmp->str, tmp->length, scs); table->field[1]->store(tmp->str, tmp->length, scs);
table->field[2]->store(plugin->plugin->descr, table->field[2]->store(plugin_decl(plugin)->descr,
strlen(plugin->plugin->descr), scs); strlen(plugin_decl(plugin)->descr), scs);
tmp= &yesno[test(hton->commit)]; tmp= &yesno[test(hton->commit)];
table->field[3]->store(tmp->str, tmp->length, scs); table->field[3]->store(tmp->str, tmp->length, scs);
tmp= &yesno[test(hton->prepare)]; tmp= &yesno[test(hton->prepare)];
@ -4497,10 +4516,10 @@ int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond)
int res= 0; int res= 0;
LEX *lex= thd->lex; LEX *lex= thd->lex;
const char *wild= lex->wild ? lex->wild->ptr() : NullS; const char *wild= lex->wild ? lex->wild->ptr() : NullS;
pthread_mutex_lock(&LOCK_global_system_variables); rw_rdlock(&LOCK_system_variables_hash);
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); lex->option_type, 0, "", tables->table, 0);
pthread_mutex_unlock(&LOCK_global_system_variables); rw_unlock(&LOCK_system_variables_hash);
DBUG_RETURN(res); DBUG_RETURN(res);
} }
@ -4616,12 +4635,12 @@ struct schema_table_ref
0 table not found 0 table not found
1 found the schema table 1 found the schema table
*/ */
static my_bool find_schema_table_in_plugin(THD *thd, st_plugin_int *plugin, static my_bool find_schema_table_in_plugin(THD *thd, plugin_ref plugin,
void* p_table) void* p_table)
{ {
schema_table_ref *p_schema_table= (schema_table_ref *)p_table; schema_table_ref *p_schema_table= (schema_table_ref *)p_table;
const char* table_name= p_schema_table->table_name; const char* table_name= p_schema_table->table_name;
ST_SCHEMA_TABLE *schema_table= (ST_SCHEMA_TABLE *)plugin->data; ST_SCHEMA_TABLE *schema_table= plugin_data(plugin, ST_SCHEMA_TABLE *);
DBUG_ENTER("find_schema_table_in_plugin"); DBUG_ENTER("find_schema_table_in_plugin");
if (!my_strcasecmp(system_charset_info, if (!my_strcasecmp(system_charset_info,
@ -5164,12 +5183,12 @@ struct run_hton_fill_schema_files_args
COND *cond; COND *cond;
}; };
static my_bool run_hton_fill_schema_files(THD *thd, st_plugin_int *plugin, static my_bool run_hton_fill_schema_files(THD *thd, plugin_ref plugin,
void *arg) void *arg)
{ {
struct run_hton_fill_schema_files_args *args= struct run_hton_fill_schema_files_args *args=
(run_hton_fill_schema_files_args *) arg; (run_hton_fill_schema_files_args *) arg;
handlerton *hton= (handlerton *)plugin->data; handlerton *hton= plugin_data(plugin, handlerton *);
if(hton->fill_files_table && hton->state == SHOW_OPTION_YES) if(hton->fill_files_table && hton->state == SHOW_OPTION_YES)
hton->fill_files_table(hton, thd, args->tables, args->cond); hton->fill_files_table(hton, thd, args->tables, args->cond);
return false; return false;
@ -5335,10 +5354,10 @@ int fill_schema_global_variables(THD *thd, TABLE_LIST *tables, COND *cond)
int res= 0; int res= 0;
DBUG_ENTER("fill_schema_global_variables"); DBUG_ENTER("fill_schema_global_variables");
pthread_mutex_lock(&LOCK_global_system_variables); rw_rdlock(&LOCK_system_variables_hash);
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); NULL, "", tables->table, 1);
pthread_mutex_unlock(&LOCK_global_system_variables); rw_unlock(&LOCK_system_variables_hash);
DBUG_RETURN(res); DBUG_RETURN(res);
} }
@ -5348,10 +5367,10 @@ int fill_schema_session_variables(THD *thd, TABLE_LIST *tables, COND *cond)
int res= 0; int res= 0;
DBUG_ENTER("fill_schema_session_variables"); DBUG_ENTER("fill_schema_session_variables");
pthread_mutex_lock(&LOCK_global_system_variables); rw_rdlock(&LOCK_system_variables_hash);
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); NULL, "", tables->table, 1);
pthread_mutex_unlock(&LOCK_global_system_variables); rw_unlock(&LOCK_system_variables_hash);
DBUG_RETURN(res); DBUG_RETURN(res);
} }

View File

@ -40,8 +40,7 @@ static int copy_data_between_tables(TABLE *from,TABLE *to,
enum enum_enable_or_disable keys_onoff); enum enum_enable_or_disable keys_onoff);
static bool prepare_blob_field(THD *thd, create_field *sql_field); static bool prepare_blob_field(THD *thd, create_field *sql_field);
static bool check_engine(THD *thd, const char *table_name, static bool check_engine(THD *, const char *, HA_CREATE_INFO *);
HA_CREATE_INFO *create_info);
static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
List<create_field> *fields, List<create_field> *fields,
List<Key> *keys, bool tmp_table, List<Key> *keys, bool tmp_table,
@ -662,16 +661,14 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry)
frm_action= TRUE; frm_action= TRUE;
else else
{ {
TABLE_SHARE dummy; plugin_ref plugin= ha_resolve_by_name(thd, &handler_name);
if (!plugin)
hton= ha_resolve_by_name(thd, &handler_name);
if (!hton)
{ {
my_error(ER_ILLEGAL_HA, MYF(0), ddl_log_entry->handler_name); my_error(ER_ILLEGAL_HA, MYF(0), ddl_log_entry->handler_name);
goto error; goto error;
} }
bzero(&dummy, sizeof(TABLE_SHARE)); hton= plugin_data(plugin, handlerton*);
file= get_new_handler(&dummy, &mem_root, hton); file= get_new_handler((TABLE_SHARE*)0, &mem_root, hton);
if (!file) if (!file)
{ {
mem_alloc_error(sizeof(handler)); mem_alloc_error(sizeof(handler));
@ -1635,7 +1632,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
TABLE_SHARE *share; TABLE_SHARE *share;
table->db_type= NULL; table->db_type= NULL;
if ((share= get_cached_table_share(table->db, table->table_name))) if ((share= get_cached_table_share(table->db, table->table_name)))
table->db_type= share->db_type; table->db_type= share->db_type();
/* Disable drop of enabled log tables */ /* Disable drop of enabled log tables */
if (share && share->log_table && if (share && share->log_table &&
@ -5081,7 +5078,7 @@ static uint compare_tables(TABLE *table, List<create_field> *create_list,
See BUG#6236. See BUG#6236.
*/ */
if (table->s->fields != create_list->elements || if (table->s->fields != create_list->elements ||
table->s->db_type != create_info->db_type || table->s->db_type() != create_info->db_type ||
table->s->tmp_table || table->s->tmp_table ||
create_info->used_fields & HA_CREATE_USED_ENGINE || create_info->used_fields & HA_CREATE_USED_ENGINE ||
create_info->used_fields & HA_CREATE_USED_CHARSET || create_info->used_fields & HA_CREATE_USED_CHARSET ||
@ -5540,7 +5537,7 @@ view_err:
new_name= table_name; new_name= table_name;
} }
old_db_type= table->s->db_type; old_db_type= table->s->db_type();
if (!create_info->db_type) if (!create_info->db_type)
{ {
#ifdef WITH_PARTITION_STORAGE_ENGINE #ifdef WITH_PARTITION_STORAGE_ENGINE
@ -6054,7 +6051,7 @@ view_err:
} }
if (thd->variables.old_alter_table if (thd->variables.old_alter_table
|| (table->s->db_type != create_info->db_type) || (table->s->db_type() != create_info->db_type)
#ifdef WITH_PARTITION_STORAGE_ENGINE #ifdef WITH_PARTITION_STORAGE_ENGINE
|| partition_changed || partition_changed
#endif #endif
@ -6092,8 +6089,8 @@ view_err:
uint *idx_p; uint *idx_p;
uint *idx_end_p; uint *idx_end_p;
if (table->s->db_type->alter_table_flags) if (table->s->db_type()->alter_table_flags)
alter_flags= table->s->db_type->alter_table_flags(alter_info->flags); alter_flags= table->s->db_type()->alter_table_flags(alter_info->flags);
DBUG_PRINT("info", ("alter_flags: %lu", alter_flags)); DBUG_PRINT("info", ("alter_flags: %lu", alter_flags));
/* Check dropped indexes. */ /* Check dropped indexes. */
for (idx_p= index_drop_buffer, idx_end_p= idx_p + index_drop_count; for (idx_p= index_drop_buffer, idx_end_p= idx_p + index_drop_count;
@ -7110,7 +7107,7 @@ static bool check_engine(THD *thd, const char *table_name,
if (req_engine && req_engine != *new_engine) if (req_engine && req_engine != *new_engine)
{ {
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_WARN_USING_OTHER_HANDLER, ER_WARN_USING_OTHER_HANDLER,
ER(ER_WARN_USING_OTHER_HANDLER), ER(ER_WARN_USING_OTHER_HANDLER),
ha_resolve_storage_engine_name(*new_engine), ha_resolve_storage_engine_name(*new_engine),
@ -7122,7 +7119,7 @@ static bool check_engine(THD *thd, const char *table_name,
if (create_info->used_fields & HA_CREATE_USED_ENGINE) if (create_info->used_fields & HA_CREATE_USED_ENGINE)
{ {
my_error(ER_ILLEGAL_HA_CREATE_OPTION, MYF(0), my_error(ER_ILLEGAL_HA_CREATE_OPTION, MYF(0),
hton2plugin[(*new_engine)->slot]->name.str, "TEMPORARY"); ha_resolve_storage_engine_name(*new_engine), "TEMPORARY");
*new_engine= 0; *new_engine= 0;
return TRUE; return TRUE;
} }

View File

@ -34,7 +34,7 @@ int mysql_alter_tablespace(THD *thd, st_alter_tablespace *ts_info)
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_WARN_USING_OTHER_HANDLER, ER_WARN_USING_OTHER_HANDLER,
ER(ER_WARN_USING_OTHER_HANDLER), ER(ER_WARN_USING_OTHER_HANDLER),
hton2plugin[hton->slot]->name.str, ha_resolve_storage_engine_name(hton),
ts_info->tablespace_name ? ts_info->tablespace_name ts_info->tablespace_name ? ts_info->tablespace_name
: ts_info->logfile_group_name); : ts_info->logfile_group_name);
} }
@ -63,7 +63,7 @@ int mysql_alter_tablespace(THD *thd, st_alter_tablespace *ts_info)
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_ILLEGAL_HA_CREATE_OPTION, ER_ILLEGAL_HA_CREATE_OPTION,
ER(ER_ILLEGAL_HA_CREATE_OPTION), ER(ER_ILLEGAL_HA_CREATE_OPTION),
hton2plugin[hton->slot]->name.str, ha_resolve_storage_engine_name(hton),
"TABLESPACE or LOGFILE GROUP"); "TABLESPACE or LOGFILE GROUP");
} }
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())

View File

@ -49,9 +49,9 @@ const LEX_STRING null_lex_str={0,0};
#define MYSQL_YYABORT \ #define MYSQL_YYABORT \
do \ do \
{ \ { \
LEX::cleanup_lex_after_parse_error(YYTHD);\ LEX::cleanup_lex_after_parse_error(YYTHD);\
YYABORT; \ YYABORT; \
} while (0) } while (0)
#define MYSQL_YYABORT_UNLESS(A) \ #define MYSQL_YYABORT_UNLESS(A) \
@ -1591,14 +1591,26 @@ create:
lex->change=NullS; lex->change=NullS;
bzero((char*) &lex->create_info,sizeof(lex->create_info)); bzero((char*) &lex->create_info,sizeof(lex->create_info));
lex->create_info.options=$2 | $4; lex->create_info.options=$2 | $4;
lex->create_info.db_type= lex->thd->variables.table_type; lex->create_info.db_type= ha_default_handlerton(thd);
lex->create_info.default_table_charset= NULL; lex->create_info.default_table_charset= NULL;
lex->name.str= 0; lex->name.str= 0;
lex->name.length= 0; lex->name.length= 0;
lex->like_name= 0; lex->like_name= 0;
} }
create2 create2
{ Lex->current_select= &Lex->select_lex; } {
LEX *lex= YYTHD->lex;
lex->current_select= &lex->select_lex;
if (!lex->create_info.db_type)
{
lex->create_info.db_type= ha_default_handlerton(YYTHD);
push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_USING_OTHER_HANDLER,
ER(ER_WARN_USING_OTHER_HANDLER),
ha_resolve_storage_engine_name(lex->create_info.db_type),
$5->table.str);
}
}
| CREATE opt_unique_or_fulltext INDEX_SYM ident key_alg ON | CREATE opt_unique_or_fulltext INDEX_SYM ident key_alg ON
table_ident table_ident
{ {
@ -3669,6 +3681,13 @@ partitioning:
{ {
#ifdef WITH_PARTITION_STORAGE_ENGINE #ifdef WITH_PARTITION_STORAGE_ENGINE
LEX *lex= Lex; LEX *lex= Lex;
LEX_STRING partition_name={C_STRING_WITH_LEN("partition")};
if (!plugin_is_ready(&partition_name, MYSQL_STORAGE_ENGINE_PLUGIN))
{
my_error(ER_FEATURE_DISABLED, MYF(0),
"partitioning", "--with-partition");
MYSQL_YYABORT;
}
lex->part_info= new partition_info(); lex->part_info= new partition_info();
if (!lex->part_info) if (!lex->part_info)
{ {
@ -4384,35 +4403,42 @@ default_collation:
Lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET; Lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
}; };
known_storage_engines:
ident_or_text
{
$$ = ha_resolve_by_name(YYTHD, &$1);
if ($$ == NULL)
{
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str);
MYSQL_YYABORT;
}
}
;
storage_engines: storage_engines:
ident_or_text ident_or_text
{ {
$$ = ha_resolve_by_name(YYTHD, &$1); plugin_ref plugin= ha_resolve_by_name(YYTHD, &$1);
if ($$ == NULL)
if (plugin)
$$= plugin_data(plugin, handlerton*);
else
{ {
if (YYTHD->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION) if (YYTHD->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION)
{ {
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str); my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
$$= 0;
push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_UNKNOWN_STORAGE_ENGINE, ER_UNKNOWN_STORAGE_ENGINE,
ER(ER_UNKNOWN_STORAGE_ENGINE), $1.str); ER(ER_UNKNOWN_STORAGE_ENGINE),
$1.str);
} }
}; }
;
known_storage_engines:
ident_or_text
{
plugin_ref plugin;
if ((plugin= ha_resolve_by_name(YYTHD, &$1)))
$$= plugin_data(plugin, handlerton*);
else
{
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str);
MYSQL_YYABORT;
}
}
;
row_types: row_types:
DEFAULT { $$= ROW_TYPE_DEFAULT; } DEFAULT { $$= ROW_TYPE_DEFAULT; }
@ -5155,7 +5181,7 @@ alter:
lex->spname= $3; lex->spname= $3;
} }
| ALTER view_algorithm definer | ALTER view_algorithm definer
{ {
Lex->create_view_mode= VIEW_ALTER; Lex->create_view_mode= VIEW_ALTER;
} }
view_tail view_tail
@ -5169,10 +5195,10 @@ alter:
{ {
LEX *lex= Lex; LEX *lex= Lex;
lex->create_view_algorithm= VIEW_ALGORITHM_UNDEFINED; lex->create_view_algorithm= VIEW_ALGORITHM_UNDEFINED;
lex->create_view_mode= VIEW_ALTER; lex->create_view_mode= VIEW_ALTER;
} }
view_tail view_tail
{} {}
| ALTER definer EVENT_SYM sp_name | ALTER definer EVENT_SYM sp_name
/* /*
BE CAREFUL when you add a new rule to update the block where BE CAREFUL when you add a new rule to update the block where
@ -5982,7 +6008,7 @@ preload_keys:
; ;
cache_keys_spec: cache_keys_spec:
{ {
Lex->select_lex.alloc_index_hints(YYTHD); Lex->select_lex.alloc_index_hints(YYTHD);
Select->set_index_hint_type(INDEX_HINT_USE, Select->set_index_hint_type(INDEX_HINT_USE,
global_system_variables.old_mode ? global_system_variables.old_mode ?
@ -6089,7 +6115,7 @@ select_into:
| select_from into; | select_from into;
select_from: select_from:
FROM join_table_list where_clause group_clause having_clause FROM join_table_list where_clause group_clause having_clause
opt_order_clause opt_limit_clause procedure_clause opt_order_clause opt_limit_clause procedure_clause
{ {
Select->context.table_list= Select->context.table_list=
@ -6296,8 +6322,8 @@ bool_test:
{ $$= new (YYTHD->mem_root) Item_func_isfalse($1); } { $$= new (YYTHD->mem_root) Item_func_isfalse($1); }
| bool_pri IS not FALSE_SYM | bool_pri IS not FALSE_SYM
{ $$= new (YYTHD->mem_root) Item_func_isnotfalse($1); } { $$= new (YYTHD->mem_root) Item_func_isnotfalse($1); }
| bool_pri IS UNKNOWN_SYM { $$= new Item_func_isnull($1); } | bool_pri IS UNKNOWN_SYM { $$= new Item_func_isnull($1); }
| bool_pri IS not UNKNOWN_SYM { $$= new Item_func_isnotnull($1); } | bool_pri IS not UNKNOWN_SYM { $$= new Item_func_isnotnull($1); }
| bool_pri | bool_pri
; ;
@ -6312,11 +6338,11 @@ bool_pri:
| predicate ; | predicate ;
predicate: predicate:
bit_expr IN_SYM '(' subselect ')' bit_expr IN_SYM '(' subselect ')'
{ {
$$= new (YYTHD->mem_root) Item_in_subselect($1, $4); $$= new (YYTHD->mem_root) Item_in_subselect($1, $4);
} }
| bit_expr not IN_SYM '(' subselect ')' | bit_expr not IN_SYM '(' subselect ')'
{ {
THD *thd= YYTHD; THD *thd= YYTHD;
Item *item= new (thd->mem_root) Item_in_subselect($1, $5); Item *item= new (thd->mem_root) Item_in_subselect($1, $5);
@ -6326,23 +6352,23 @@ predicate:
{ {
$$= handle_sql2003_note184_exception(YYTHD, $1, true, $4); $$= handle_sql2003_note184_exception(YYTHD, $1, true, $4);
} }
| bit_expr IN_SYM '(' expr ',' expr_list ')' | bit_expr IN_SYM '(' expr ',' expr_list ')'
{ {
$6->push_front($4); $6->push_front($4);
$6->push_front($1); $6->push_front($1);
$$= new (YYTHD->mem_root) Item_func_in(*$6); $$= new (YYTHD->mem_root) Item_func_in(*$6);
} }
| bit_expr not IN_SYM '(' expr ')' | bit_expr not IN_SYM '(' expr ')'
{ {
$$= handle_sql2003_note184_exception(YYTHD, $1, false, $5); $$= handle_sql2003_note184_exception(YYTHD, $1, false, $5);
} }
| bit_expr not IN_SYM '(' expr ',' expr_list ')' | bit_expr not IN_SYM '(' expr ',' expr_list ')'
{ {
$7->push_front($5); $7->push_front($5);
$7->push_front($1); $7->push_front($1);
Item_func_in *item = new (YYTHD->mem_root) Item_func_in(*$7); Item_func_in *item = new (YYTHD->mem_root) Item_func_in(*$7);
item->negate(); item->negate();
$$= item; $$= item;
} }
| bit_expr BETWEEN_SYM bit_expr AND_SYM predicate | bit_expr BETWEEN_SYM bit_expr AND_SYM predicate
{ $$= new Item_func_between($1,$3,$5); } { $$= new Item_func_between($1,$3,$5); }
@ -7546,10 +7572,10 @@ opt_outer:
index_hint_clause: index_hint_clause:
/* empty */ /* empty */
{ {
$$= global_system_variables.old_mode ? $$= global_system_variables.old_mode ?
INDEX_HINT_MASK_JOIN : INDEX_HINT_MASK_ALL; INDEX_HINT_MASK_JOIN : INDEX_HINT_MASK_ALL;
} }
| FOR_SYM JOIN_SYM { $$= INDEX_HINT_MASK_JOIN; } | FOR_SYM JOIN_SYM { $$= INDEX_HINT_MASK_JOIN; }
| FOR_SYM ORDER_SYM BY { $$= INDEX_HINT_MASK_ORDER; } | FOR_SYM ORDER_SYM BY { $$= INDEX_HINT_MASK_ORDER; }
| FOR_SYM GROUP_SYM BY { $$= INDEX_HINT_MASK_GROUP; } | FOR_SYM GROUP_SYM BY { $$= INDEX_HINT_MASK_GROUP; }
@ -7562,12 +7588,12 @@ index_hint_type:
index_hint_definition: index_hint_definition:
index_hint_type key_or_index index_hint_clause index_hint_type key_or_index index_hint_clause
{ {
Select->set_index_hint_type($1, $3); Select->set_index_hint_type($1, $3);
} }
'(' key_usage_list ')' '(' key_usage_list ')'
| USE_SYM key_or_index index_hint_clause | USE_SYM key_or_index index_hint_clause
{ {
Select->set_index_hint_type(INDEX_HINT_USE, $3); Select->set_index_hint_type(INDEX_HINT_USE, $3);
} }
'(' opt_key_usage_list ')' '(' opt_key_usage_list ')'
@ -7576,12 +7602,12 @@ index_hint_definition:
index_hints_list: index_hints_list:
index_hint_definition index_hint_definition
| index_hints_list index_hint_definition | index_hints_list index_hint_definition
; ;
opt_index_hints_list: opt_index_hints_list:
/* empty */ /* empty */
| { Select->alloc_index_hints(YYTHD); } index_hints_list | { Select->alloc_index_hints(YYTHD); } index_hints_list
; ;
opt_key_definition: opt_key_definition:
{ Select->clear_index_hints(); } { Select->clear_index_hints(); }
@ -7595,7 +7621,7 @@ opt_key_usage_list:
key_usage_element: key_usage_element:
ident { Select->add_index_hint(YYTHD, $1.str, $1.length); } ident { Select->add_index_hint(YYTHD, $1.str, $1.length); }
| PRIMARY_SYM | PRIMARY_SYM
{ {
Select->add_index_hint(YYTHD, (char *)"PRIMARY", 7); Select->add_index_hint(YYTHD, (char *)"PRIMARY", 7);
} }
@ -8632,7 +8658,7 @@ show_param:
{ Lex->create_info.db_type= NULL; } { Lex->create_info.db_type= NULL; }
| opt_full COLUMNS from_or_in table_ident opt_db wild_and_where | opt_full COLUMNS from_or_in table_ident opt_db wild_and_where
{ {
LEX *lex= Lex; LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_FIELDS; lex->sql_command= SQLCOM_SHOW_FIELDS;
if ($5) if ($5)
$4->change_db($5); $4->change_db($5);
@ -10271,7 +10297,7 @@ sys_option_value:
LEX *lex=Lex; LEX *lex=Lex;
lex->option_type= $1; lex->option_type= $1;
lex->var_list.push_back(new set_var(lex->option_type, lex->var_list.push_back(new set_var(lex->option_type,
find_sys_var("tx_isolation"), find_sys_var(YYTHD, "tx_isolation"),
&null_lex_str, &null_lex_str,
new Item_int((int32) $5))); new Item_int((int32) $5)));
} }
@ -10360,7 +10386,7 @@ internal_variable_name:
if (!spc || !(spv = spc->find_variable(&$1))) if (!spc || !(spv = spc->find_variable(&$1)))
{ {
/* Not an SP local variable */ /* Not an SP local variable */
sys_var *tmp=find_sys_var($1.str, $1.length); sys_var *tmp=find_sys_var(YYTHD, $1.str, $1.length);
if (!tmp) if (!tmp)
MYSQL_YYABORT; MYSQL_YYABORT;
$$.var= tmp; $$.var= tmp;
@ -10415,7 +10441,7 @@ internal_variable_name:
} }
else else
{ {
sys_var *tmp=find_sys_var($3.str, $3.length); sys_var *tmp=find_sys_var(YYTHD, $3.str, $3.length);
if (!tmp) if (!tmp)
MYSQL_YYABORT; MYSQL_YYABORT;
if (!tmp->is_struct()) if (!tmp->is_struct())
@ -10426,7 +10452,7 @@ internal_variable_name:
} }
| DEFAULT '.' ident | DEFAULT '.' ident
{ {
sys_var *tmp=find_sys_var($3.str, $3.length); sys_var *tmp=find_sys_var(YYTHD, $3.str, $3.length);
if (!tmp) if (!tmp)
MYSQL_YYABORT; MYSQL_YYABORT;
if (!tmp->is_struct()) if (!tmp->is_struct())

View File

@ -83,7 +83,7 @@ typedef struct st_key {
*/ */
union union
{ {
struct st_plugin_int *parser; /* Fulltext [pre]parser */ plugin_ref parser; /* Fulltext [pre]parser */
LEX_STRING *parser_name; /* Fulltext [pre]parser name */ LEX_STRING *parser_name; /* Fulltext [pre]parser name */
}; };
KEY_PART_INFO *key_part; KEY_PART_INFO *key_part;

View File

@ -237,6 +237,9 @@ void free_table_share(TABLE_SHARE *share)
pthread_cond_destroy(&share->cond); pthread_cond_destroy(&share->cond);
} }
hash_free(&share->name_hash); hash_free(&share->name_hash);
plugin_unlock(NULL, share->db_plugin);
share->db_plugin= NULL;
/* We must copy mem_root from share because share is allocated through it */ /* We must copy mem_root from share because share is allocated through it */
memcpy((char*) &mem_root, (char*) &share->mem_root, sizeof(mem_root)); memcpy((char*) &mem_root, (char*) &share->mem_root, sizeof(mem_root));
@ -500,7 +503,15 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
DBUG_PRINT("info", ("default_part_db_type = %u", head[61])); DBUG_PRINT("info", ("default_part_db_type = %u", head[61]));
#endif #endif
legacy_db_type= (enum legacy_db_type) (uint) *(head+3); legacy_db_type= (enum legacy_db_type) (uint) *(head+3);
share->db_type= ha_checktype(thd, legacy_db_type, 0, 0); DBUG_ASSERT(share->db_plugin == NULL);
/*
if the storage engine is dynamic, no point in resolving it by its
dynamically allocated legacy_db_type. We will resolve it later by name.
*/
if (legacy_db_type > DB_TYPE_UNKNOWN &&
legacy_db_type < DB_TYPE_FIRST_DYNAMIC)
share->db_plugin= ha_lock_engine(NULL,
ha_checktype(thd, legacy_db_type, 0, 0));
share->db_create_options= db_create_options= uint2korr(head+30); share->db_create_options= db_create_options= uint2korr(head+30);
share->db_options_in_use= share->db_create_options; share->db_options_in_use= share->db_create_options;
share->mysql_version= uint4korr(head+51); share->mysql_version= uint4korr(head+51);
@ -659,24 +670,47 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
{ {
uint str_db_type_length= uint2korr(next_chunk); uint str_db_type_length= uint2korr(next_chunk);
LEX_STRING name= { next_chunk + 2, str_db_type_length }; LEX_STRING name= { next_chunk + 2, str_db_type_length };
handlerton *tmp_db_type= ha_resolve_by_name(thd, &name); plugin_ref tmp_plugin= ha_resolve_by_name(thd, &name);
if (tmp_db_type != NULL) if (tmp_plugin != NULL && !plugin_equals(tmp_plugin, share->db_plugin))
{ {
share->db_type= tmp_db_type; if (legacy_db_type > DB_TYPE_UNKNOWN &&
legacy_db_type < DB_TYPE_FIRST_DYNAMIC &&
legacy_db_type != ha_legacy_type(
plugin_data(tmp_plugin, handlerton *)))
{
/* bad file, legacy_db_type did not match the name */
my_free(buff, MYF(0));
goto err;
}
/*
tmp_plugin is locked with a local lock.
we unlock the old value of share->db_plugin before
replacing it with a globally locked version of tmp_plugin
*/
plugin_unlock(NULL, share->db_plugin);
share->db_plugin= my_plugin_lock(NULL, &tmp_plugin);
DBUG_PRINT("info", ("setting dbtype to '%.*s' (%d)", DBUG_PRINT("info", ("setting dbtype to '%.*s' (%d)",
str_db_type_length, next_chunk + 2, str_db_type_length, next_chunk + 2,
ha_legacy_type(share->db_type))); ha_legacy_type(share->db_type())));
} }
#ifdef WITH_PARTITION_STORAGE_ENGINE #ifdef WITH_PARTITION_STORAGE_ENGINE
else else
{ {
if (!strncmp(next_chunk + 2, "partition", str_db_type_length)) LEX_STRING pname= { C_STRING_WITH_LEN( "partition" ) };
if (str_db_type_length == pname.length &&
!strncmp(next_chunk + 2, pname.str, pname.length))
{ {
/* Use partition handler */ /*
share->db_type= partition_hton; Use partition handler
tmp_plugin is locked with a local lock.
we unlock the old value of share->db_plugin before
replacing it with a globally locked version of tmp_plugin
*/
plugin_unlock(NULL, share->db_plugin);
share->db_plugin= ha_lock_engine(NULL, partition_hton);
DBUG_PRINT("info", ("setting dbtype to '%.*s' (%d)", DBUG_PRINT("info", ("setting dbtype to '%.*s' (%d)",
str_db_type_length, next_chunk + 2, str_db_type_length, next_chunk + 2,
ha_legacy_type(share->db_type))); ha_legacy_type(share->db_type())));
} }
} }
#endif #endif
@ -742,7 +776,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
} }
parser_name.str= next_chunk; parser_name.str= next_chunk;
parser_name.length= strlen(next_chunk); parser_name.length= strlen(next_chunk);
keyinfo->parser= plugin_lock(&parser_name, MYSQL_FTPARSER_PLUGIN); keyinfo->parser= my_plugin_lock_by_name(NULL, &parser_name,
MYSQL_FTPARSER_PLUGIN);
if (! keyinfo->parser) if (! keyinfo->parser)
{ {
my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), parser_name.str); my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), parser_name.str);
@ -858,7 +893,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
/* Allocate handler */ /* Allocate handler */
if (!(handler_file= get_new_handler(share, thd->mem_root, if (!(handler_file= get_new_handler(share, thd->mem_root,
share->db_type))) share->db_type())))
goto err; goto err;
record= (char*) share->default_values-1; /* Fieldstart = 1 */ record= (char*) share->default_values-1; /* Fieldstart = 1 */
@ -1392,7 +1427,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
/* Allocate handler */ /* Allocate handler */
if (!(outparam->file= get_new_handler(share, &outparam->mem_root, if (!(outparam->file= get_new_handler(share, &outparam->mem_root,
share->db_type))) share->db_type())))
goto err; goto err;
error= 4; error= 4;
@ -1676,7 +1711,7 @@ int closefrm(register TABLE *table, bool free_share)
{ {
if (key_info->flags & HA_USES_PARSER) if (key_info->flags & HA_USES_PARSER)
{ {
plugin_unlock(key_info->parser); plugin_unlock(NULL, key_info->parser);
key_info->flags= 0; key_info->flags= 0;
} }
} }
@ -1887,10 +1922,10 @@ void open_table_error(TABLE_SHARE *share, int error, int db_errno, int errarg)
handler *file= 0; handler *file= 0;
const char *datext= ""; const char *datext= "";
if (share->db_type != NULL) if (share->db_type() != NULL)
{ {
if ((file= get_new_handler(share, current_thd->mem_root, if ((file= get_new_handler(share, current_thd->mem_root,
share->db_type))) share->db_type())))
{ {
if (!(datext= *file->bas_ext())) if (!(datext= *file->bas_ext()))
datext= ""; datext= "";

View File

@ -172,7 +172,12 @@ typedef struct st_table_share
ulong timestamp_offset; /* Set to offset+1 of record */ ulong timestamp_offset; /* Set to offset+1 of record */
ulong reclength; /* Recordlength */ ulong reclength; /* Recordlength */
handlerton *db_type; /* table_type for handler */ plugin_ref db_plugin; /* storage engine plugin */
inline handlerton *db_type() const /* table_type for handler */
{
// DBUG_ASSERT(db_plugin);
return db_plugin ? plugin_data(db_plugin, handlerton*) : NULL;
}
enum row_type row_type; /* How rows are stored */ enum row_type row_type; /* How rows are stored */
enum tmp_table_type tmp_table; enum tmp_table_type tmp_table;

View File

@ -723,6 +723,11 @@ int ha_example::external_lock(THD *thd, int lock_type)
Called from lock.cc by get_lock_data(). Called from lock.cc by get_lock_data().
@note
In this method one should NEVER rely on table->in_use, it may, in fact,
refer to a different thread! (this happens if get_lock_data() is called
from mysql_lock_abort_for_thread() function)
@see @see
get_lock_data() in lock.cc get_lock_data() in lock.cc
*/ */

View File

@ -1832,7 +1832,7 @@ int ha_federated::write_row(byte *buf)
values_string.length(0); values_string.length(0);
insert_string.length(0); insert_string.length(0);
insert_field_value_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) if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time(); table->timestamp_field->set_time();
@ -2299,8 +2299,7 @@ int ha_federated::index_read_idx_with_result_set(byte *buf, uint index,
*result= 0; // In case of errors *result= 0; // In case of errors
index_string.length(0); index_string.length(0);
sql_query.length(0); sql_query.length(0);
statistic_increment(table->in_use->status_var.ha_read_key_count, ha_statistic_increment(&SSV::ha_read_key_count);
&LOCK_status);
sql_query.append(share->select_query); sql_query.append(share->select_query);
@ -2414,8 +2413,7 @@ int ha_federated::read_range_next()
int ha_federated::index_next(byte *buf) int ha_federated::index_next(byte *buf)
{ {
DBUG_ENTER("ha_federated::index_next"); DBUG_ENTER("ha_federated::index_next");
statistic_increment(table->in_use->status_var.ha_read_next_count, ha_statistic_increment(&SSV::ha_read_next_count);
&LOCK_status);
DBUG_RETURN(read_next(buf, stored_result)); DBUG_RETURN(read_next(buf, stored_result));
} }
@ -2616,8 +2614,7 @@ int ha_federated::rnd_pos(byte *buf, byte *pos)
{ {
int result; int result;
DBUG_ENTER("ha_federated::rnd_pos"); DBUG_ENTER("ha_federated::rnd_pos");
statistic_increment(table->in_use->status_var.ha_read_rnd_count, ha_statistic_increment(&SSV::ha_read_rnd_count);
&LOCK_status);
if (table->s->primary_key != MAX_KEY) if (table->s->primary_key != MAX_KEY)
{ {
/* We have a primary key, so use index_read_idx to find row */ /* We have a primary key, so use index_read_idx to find row */

View File

@ -181,7 +181,7 @@ void ha_heap::update_key_stats()
int ha_heap::write_row(byte * buf) int ha_heap::write_row(byte * buf)
{ {
int res; 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) if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time(); table->timestamp_field->set_time();
if (table->next_number_field && buf == table->record[0]) if (table->next_number_field && buf == table->record[0])
@ -205,7 +205,7 @@ int ha_heap::write_row(byte * buf)
int ha_heap::update_row(const byte * old_data, byte * new_data) int ha_heap::update_row(const byte * old_data, byte * new_data)
{ {
int res; 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) if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time(); table->timestamp_field->set_time();
res= heap_update(file,old_data,new_data); res= heap_update(file,old_data,new_data);
@ -224,7 +224,7 @@ int ha_heap::update_row(const byte * old_data, byte * new_data)
int ha_heap::delete_row(const byte * buf) int ha_heap::delete_row(const byte * buf)
{ {
int res; 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); res= heap_delete(file,buf);
if (!res && table->s->tmp_table == NO_TMP_TABLE && if (!res && table->s->tmp_table == NO_TMP_TABLE &&
++records_changed*HEAP_STATS_UPDATE_THRESHOLD > file->s->records) ++records_changed*HEAP_STATS_UPDATE_THRESHOLD > file->s->records)
@ -242,8 +242,7 @@ int ha_heap::index_read(byte * buf, const byte * key, key_part_map keypart_map,
enum ha_rkey_function find_flag) enum ha_rkey_function find_flag)
{ {
DBUG_ASSERT(inited==INDEX); DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_key_count, ha_statistic_increment(&SSV::ha_read_key_count);
&LOCK_status);
int error = heap_rkey(file,buf,active_index, key, keypart_map, find_flag); int error = heap_rkey(file,buf,active_index, key, keypart_map, find_flag);
table->status = error ? STATUS_NOT_FOUND : 0; table->status = error ? STATUS_NOT_FOUND : 0;
return error; return error;
@ -252,8 +251,7 @@ int ha_heap::index_read(byte * buf, const byte * key, key_part_map keypart_map,
int ha_heap::index_read_last(byte *buf, const byte *key, key_part_map keypart_map) int ha_heap::index_read_last(byte *buf, const byte *key, key_part_map keypart_map)
{ {
DBUG_ASSERT(inited==INDEX); DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_key_count, ha_statistic_increment(&SSV::ha_read_key_count);
&LOCK_status);
int error= heap_rkey(file, buf, active_index, key, keypart_map, int error= heap_rkey(file, buf, active_index, key, keypart_map,
HA_READ_PREFIX_LAST); HA_READ_PREFIX_LAST);
table->status= error ? STATUS_NOT_FOUND : 0; table->status= error ? STATUS_NOT_FOUND : 0;
@ -264,8 +262,7 @@ int ha_heap::index_read_idx(byte * buf, uint index, const byte * key,
key_part_map keypart_map, key_part_map keypart_map,
enum ha_rkey_function find_flag) enum ha_rkey_function find_flag)
{ {
statistic_increment(table->in_use->status_var.ha_read_key_count, ha_statistic_increment(&SSV::ha_read_key_count);
&LOCK_status);
int error = heap_rkey(file, buf, index, key, keypart_map, find_flag); int error = heap_rkey(file, buf, index, key, keypart_map, find_flag);
table->status = error ? STATUS_NOT_FOUND : 0; table->status = error ? STATUS_NOT_FOUND : 0;
return error; return error;
@ -274,8 +271,7 @@ int ha_heap::index_read_idx(byte * buf, uint index, const byte * key,
int ha_heap::index_next(byte * buf) int ha_heap::index_next(byte * buf)
{ {
DBUG_ASSERT(inited==INDEX); DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_next_count, ha_statistic_increment(&SSV::ha_read_next_count);
&LOCK_status);
int error=heap_rnext(file,buf); int error=heap_rnext(file,buf);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -284,8 +280,7 @@ int ha_heap::index_next(byte * buf)
int ha_heap::index_prev(byte * buf) int ha_heap::index_prev(byte * buf)
{ {
DBUG_ASSERT(inited==INDEX); DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_prev_count, ha_statistic_increment(&SSV::ha_read_prev_count);
&LOCK_status);
int error=heap_rprev(file,buf); int error=heap_rprev(file,buf);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -294,8 +289,7 @@ int ha_heap::index_prev(byte * buf)
int ha_heap::index_first(byte * buf) int ha_heap::index_first(byte * buf)
{ {
DBUG_ASSERT(inited==INDEX); DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_first_count, ha_statistic_increment(&SSV::ha_read_first_count);
&LOCK_status);
int error=heap_rfirst(file, buf, active_index); int error=heap_rfirst(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -304,8 +298,7 @@ int ha_heap::index_first(byte * buf)
int ha_heap::index_last(byte * buf) int ha_heap::index_last(byte * buf)
{ {
DBUG_ASSERT(inited==INDEX); DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_last_count, ha_statistic_increment(&SSV::ha_read_last_count);
&LOCK_status);
int error=heap_rlast(file, buf, active_index); int error=heap_rlast(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -318,8 +311,7 @@ int ha_heap::rnd_init(bool scan)
int ha_heap::rnd_next(byte *buf) int ha_heap::rnd_next(byte *buf)
{ {
statistic_increment(table->in_use->status_var.ha_read_rnd_next_count, ha_statistic_increment(&SSV::ha_read_rnd_next_count);
&LOCK_status);
int error=heap_scan(file, buf); int error=heap_scan(file, buf);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -329,8 +321,7 @@ int ha_heap::rnd_pos(byte * buf, byte *pos)
{ {
int error; int error;
HEAP_PTR heap_position; HEAP_PTR heap_position;
statistic_increment(table->in_use->status_var.ha_read_rnd_count, ha_statistic_increment(&SSV::ha_read_rnd_count);
&LOCK_status);
memcpy_fixed((char*) &heap_position, pos, sizeof(HEAP_PTR)); memcpy_fixed((char*) &heap_position, pos, sizeof(HEAP_PTR));
error=heap_rrnd(file, buf, heap_position); error=heap_rrnd(file, buf, heap_position);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;

File diff suppressed because it is too large Load Diff

View File

@ -190,8 +190,6 @@ class ha_innobase: public handler
uint table_changes); uint table_changes);
}; };
extern ulong innobase_fast_shutdown;
extern ulong innobase_large_page_size;
extern long innobase_mirrored_log_groups, innobase_log_files_in_group; extern long innobase_mirrored_log_groups, innobase_log_files_in_group;
extern longlong innobase_buffer_pool_size, innobase_log_file_size; extern longlong innobase_buffer_pool_size, innobase_log_file_size;
extern long innobase_log_buffer_size; extern long innobase_log_buffer_size;
@ -203,16 +201,6 @@ extern long innobase_open_files;
extern char *innobase_data_home_dir, *innobase_data_file_path; extern char *innobase_data_home_dir, *innobase_data_file_path;
extern char *innobase_log_group_home_dir, *innobase_log_arch_dir; extern char *innobase_log_group_home_dir, *innobase_log_arch_dir;
extern char *innobase_unix_file_flush_method; 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_rollback_on_timeout,
innobase_create_status_file,
innobase_stats_on_metadata;
extern "C" { extern "C" {
extern ulong srv_max_buf_pool_modified_pct; extern ulong srv_max_buf_pool_modified_pct;
extern ulong srv_max_purge_lag; extern ulong srv_max_purge_lag;

View File

@ -499,6 +499,14 @@ struct trx_struct{
ulint mysql_process_no;/* since in Linux, 'top' reports ulint mysql_process_no;/* since in Linux, 'top' reports
process id's and not thread id's, we process id's and not thread id's, we
store the process number too */ store the process number too */
ibool allow_duplicates;/* normally FALSE, but if the user
wants to update duplicate rows,
(in table inserts, for example) we
set this TRUE */
ibool replace_duplicates;/* normally FALSE, but if the user
wants to replace duplicate rows,
(in table inserts, for example) we
set this TRUE */
/*------------------------------*/ /*------------------------------*/
ulint n_mysql_tables_in_use; /* number of Innobase tables ulint n_mysql_tables_in_use; /* number of Innobase tables
used in the processing of the current used in the processing of the current

View File

@ -694,10 +694,10 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked)
for (i= 0; i < table->s->keys; i++) for (i= 0; i < table->s->keys; i++)
{ {
struct st_plugin_int *parser= table->key_info[i].parser; plugin_ref parser= table->key_info[i].parser;
if (table->key_info[i].flags & HA_USES_PARSER) if (table->key_info[i].flags & HA_USES_PARSER)
file->s->keyinfo[i].parser= file->s->keyinfo[i].parser=
(struct st_mysql_ftparser *)parser->plugin->info; (struct st_mysql_ftparser *)plugin_decl(parser)->info;
table->key_info[i].block_size= file->s->keyinfo[i].block_length; table->key_info[i].block_size= file->s->keyinfo[i].block_length;
} }
my_errno= 0; my_errno= 0;
@ -723,7 +723,7 @@ int ha_myisam::close(void)
int ha_myisam::write_row(byte * buf) 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 we have a timestamp column, update it to the current time */
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT) if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
@ -1596,7 +1596,7 @@ bool ha_myisam::is_crashed() const
int ha_myisam::update_row(const byte * old_data, byte * new_data) 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) if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time(); table->timestamp_field->set_time();
return mi_update(file,old_data,new_data); return mi_update(file,old_data,new_data);
@ -1604,7 +1604,7 @@ int ha_myisam::update_row(const byte * old_data, byte * new_data)
int ha_myisam::delete_row(const byte * buf) 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); return mi_delete(file,buf);
} }
@ -1612,8 +1612,7 @@ int ha_myisam::index_read(byte *buf, const byte *key, key_part_map keypart_map,
enum ha_rkey_function find_flag) enum ha_rkey_function find_flag)
{ {
DBUG_ASSERT(inited==INDEX); DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_key_count, ha_statistic_increment(&SSV::ha_read_key_count);
&LOCK_status);
int error=mi_rkey(file, buf, active_index, key, keypart_map, find_flag); int error=mi_rkey(file, buf, active_index, key, keypart_map, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -1623,8 +1622,7 @@ int ha_myisam::index_read_idx(byte *buf, uint index, const byte *key,
key_part_map keypart_map, key_part_map keypart_map,
enum ha_rkey_function find_flag) enum ha_rkey_function find_flag)
{ {
statistic_increment(table->in_use->status_var.ha_read_key_count, ha_statistic_increment(&SSV::ha_read_key_count);
&LOCK_status);
int error=mi_rkey(file, buf, index, key, keypart_map, find_flag); int error=mi_rkey(file, buf, index, key, keypart_map, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -1635,8 +1633,7 @@ int ha_myisam::index_read_last(byte *buf, const byte *key,
{ {
DBUG_ENTER("ha_myisam::index_read_last"); DBUG_ENTER("ha_myisam::index_read_last");
DBUG_ASSERT(inited==INDEX); DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_key_count, ha_statistic_increment(&SSV::ha_read_key_count);
&LOCK_status);
int error=mi_rkey(file, buf, active_index, key, keypart_map, int error=mi_rkey(file, buf, active_index, key, keypart_map,
HA_READ_PREFIX_LAST); HA_READ_PREFIX_LAST);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
@ -1646,8 +1643,7 @@ int ha_myisam::index_read_last(byte *buf, const byte *key,
int ha_myisam::index_next(byte * buf) int ha_myisam::index_next(byte * buf)
{ {
DBUG_ASSERT(inited==INDEX); DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_next_count, ha_statistic_increment(&SSV::ha_read_next_count);
&LOCK_status);
int error=mi_rnext(file,buf,active_index); int error=mi_rnext(file,buf,active_index);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -1656,8 +1652,7 @@ int ha_myisam::index_next(byte * buf)
int ha_myisam::index_prev(byte * buf) int ha_myisam::index_prev(byte * buf)
{ {
DBUG_ASSERT(inited==INDEX); DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_prev_count, ha_statistic_increment(&SSV::ha_read_prev_count);
&LOCK_status);
int error=mi_rprev(file,buf, active_index); int error=mi_rprev(file,buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -1666,8 +1661,7 @@ int ha_myisam::index_prev(byte * buf)
int ha_myisam::index_first(byte * buf) int ha_myisam::index_first(byte * buf)
{ {
DBUG_ASSERT(inited==INDEX); DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_first_count, ha_statistic_increment(&SSV::ha_read_first_count);
&LOCK_status);
int error=mi_rfirst(file, buf, active_index); int error=mi_rfirst(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -1676,8 +1670,7 @@ int ha_myisam::index_first(byte * buf)
int ha_myisam::index_last(byte * buf) int ha_myisam::index_last(byte * buf)
{ {
DBUG_ASSERT(inited==INDEX); DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_last_count, ha_statistic_increment(&SSV::ha_read_last_count);
&LOCK_status);
int error=mi_rlast(file, buf, active_index); int error=mi_rlast(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -1688,8 +1681,7 @@ int ha_myisam::index_next_same(byte * buf,
uint length __attribute__((unused))) uint length __attribute__((unused)))
{ {
DBUG_ASSERT(inited==INDEX); DBUG_ASSERT(inited==INDEX);
statistic_increment(table->in_use->status_var.ha_read_next_count, ha_statistic_increment(&SSV::ha_read_next_count);
&LOCK_status);
int error=mi_rnext_same(file,buf); int error=mi_rnext_same(file,buf);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -1705,8 +1697,7 @@ int ha_myisam::rnd_init(bool scan)
int ha_myisam::rnd_next(byte *buf) int ha_myisam::rnd_next(byte *buf)
{ {
statistic_increment(table->in_use->status_var.ha_read_rnd_next_count, ha_statistic_increment(&SSV::ha_read_rnd_next_count);
&LOCK_status);
int error=mi_scan(file, buf); int error=mi_scan(file, buf);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -1719,8 +1710,7 @@ int ha_myisam::restart_rnd_next(byte *buf, byte *pos)
int ha_myisam::rnd_pos(byte * buf, byte *pos) int ha_myisam::rnd_pos(byte * buf, byte *pos)
{ {
statistic_increment(table->in_use->status_var.ha_read_rnd_count, ha_statistic_increment(&SSV::ha_read_rnd_count);
&LOCK_status);
int error=mi_rrnd(file, buf, my_get_ptr(pos,ref_length)); int error=mi_rrnd(file, buf, my_get_ptr(pos,ref_length));
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;

View File

@ -148,7 +148,7 @@ int ha_myisammrg::close(void)
int ha_myisammrg::write_row(byte * buf) 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) if (file->merge_insert_method == MERGE_INSERT_DISABLED || !file->tables)
return (HA_ERR_TABLE_READONLY); return (HA_ERR_TABLE_READONLY);
@ -166,7 +166,7 @@ int ha_myisammrg::write_row(byte * buf)
int ha_myisammrg::update_row(const byte * old_data, byte * new_data) 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) if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time(); table->timestamp_field->set_time();
return myrg_update(file,old_data,new_data); return myrg_update(file,old_data,new_data);
@ -174,7 +174,7 @@ int ha_myisammrg::update_row(const byte * old_data, byte * new_data)
int ha_myisammrg::delete_row(const byte * buf) 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); return myrg_delete(file,buf);
} }
@ -182,8 +182,7 @@ int ha_myisammrg::index_read(byte * buf, const byte * key,
key_part_map keypart_map, key_part_map keypart_map,
enum ha_rkey_function find_flag) enum ha_rkey_function find_flag)
{ {
statistic_increment(table->in_use->status_var.ha_read_key_count, ha_statistic_increment(&SSV::ha_read_key_count);
&LOCK_status);
int error=myrg_rkey(file,buf,active_index, key, keypart_map, find_flag); int error=myrg_rkey(file,buf,active_index, key, keypart_map, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -193,8 +192,7 @@ int ha_myisammrg::index_read_idx(byte * buf, uint index, const byte * key,
key_part_map keypart_map, key_part_map keypart_map,
enum ha_rkey_function find_flag) enum ha_rkey_function find_flag)
{ {
statistic_increment(table->in_use->status_var.ha_read_key_count, ha_statistic_increment(&SSV::ha_read_key_count);
&LOCK_status);
int error=myrg_rkey(file,buf,index, key, keypart_map, find_flag); int error=myrg_rkey(file,buf,index, key, keypart_map, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -203,8 +201,7 @@ int ha_myisammrg::index_read_idx(byte * buf, uint index, const byte * key,
int ha_myisammrg::index_read_last(byte * buf, const byte * key, int ha_myisammrg::index_read_last(byte * buf, const byte * key,
key_part_map keypart_map) key_part_map keypart_map)
{ {
statistic_increment(table->in_use->status_var.ha_read_key_count, ha_statistic_increment(&SSV::ha_read_key_count);
&LOCK_status);
int error=myrg_rkey(file,buf,active_index, key, keypart_map, int error=myrg_rkey(file,buf,active_index, key, keypart_map,
HA_READ_PREFIX_LAST); HA_READ_PREFIX_LAST);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
@ -213,8 +210,7 @@ int ha_myisammrg::index_read_last(byte * buf, const byte * key,
int ha_myisammrg::index_next(byte * buf) int ha_myisammrg::index_next(byte * buf)
{ {
statistic_increment(table->in_use->status_var.ha_read_next_count, ha_statistic_increment(&SSV::ha_read_next_count);
&LOCK_status);
int error=myrg_rnext(file,buf,active_index); int error=myrg_rnext(file,buf,active_index);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -222,8 +218,7 @@ int ha_myisammrg::index_next(byte * buf)
int ha_myisammrg::index_prev(byte * buf) int ha_myisammrg::index_prev(byte * buf)
{ {
statistic_increment(table->in_use->status_var.ha_read_prev_count, ha_statistic_increment(&SSV::ha_read_prev_count);
&LOCK_status);
int error=myrg_rprev(file,buf, active_index); int error=myrg_rprev(file,buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -231,8 +226,7 @@ int ha_myisammrg::index_prev(byte * buf)
int ha_myisammrg::index_first(byte * buf) int ha_myisammrg::index_first(byte * buf)
{ {
statistic_increment(table->in_use->status_var.ha_read_first_count, ha_statistic_increment(&SSV::ha_read_first_count);
&LOCK_status);
int error=myrg_rfirst(file, buf, active_index); int error=myrg_rfirst(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -240,8 +234,7 @@ int ha_myisammrg::index_first(byte * buf)
int ha_myisammrg::index_last(byte * buf) int ha_myisammrg::index_last(byte * buf)
{ {
statistic_increment(table->in_use->status_var.ha_read_last_count, ha_statistic_increment(&SSV::ha_read_last_count);
&LOCK_status);
int error=myrg_rlast(file, buf, active_index); int error=myrg_rlast(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -251,8 +244,7 @@ int ha_myisammrg::index_next_same(byte * buf,
const byte *key __attribute__((unused)), const byte *key __attribute__((unused)),
uint length __attribute__((unused))) uint length __attribute__((unused)))
{ {
statistic_increment(table->in_use->status_var.ha_read_next_count, ha_statistic_increment(&SSV::ha_read_next_count);
&LOCK_status);
int error=myrg_rnext_same(file,buf); int error=myrg_rnext_same(file,buf);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -267,8 +259,7 @@ int ha_myisammrg::rnd_init(bool scan)
int ha_myisammrg::rnd_next(byte *buf) int ha_myisammrg::rnd_next(byte *buf)
{ {
statistic_increment(table->in_use->status_var.ha_read_rnd_next_count, ha_statistic_increment(&SSV::ha_read_rnd_next_count);
&LOCK_status);
int error=myrg_rrnd(file, buf, HA_OFFSET_ERROR); int error=myrg_rrnd(file, buf, HA_OFFSET_ERROR);
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -277,8 +268,7 @@ int ha_myisammrg::rnd_next(byte *buf)
int ha_myisammrg::rnd_pos(byte * buf, byte *pos) int ha_myisammrg::rnd_pos(byte * buf, byte *pos)
{ {
statistic_increment(table->in_use->status_var.ha_read_rnd_count, ha_statistic_increment(&SSV::ha_read_rnd_count);
&LOCK_status);
int error=myrg_rrnd(file, buf, my_get_ptr(pos,ref_length)); int error=myrg_rrnd(file, buf, my_get_ptr(pos,ref_length));
table->status=error ? STATUS_NOT_FOUND: 0; table->status=error ? STATUS_NOT_FOUND: 0;
return error; return error;
@ -615,7 +605,6 @@ static int myisammrg_init(void *p)
myisammrg_hton= (handlerton *)p; myisammrg_hton= (handlerton *)p;
myisammrg_hton->state= SHOW_OPTION_YES;
myisammrg_hton->db_type= DB_TYPE_MRG_MYISAM; myisammrg_hton->db_type= DB_TYPE_MRG_MYISAM;
myisammrg_hton->create= myisammrg_create_handler; myisammrg_hton->create= myisammrg_create_handler;
myisammrg_hton->panic= myisammrg_panic; myisammrg_hton->panic= myisammrg_panic;

View File

@ -612,10 +612,11 @@ static
my_bool my_bool
parse_mycnf_opt(int, const struct my_option * opt, char * value) parse_mycnf_opt(int, const struct my_option * opt, char * value)
{ {
long *app_type= (long*) &opt->app_type;
if(opt->comment) if(opt->comment)
((struct my_option *)opt)->app_type++; (*app_type)++;
else else
((struct my_option *)opt)->app_type = order++; *app_type = order++;
return 0; return 0;
} }
@ -948,22 +949,6 @@ end:
template class Vector<struct my_option>; template class Vector<struct my_option>;
#if 0 /*
struct my_option See include/my_getopt.h for the declaration of struct my_option
{ */
const char *name; /* Name of the option */
int id; /* unique id or short option */
const char *comment; /* option comment, for autom. --help */
gptr *value; /* The variable value */
gptr *u_max_value; /* The user def. max variable value */
const char **str_values; /* Pointer to possible values */
ulong var_type;
enum get_opt_arg_type arg_type;
longlong def_value; /* Default value */
longlong min_value; /* Min allowed value */
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 */
};
#endif