MDEV-6107 merge default_tmp_storage_engine
Adapt default_tmp_storage_engine implementation from mysql-5.6 New feature (as compared to 5.6), default_tmp_storage_engine=NULL means that temporary tables will use default_storage_engine value. This makes the behavior backward compatible.
This commit is contained in:
parent
2edcf8f9ff
commit
cf1a09e42f
@ -36,7 +36,6 @@ our $do_test;
|
|||||||
our $skip_test;
|
our $skip_test;
|
||||||
our $binlog_format;
|
our $binlog_format;
|
||||||
our $enable_disabled;
|
our $enable_disabled;
|
||||||
our $default_storage_engine;
|
|
||||||
our $opt_with_ndbcluster_only;
|
our $opt_with_ndbcluster_only;
|
||||||
|
|
||||||
sub collect_option {
|
sub collect_option {
|
||||||
|
@ -144,6 +144,9 @@ The following options may be given as the first argument:
|
|||||||
The default storage engine for new tables
|
The default storage engine for new tables
|
||||||
--default-time-zone=name
|
--default-time-zone=name
|
||||||
Set the default time zone.
|
Set the default time zone.
|
||||||
|
--default-tmp-storage-engine=name
|
||||||
|
The default storage engine for user-created temporary
|
||||||
|
tables
|
||||||
--default-week-format=#
|
--default-week-format=#
|
||||||
The default week format used by WEEK() functions
|
The default week format used by WEEK() functions
|
||||||
--delay-key-write[=name]
|
--delay-key-write[=name]
|
||||||
@ -1085,6 +1088,7 @@ deadlock-timeout-short 10000
|
|||||||
default-regex-flags
|
default-regex-flags
|
||||||
default-storage-engine myisam
|
default-storage-engine myisam
|
||||||
default-time-zone (No default value)
|
default-time-zone (No default value)
|
||||||
|
default-tmp-storage-engine (No default value)
|
||||||
default-week-format 0
|
default-week-format 0
|
||||||
delay-key-write ON
|
delay-key-write ON
|
||||||
delayed-insert-limit 100
|
delayed-insert-limit 100
|
||||||
|
@ -0,0 +1,181 @@
|
|||||||
|
SET @start_global_value = @@global.default_tmp_storage_engine;
|
||||||
|
SELECT @start_global_value;
|
||||||
|
@start_global_value
|
||||||
|
NULL
|
||||||
|
SET @start_session_value = @@session.default_tmp_storage_engine;
|
||||||
|
SELECT @start_session_value;
|
||||||
|
@start_session_value
|
||||||
|
NULL
|
||||||
|
'#--------------------FN_DYNVARS_005_01-------------------------#'
|
||||||
|
SET @@global.default_tmp_storage_engine = MEMORY;
|
||||||
|
SET @@global.default_tmp_storage_engine = DEFAULT;
|
||||||
|
SELECT @@global.default_tmp_storage_engine;
|
||||||
|
@@global.default_tmp_storage_engine
|
||||||
|
NULL
|
||||||
|
SET @@session.default_tmp_storage_engine = MEMORY;
|
||||||
|
SET @@session.default_tmp_storage_engine = DEFAULT;
|
||||||
|
SELECT @@session.default_tmp_storage_engine;
|
||||||
|
@@session.default_tmp_storage_engine
|
||||||
|
NULL
|
||||||
|
'#--------------------FN_DYNVARS_005_02-------------------------#'
|
||||||
|
SET @@global.default_tmp_storage_engine = MYISAM;
|
||||||
|
SELECT @@global.default_tmp_storage_engine;
|
||||||
|
@@global.default_tmp_storage_engine
|
||||||
|
MyISAM
|
||||||
|
SET @@global.default_tmp_storage_engine = MERGE;
|
||||||
|
SELECT @@global.default_tmp_storage_engine;
|
||||||
|
@@global.default_tmp_storage_engine
|
||||||
|
MRG_MyISAM
|
||||||
|
SET @@global.default_tmp_storage_engine = MEMORY;
|
||||||
|
SELECT @@global.default_tmp_storage_engine;
|
||||||
|
@@global.default_tmp_storage_engine
|
||||||
|
MEMORY
|
||||||
|
'#--------------------FN_DYNVARS_005_03-------------------------#'
|
||||||
|
SET @@session.default_tmp_storage_engine = MYISAM;
|
||||||
|
SELECT @@session.default_tmp_storage_engine;
|
||||||
|
@@session.default_tmp_storage_engine
|
||||||
|
MyISAM
|
||||||
|
SET @@session.default_tmp_storage_engine = MERGE;
|
||||||
|
SELECT @@session.default_tmp_storage_engine;
|
||||||
|
@@session.default_tmp_storage_engine
|
||||||
|
MRG_MyISAM
|
||||||
|
SET @@session.default_tmp_storage_engine = MEMORY;
|
||||||
|
SELECT @@session.default_tmp_storage_engine;
|
||||||
|
@@session.default_tmp_storage_engine
|
||||||
|
MEMORY
|
||||||
|
'#------------------FN_DYNVARS_005_04-----------------------#'
|
||||||
|
SET @@global.default_tmp_storage_engine = 8199;
|
||||||
|
ERROR 42000: Incorrect argument type to variable 'default_tmp_storage_engine'
|
||||||
|
SET @@global.default_tmp_storage_engine = -1024;
|
||||||
|
ERROR 42000: Incorrect argument type to variable 'default_tmp_storage_engine'
|
||||||
|
SET @@global.default_tmp_storage_engine = 65530.34;
|
||||||
|
ERROR 42000: Incorrect argument type to variable 'default_tmp_storage_engine'
|
||||||
|
SET @@global.default_tmp_storage_engine = FILE;
|
||||||
|
ERROR 42000: Unknown storage engine 'FILE'
|
||||||
|
SET @@session.default_tmp_storage_engine = 8199;
|
||||||
|
ERROR 42000: Incorrect argument type to variable 'default_tmp_storage_engine'
|
||||||
|
SET @@session.default_tmp_storage_engine = 65530.34;
|
||||||
|
ERROR 42000: Incorrect argument type to variable 'default_tmp_storage_engine'
|
||||||
|
SET @@session.default_tmp_storage_engine = RECORD;
|
||||||
|
ERROR 42000: Unknown storage engine 'RECORD'
|
||||||
|
'#------------------FN_DYNVARS_005_05-----------------------#'
|
||||||
|
SELECT @@global.default_tmp_storage_engine =
|
||||||
|
VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||||
|
WHERE VARIABLE_NAME='default_tmp_storage_engine';
|
||||||
|
@@global.default_tmp_storage_engine =
|
||||||
|
VARIABLE_VALUE
|
||||||
|
1
|
||||||
|
'#------------------FN_DYNVARS_005_06-----------------------#'
|
||||||
|
SELECT @@session.default_tmp_storage_engine =
|
||||||
|
VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||||
|
WHERE VARIABLE_NAME='default_tmp_storage_engine';
|
||||||
|
@@session.default_tmp_storage_engine =
|
||||||
|
VARIABLE_VALUE
|
||||||
|
1
|
||||||
|
'#------------------FN_DYNVARS_005_07-----------------------#'
|
||||||
|
SET @@global.default_tmp_storage_engine = TRUE;
|
||||||
|
ERROR 42000: Incorrect argument type to variable 'default_tmp_storage_engine'
|
||||||
|
SET @@global.default_tmp_storage_engine = FALSE;
|
||||||
|
ERROR 42000: Incorrect argument type to variable 'default_tmp_storage_engine'
|
||||||
|
'#---------------------FN_DYNVARS_001_8----------------------#'
|
||||||
|
SET @@default_tmp_storage_engine = MYISAM;
|
||||||
|
SELECT @@default_tmp_storage_engine = @@local.default_tmp_storage_engine;
|
||||||
|
@@default_tmp_storage_engine = @@local.default_tmp_storage_engine
|
||||||
|
1
|
||||||
|
SELECT @@local.default_tmp_storage_engine = @@session.default_tmp_storage_engine;
|
||||||
|
@@local.default_tmp_storage_engine = @@session.default_tmp_storage_engine
|
||||||
|
1
|
||||||
|
'#---------------------FN_DYNVARS_001_9----------------------#'
|
||||||
|
SET default_tmp_storage_engine = MEMORY;
|
||||||
|
SELECT @@default_tmp_storage_engine;
|
||||||
|
@@default_tmp_storage_engine
|
||||||
|
MEMORY
|
||||||
|
SELECT local.default_tmp_storage_engine;
|
||||||
|
ERROR 42S02: Unknown table 'local' in field list
|
||||||
|
SELECT session.default_tmp_storage_engine;
|
||||||
|
ERROR 42S02: Unknown table 'session' in field list
|
||||||
|
SELECT default_tmp_storage_engine = @@session.default_tmp_storage_engine;
|
||||||
|
ERROR 42S22: Unknown column 'default_tmp_storage_engine' in 'field list'
|
||||||
|
SET @@default_tmp_storage_engine = @start_global_value;
|
||||||
|
SET default_tmp_storage_engine = MyISAM;
|
||||||
|
SET default_storage_engine = MyISAM;
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
CREATE TEMPORARY TABLE t2 (b INT);
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` int(11) DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
SHOW CREATE TABLE t2;
|
||||||
|
Table Create Table
|
||||||
|
t2 CREATE TEMPORARY TABLE `t2` (
|
||||||
|
`b` int(11) DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
SET default_storage_engine = MEMORY;
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
CREATE TEMPORARY TABLE t2 (b INT);
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` int(11) DEFAULT NULL
|
||||||
|
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||||
|
SHOW CREATE TABLE t2;
|
||||||
|
Table Create Table
|
||||||
|
t2 CREATE TEMPORARY TABLE `t2` (
|
||||||
|
`b` int(11) DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
SET @@global.default_tmp_storage_engine = NULL;
|
||||||
|
SET @@session.default_tmp_storage_engine = NULL;
|
||||||
|
SET default_storage_engine = MEMORY;
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
CREATE TEMPORARY TABLE t2 (b INT);
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` int(11) DEFAULT NULL
|
||||||
|
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||||
|
SHOW CREATE TABLE t2;
|
||||||
|
Table Create Table
|
||||||
|
t2 CREATE TEMPORARY TABLE `t2` (
|
||||||
|
`b` int(11) DEFAULT NULL
|
||||||
|
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
SET default_storage_engine = MYISAM;
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
CREATE TEMPORARY TABLE t2 (b INT);
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` int(11) DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
SHOW CREATE TABLE t2;
|
||||||
|
Table Create Table
|
||||||
|
t2 CREATE TEMPORARY TABLE `t2` (
|
||||||
|
`b` int(11) DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
SET default_tmp_storage_engine = DEFAULT;
|
||||||
|
SET default_storage_engine = DEFAULT;
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
CREATE TEMPORARY TABLE t2 (b INT);
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` int(11) DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
SHOW CREATE TABLE t2;
|
||||||
|
Table Create Table
|
||||||
|
t2 CREATE TEMPORARY TABLE `t2` (
|
||||||
|
`b` int(11) DEFAULT NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
SET @@global.default_tmp_storage_engine = @start_global_value;
|
||||||
|
SELECT @@global.default_tmp_storage_engine;
|
||||||
|
@@global.default_tmp_storage_engine
|
||||||
|
NULL
|
||||||
|
SET @@session.default_tmp_storage_engine = @start_session_value;
|
||||||
|
SELECT @@session.default_tmp_storage_engine;
|
||||||
|
@@session.default_tmp_storage_engine
|
||||||
|
NULL
|
@ -0,0 +1,193 @@
|
|||||||
|
######################################################################
|
||||||
|
# START OF default_tmp_storage_engine TESTS #
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
#############################################################
|
||||||
|
# Save initial value #
|
||||||
|
#############################################################
|
||||||
|
|
||||||
|
SET @start_global_value = @@global.default_tmp_storage_engine;
|
||||||
|
SELECT @start_global_value;
|
||||||
|
SET @start_session_value = @@session.default_tmp_storage_engine;
|
||||||
|
SELECT @start_session_value;
|
||||||
|
|
||||||
|
--echo '#--------------------FN_DYNVARS_005_01-------------------------#'
|
||||||
|
######################################################################
|
||||||
|
# Display the DEFAULT value of default_tmp_storage_engine #
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
SET @@global.default_tmp_storage_engine = MEMORY;
|
||||||
|
SET @@global.default_tmp_storage_engine = DEFAULT;
|
||||||
|
SELECT @@global.default_tmp_storage_engine;
|
||||||
|
|
||||||
|
SET @@session.default_tmp_storage_engine = MEMORY;
|
||||||
|
SET @@session.default_tmp_storage_engine = DEFAULT;
|
||||||
|
SELECT @@session.default_tmp_storage_engine;
|
||||||
|
|
||||||
|
|
||||||
|
--echo '#--------------------FN_DYNVARS_005_02-------------------------#'
|
||||||
|
########################################################################
|
||||||
|
# Change the value of default_tmp_storage_engine to a valid value for GLOBAL Scope #
|
||||||
|
########################################################################
|
||||||
|
|
||||||
|
SET @@global.default_tmp_storage_engine = MYISAM;
|
||||||
|
SELECT @@global.default_tmp_storage_engine;
|
||||||
|
SET @@global.default_tmp_storage_engine = MERGE;
|
||||||
|
SELECT @@global.default_tmp_storage_engine;
|
||||||
|
SET @@global.default_tmp_storage_engine = MEMORY;
|
||||||
|
SELECT @@global.default_tmp_storage_engine;
|
||||||
|
|
||||||
|
--echo '#--------------------FN_DYNVARS_005_03-------------------------#'
|
||||||
|
#########################################################################
|
||||||
|
# Change the value of default_tmp_storage_engine to a valid value for SESSION Scope #
|
||||||
|
#########################################################################
|
||||||
|
|
||||||
|
SET @@session.default_tmp_storage_engine = MYISAM;
|
||||||
|
SELECT @@session.default_tmp_storage_engine;
|
||||||
|
SET @@session.default_tmp_storage_engine = MERGE;
|
||||||
|
SELECT @@session.default_tmp_storage_engine;
|
||||||
|
SET @@session.default_tmp_storage_engine = MEMORY;
|
||||||
|
SELECT @@session.default_tmp_storage_engine;
|
||||||
|
|
||||||
|
--echo '#------------------FN_DYNVARS_005_04-----------------------#'
|
||||||
|
##################################################################
|
||||||
|
# Change the value of default_tmp_storage_engine to an invalid value #
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
--Error ER_WRONG_TYPE_FOR_VAR
|
||||||
|
SET @@global.default_tmp_storage_engine = 8199;
|
||||||
|
|
||||||
|
--Error ER_WRONG_TYPE_FOR_VAR
|
||||||
|
SET @@global.default_tmp_storage_engine = -1024;
|
||||||
|
|
||||||
|
--Error ER_WRONG_TYPE_FOR_VAR
|
||||||
|
SET @@global.default_tmp_storage_engine = 65530.34;
|
||||||
|
|
||||||
|
--Error ER_UNKNOWN_STORAGE_ENGINE
|
||||||
|
SET @@global.default_tmp_storage_engine = FILE;
|
||||||
|
|
||||||
|
--Error ER_WRONG_TYPE_FOR_VAR
|
||||||
|
SET @@session.default_tmp_storage_engine = 8199;
|
||||||
|
|
||||||
|
--Error ER_WRONG_TYPE_FOR_VAR
|
||||||
|
SET @@session.default_tmp_storage_engine = 65530.34;
|
||||||
|
|
||||||
|
--Error ER_UNKNOWN_STORAGE_ENGINE
|
||||||
|
SET @@session.default_tmp_storage_engine = RECORD;
|
||||||
|
|
||||||
|
|
||||||
|
--echo '#------------------FN_DYNVARS_005_05-----------------------#'
|
||||||
|
####################################################################
|
||||||
|
# Check if the value in GLOBAL Table matches value in variable #
|
||||||
|
####################################################################
|
||||||
|
|
||||||
|
|
||||||
|
SELECT @@global.default_tmp_storage_engine =
|
||||||
|
VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||||
|
WHERE VARIABLE_NAME='default_tmp_storage_engine';
|
||||||
|
|
||||||
|
--echo '#------------------FN_DYNVARS_005_06-----------------------#'
|
||||||
|
####################################################################
|
||||||
|
# Check if the value in SESSION Table matches value in variable #
|
||||||
|
####################################################################
|
||||||
|
|
||||||
|
SELECT @@session.default_tmp_storage_engine =
|
||||||
|
VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||||
|
WHERE VARIABLE_NAME='default_tmp_storage_engine';
|
||||||
|
|
||||||
|
|
||||||
|
--echo '#------------------FN_DYNVARS_005_07-----------------------#'
|
||||||
|
####################################################################
|
||||||
|
# Check if TRUE and FALSE values can be used on variable #
|
||||||
|
####################################################################
|
||||||
|
|
||||||
|
--Error ER_WRONG_TYPE_FOR_VAR
|
||||||
|
SET @@global.default_tmp_storage_engine = TRUE;
|
||||||
|
|
||||||
|
--Error ER_WRONG_TYPE_FOR_VAR
|
||||||
|
SET @@global.default_tmp_storage_engine = FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
--echo '#---------------------FN_DYNVARS_001_8----------------------#'
|
||||||
|
###############################################################
|
||||||
|
# Check if accessing variable with SESSION,LOCAL and without #
|
||||||
|
# SCOPE points to same session variable #
|
||||||
|
###############################################################
|
||||||
|
|
||||||
|
SET @@default_tmp_storage_engine = MYISAM;
|
||||||
|
SELECT @@default_tmp_storage_engine = @@local.default_tmp_storage_engine;
|
||||||
|
SELECT @@local.default_tmp_storage_engine = @@session.default_tmp_storage_engine;
|
||||||
|
|
||||||
|
|
||||||
|
--echo '#---------------------FN_DYNVARS_001_9----------------------#'
|
||||||
|
#########################################################################
|
||||||
|
# Check if default_tmp_storage_engine can be accessed with and without @@ sign #
|
||||||
|
#########################################################################
|
||||||
|
|
||||||
|
SET default_tmp_storage_engine = MEMORY;
|
||||||
|
SELECT @@default_tmp_storage_engine;
|
||||||
|
--Error ER_UNKNOWN_TABLE
|
||||||
|
SELECT local.default_tmp_storage_engine;
|
||||||
|
--Error ER_UNKNOWN_TABLE
|
||||||
|
SELECT session.default_tmp_storage_engine;
|
||||||
|
--Error ER_BAD_FIELD_ERROR
|
||||||
|
SELECT default_tmp_storage_engine = @@session.default_tmp_storage_engine;
|
||||||
|
|
||||||
|
# check the old obsolete name
|
||||||
|
SET @@default_tmp_storage_engine = @start_global_value;
|
||||||
|
|
||||||
|
SET default_tmp_storage_engine = MyISAM;
|
||||||
|
SET default_storage_engine = MyISAM;
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
CREATE TEMPORARY TABLE t2 (b INT);
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
SHOW CREATE TABLE t2;
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
|
||||||
|
SET default_storage_engine = MEMORY;
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
CREATE TEMPORARY TABLE t2 (b INT);
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
SHOW CREATE TABLE t2;
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
|
||||||
|
# test default_tmp_storage_engine = NULL
|
||||||
|
SET @@global.default_tmp_storage_engine = NULL;
|
||||||
|
SET @@session.default_tmp_storage_engine = NULL;
|
||||||
|
|
||||||
|
SET default_storage_engine = MEMORY;
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
CREATE TEMPORARY TABLE t2 (b INT);
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
SHOW CREATE TABLE t2;
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
|
||||||
|
SET default_storage_engine = MYISAM;
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
CREATE TEMPORARY TABLE t2 (b INT);
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
SHOW CREATE TABLE t2;
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
|
||||||
|
SET default_tmp_storage_engine = DEFAULT;
|
||||||
|
SET default_storage_engine = DEFAULT;
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
CREATE TEMPORARY TABLE t2 (b INT);
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
SHOW CREATE TABLE t2;
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
|
||||||
|
####################################
|
||||||
|
# Restore initial value #
|
||||||
|
####################################
|
||||||
|
|
||||||
|
SET @@global.default_tmp_storage_engine = @start_global_value;
|
||||||
|
SELECT @@global.default_tmp_storage_engine;
|
||||||
|
SET @@session.default_tmp_storage_engine = @start_session_value;
|
||||||
|
SELECT @@session.default_tmp_storage_engine;
|
||||||
|
|
||||||
|
|
||||||
|
#############################################################
|
||||||
|
# END OF default_tmp_storage_engine TESTS #
|
||||||
|
#############################################################
|
||||||
|
|
@ -113,7 +113,7 @@ frm_type_enum dd_frm_type(THD *thd, char *path, enum legacy_db_type *dbt)
|
|||||||
LEX_STRING name;
|
LEX_STRING name;
|
||||||
name.str= (char*) next_chunk + 2;
|
name.str= (char*) next_chunk + 2;
|
||||||
name.length= str_db_type_length;
|
name.length= str_db_type_length;
|
||||||
plugin_ref tmp_plugin= ha_resolve_by_name(thd, &name);
|
plugin_ref tmp_plugin= ha_resolve_by_name(thd, &name, false);
|
||||||
if (tmp_plugin)
|
if (tmp_plugin)
|
||||||
*dbt= plugin_data(tmp_plugin, handlerton *)->db_type;
|
*dbt= plugin_data(tmp_plugin, handlerton *)->db_type;
|
||||||
else
|
else
|
||||||
|
@ -107,6 +107,14 @@ static plugin_ref ha_default_plugin(THD *thd)
|
|||||||
return my_plugin_lock(thd, global_system_variables.table_plugin);
|
return my_plugin_lock(thd, global_system_variables.table_plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static plugin_ref ha_default_tmp_plugin(THD *thd)
|
||||||
|
{
|
||||||
|
if (thd->variables.tmp_table_plugin)
|
||||||
|
return thd->variables.tmp_table_plugin;
|
||||||
|
if (global_system_variables.tmp_table_plugin)
|
||||||
|
return my_plugin_lock(thd, global_system_variables.tmp_table_plugin);
|
||||||
|
return ha_default_plugin(thd);
|
||||||
|
}
|
||||||
|
|
||||||
/** @brief
|
/** @brief
|
||||||
Return the default storage engine handlerton for thread
|
Return the default storage engine handlerton for thread
|
||||||
@ -128,6 +136,16 @@ handlerton *ha_default_handlerton(THD *thd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
handlerton *ha_default_tmp_handlerton(THD *thd)
|
||||||
|
{
|
||||||
|
plugin_ref plugin= ha_default_tmp_plugin(thd);
|
||||||
|
DBUG_ASSERT(plugin);
|
||||||
|
handlerton *hton= plugin_hton(plugin);
|
||||||
|
DBUG_ASSERT(hton);
|
||||||
|
return hton;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** @brief
|
/** @brief
|
||||||
Return the storage engine handlerton for the supplied name
|
Return the storage engine handlerton for the supplied name
|
||||||
|
|
||||||
@ -139,7 +157,7 @@ handlerton *ha_default_handlerton(THD *thd)
|
|||||||
RETURN
|
RETURN
|
||||||
pointer to storage engine plugin handle
|
pointer to storage engine plugin handle
|
||||||
*/
|
*/
|
||||||
plugin_ref ha_resolve_by_name(THD *thd, const LEX_STRING *name)
|
plugin_ref ha_resolve_by_name(THD *thd, const LEX_STRING *name, bool tmp_table)
|
||||||
{
|
{
|
||||||
const LEX_STRING *table_alias;
|
const LEX_STRING *table_alias;
|
||||||
plugin_ref plugin;
|
plugin_ref plugin;
|
||||||
@ -149,7 +167,7 @@ redo:
|
|||||||
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_plugin(thd);
|
return tmp_table ? ha_default_tmp_plugin(thd) : ha_default_plugin(thd);
|
||||||
|
|
||||||
if ((plugin= my_plugin_lock_by_name(thd, name, MYSQL_STORAGE_ENGINE_PLUGIN)))
|
if ((plugin= my_plugin_lock_by_name(thd, name, MYSQL_STORAGE_ENGINE_PLUGIN)))
|
||||||
{
|
{
|
||||||
@ -253,7 +271,8 @@ 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, ha_default_handlerton(current_thd)));
|
file= get_new_handler(share, alloc, ha_default_handlerton(current_thd));
|
||||||
|
DBUG_RETURN(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1360,6 +1360,8 @@ static inline sys_var *find_hton_sysvar(handlerton *hton, st_mysql_sys_var *var)
|
|||||||
return find_plugin_sysvar(hton2plugin[hton->slot], var);
|
return find_plugin_sysvar(hton2plugin[hton->slot], var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handlerton *ha_default_handlerton(THD *thd);
|
||||||
|
handlerton *ha_default_tmp_handlerton(THD *thd);
|
||||||
|
|
||||||
/* Possible flags of a handlerton (there can be 32 of them) */
|
/* Possible flags of a handlerton (there can be 32 of them) */
|
||||||
#define HTON_NO_FLAGS 0
|
#define HTON_NO_FLAGS 0
|
||||||
@ -1632,6 +1634,11 @@ struct HA_CREATE_INFO
|
|||||||
bool table_was_deleted;
|
bool table_was_deleted;
|
||||||
|
|
||||||
bool tmp_table() { return options & HA_LEX_CREATE_TMP_TABLE; }
|
bool tmp_table() { return options & HA_LEX_CREATE_TMP_TABLE; }
|
||||||
|
void use_default_db_type(THD *thd)
|
||||||
|
{
|
||||||
|
db_type= tmp_table() ? ha_default_tmp_handlerton(thd)
|
||||||
|
: ha_default_handlerton(thd);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -3961,8 +3968,7 @@ extern const char *myisam_stats_method_names[];
|
|||||||
extern ulong total_ha, total_ha_2pc;
|
extern ulong total_ha, total_ha_2pc;
|
||||||
|
|
||||||
/* lookups */
|
/* lookups */
|
||||||
handlerton *ha_default_handlerton(THD *thd);
|
plugin_ref ha_resolve_by_name(THD *thd, const LEX_STRING *name, bool tmp_table);
|
||||||
plugin_ref ha_resolve_by_name(THD *thd, const LEX_STRING *name);
|
|
||||||
plugin_ref ha_lock_engine(THD *thd, const handlerton *hton);
|
plugin_ref ha_lock_engine(THD *thd, const 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);
|
||||||
handler *get_new_handler(TABLE_SHARE *share, MEM_ROOT *alloc,
|
handler *get_new_handler(TABLE_SHARE *share, MEM_ROOT *alloc,
|
||||||
|
@ -362,7 +362,7 @@ static char *lc_messages;
|
|||||||
static char *lc_time_names_name;
|
static char *lc_time_names_name;
|
||||||
static char *my_bind_addr_str;
|
static char *my_bind_addr_str;
|
||||||
static char *default_collation_name;
|
static char *default_collation_name;
|
||||||
char *default_storage_engine;
|
char *default_storage_engine, *default_tmp_storage_engine;
|
||||||
static char compiled_default_collation_name[]= MYSQL_DEFAULT_COLLATION_NAME;
|
static char compiled_default_collation_name[]= MYSQL_DEFAULT_COLLATION_NAME;
|
||||||
static I_List<THD> thread_cache;
|
static I_List<THD> thread_cache;
|
||||||
static bool binlog_format_used= false;
|
static bool binlog_format_used= false;
|
||||||
@ -4001,6 +4001,7 @@ static int init_common_variables()
|
|||||||
#else
|
#else
|
||||||
default_storage_engine= const_cast<char *>("MyISAM");
|
default_storage_engine= const_cast<char *>("MyISAM");
|
||||||
#endif
|
#endif
|
||||||
|
default_tmp_storage_engine= NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Add server status variables to the dynamic list of
|
Add server status variables to the dynamic list of
|
||||||
@ -4576,6 +4577,52 @@ static void add_file_to_crash_report(char *file)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define init_default_storage_engine(X,Y) \
|
||||||
|
init_default_storage_engine_impl(#X, X, &global_system_variables.Y)
|
||||||
|
|
||||||
|
static int init_default_storage_engine_impl(const char *opt_name,
|
||||||
|
char *engine_name, plugin_ref *res)
|
||||||
|
{
|
||||||
|
if (!engine_name)
|
||||||
|
{
|
||||||
|
*res= 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LEX_STRING name= { engine_name, strlen(engine_name) };
|
||||||
|
plugin_ref plugin;
|
||||||
|
handlerton *hton;
|
||||||
|
if ((plugin= ha_resolve_by_name(0, &name, false)))
|
||||||
|
hton= plugin_hton(plugin);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sql_print_error("Unknown/unsupported storage engine: %s", engine_name);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (!ha_storage_engine_is_enabled(hton))
|
||||||
|
{
|
||||||
|
if (!opt_bootstrap)
|
||||||
|
{
|
||||||
|
sql_print_error("%s (%s) is not available", opt_name, engine_name);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
DBUG_ASSERT(*res);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Need to unlock as global_system_variables.table_plugin
|
||||||
|
was acquired during plugin_init()
|
||||||
|
*/
|
||||||
|
mysql_mutex_lock(&LOCK_global_system_variables);
|
||||||
|
if (*res)
|
||||||
|
plugin_unlock(0, *res);
|
||||||
|
*res= plugin;
|
||||||
|
mysql_mutex_unlock(&LOCK_global_system_variables);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int init_server_components()
|
static int init_server_components()
|
||||||
{
|
{
|
||||||
DBUG_ENTER("init_server_components");
|
DBUG_ENTER("init_server_components");
|
||||||
@ -4863,41 +4910,15 @@ a file name for --log-bin-index option", opt_binlog_index_name);
|
|||||||
opt_log ? log_output_options:LOG_NONE);
|
opt_log ? log_output_options:LOG_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
if (init_default_storage_engine(default_storage_engine, table_plugin))
|
||||||
Set the default storage engine
|
|
||||||
*/
|
|
||||||
LEX_STRING name= { default_storage_engine, strlen(default_storage_engine) };
|
|
||||||
plugin_ref plugin;
|
|
||||||
handlerton *hton;
|
|
||||||
if ((plugin= ha_resolve_by_name(0, &name)))
|
|
||||||
hton= plugin_hton(plugin);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sql_print_error("Unknown/unsupported storage engine: %s",
|
|
||||||
default_storage_engine);
|
|
||||||
unireg_abort(1);
|
unireg_abort(1);
|
||||||
}
|
|
||||||
if (!ha_storage_engine_is_enabled(hton))
|
if (default_tmp_storage_engine && !*default_tmp_storage_engine)
|
||||||
{
|
default_tmp_storage_engine= NULL;
|
||||||
if (!opt_bootstrap)
|
|
||||||
{
|
if (init_default_storage_engine(default_tmp_storage_engine, tmp_table_plugin))
|
||||||
sql_print_error("Default storage engine (%s) is not available",
|
|
||||||
default_storage_engine);
|
|
||||||
unireg_abort(1);
|
unireg_abort(1);
|
||||||
}
|
|
||||||
DBUG_ASSERT(global_system_variables.table_plugin);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Need to unlock as global_system_variables.table_plugin
|
|
||||||
was acquired during plugin_init()
|
|
||||||
*/
|
|
||||||
mysql_mutex_lock(&LOCK_global_system_variables);
|
|
||||||
plugin_unlock(0, global_system_variables.table_plugin);
|
|
||||||
global_system_variables.table_plugin= plugin;
|
|
||||||
mysql_mutex_unlock(&LOCK_global_system_variables);
|
|
||||||
}
|
|
||||||
#ifdef USE_ARIA_FOR_TMP_TABLES
|
#ifdef USE_ARIA_FOR_TMP_TABLES
|
||||||
if (!ha_storage_engine_is_enabled(maria_hton) && !opt_bootstrap)
|
if (!ha_storage_engine_is_enabled(maria_hton) && !opt_bootstrap)
|
||||||
{
|
{
|
||||||
@ -6770,9 +6791,6 @@ struct my_option my_long_options[]=
|
|||||||
0, 0, 0},
|
0, 0, 0},
|
||||||
{"core-file", OPT_WANT_CORE, "Write core on errors.", 0, 0, 0, GET_NO_ARG,
|
{"core-file", OPT_WANT_CORE, "Write core on errors.", 0, 0, 0, GET_NO_ARG,
|
||||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
/* default-storage-engine should have "MyISAM" as def_value. Instead
|
|
||||||
of initializing it here it is done in init_common_variables() due
|
|
||||||
to a compiler bug in Sun Studio compiler. */
|
|
||||||
#ifdef DBUG_OFF
|
#ifdef DBUG_OFF
|
||||||
{"debug", '#', "Built in DBUG debugger. Disabled in this build.",
|
{"debug", '#', "Built in DBUG debugger. Disabled in this build.",
|
||||||
¤t_dbug_option, ¤t_dbug_option, 0, GET_STR, OPT_ARG,
|
¤t_dbug_option, ¤t_dbug_option, 0, GET_STR, OPT_ARG,
|
||||||
@ -6829,9 +6847,16 @@ struct my_option my_long_options[]=
|
|||||||
&opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
|
&opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
|
||||||
0},
|
0},
|
||||||
#endif /* HAVE_REPLICATION */
|
#endif /* HAVE_REPLICATION */
|
||||||
|
/* default-storage-engine should have "MyISAM" as def_value. Instead
|
||||||
|
of initializing it here it is done in init_common_variables() due
|
||||||
|
to a compiler bug in Sun Studio compiler. */
|
||||||
{"default-storage-engine", 0, "The default storage engine for new tables",
|
{"default-storage-engine", 0, "The default storage engine for new tables",
|
||||||
&default_storage_engine, 0, 0, GET_STR, REQUIRED_ARG,
|
&default_storage_engine, 0, 0, GET_STR, REQUIRED_ARG,
|
||||||
0, 0, 0, 0, 0, 0 },
|
0, 0, 0, 0, 0, 0 },
|
||||||
|
{"default-tmp-storage-engine", 0,
|
||||||
|
"The default storage engine for user-created temporary tables",
|
||||||
|
&default_tmp_storage_engine, 0, 0, GET_STR, REQUIRED_ARG,
|
||||||
|
0, 0, 0, 0, 0, 0 },
|
||||||
{"default-time-zone", 0, "Set the default time zone.",
|
{"default-time-zone", 0, "Set the default time zone.",
|
||||||
&default_tz_name, &default_tz_name,
|
&default_tz_name, &default_tz_name,
|
||||||
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
|
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
|
||||||
|
@ -121,7 +121,7 @@ extern my_bool opt_enable_shared_memory;
|
|||||||
extern ulong opt_replicate_events_marked_for_skip;
|
extern ulong opt_replicate_events_marked_for_skip;
|
||||||
extern char *default_tz_name;
|
extern char *default_tz_name;
|
||||||
extern Time_zone *default_tz;
|
extern Time_zone *default_tz;
|
||||||
extern char *default_storage_engine;
|
extern char *default_storage_engine, *default_tmp_storage_engine;
|
||||||
extern bool opt_endinfo, using_udf_functions;
|
extern bool opt_endinfo, using_udf_functions;
|
||||||
extern my_bool locked_in_memory;
|
extern my_bool locked_in_memory;
|
||||||
extern bool opt_using_transactions;
|
extern bool opt_using_transactions;
|
||||||
|
@ -610,6 +610,7 @@ typedef struct system_variables
|
|||||||
my_bool query_cache_strip_comments;
|
my_bool query_cache_strip_comments;
|
||||||
|
|
||||||
plugin_ref table_plugin;
|
plugin_ref table_plugin;
|
||||||
|
plugin_ref tmp_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;
|
||||||
|
@ -2830,7 +2830,7 @@ case SQLCOM_PREPARE:
|
|||||||
rather than at parse-time.
|
rather than at parse-time.
|
||||||
*/
|
*/
|
||||||
if (!(create_info.used_fields & HA_CREATE_USED_ENGINE))
|
if (!(create_info.used_fields & HA_CREATE_USED_ENGINE))
|
||||||
create_info.db_type= ha_default_handlerton(thd);
|
create_info.use_default_db_type(thd);
|
||||||
/*
|
/*
|
||||||
If we are using SET CHARSET without DEFAULT, add an implicit
|
If we are using SET CHARSET without DEFAULT, add an implicit
|
||||||
DEFAULT to not confuse old users. (This may change).
|
DEFAULT to not confuse old users. (This may change).
|
||||||
|
@ -3072,13 +3072,15 @@ static double *mysql_sys_var_double(THD* thd, int offset)
|
|||||||
void plugin_thdvar_init(THD *thd)
|
void plugin_thdvar_init(THD *thd)
|
||||||
{
|
{
|
||||||
plugin_ref old_table_plugin= thd->variables.table_plugin;
|
plugin_ref old_table_plugin= thd->variables.table_plugin;
|
||||||
|
plugin_ref old_tmp_table_plugin= thd->variables.tmp_table_plugin;
|
||||||
DBUG_ENTER("plugin_thdvar_init");
|
DBUG_ENTER("plugin_thdvar_init");
|
||||||
|
|
||||||
|
// This function may be called many times per THD (e.g. on COM_CHANGE_USER)
|
||||||
thd->variables.table_plugin= NULL;
|
thd->variables.table_plugin= NULL;
|
||||||
|
thd->variables.tmp_table_plugin= NULL;
|
||||||
cleanup_variables(thd, &thd->variables);
|
cleanup_variables(thd, &thd->variables);
|
||||||
|
|
||||||
thd->variables= global_system_variables;
|
thd->variables= global_system_variables;
|
||||||
thd->variables.table_plugin= NULL;
|
|
||||||
|
|
||||||
/* we are going to allocate these lazily */
|
/* we are going to allocate these lazily */
|
||||||
thd->variables.dynamic_variables_version= 0;
|
thd->variables.dynamic_variables_version= 0;
|
||||||
@ -3088,7 +3090,11 @@ void plugin_thdvar_init(THD *thd)
|
|||||||
mysql_mutex_lock(&LOCK_plugin);
|
mysql_mutex_lock(&LOCK_plugin);
|
||||||
thd->variables.table_plugin=
|
thd->variables.table_plugin=
|
||||||
intern_plugin_lock(NULL, global_system_variables.table_plugin);
|
intern_plugin_lock(NULL, global_system_variables.table_plugin);
|
||||||
|
if (global_system_variables.tmp_table_plugin)
|
||||||
|
thd->variables.tmp_table_plugin=
|
||||||
|
intern_plugin_lock(NULL, global_system_variables.tmp_table_plugin);
|
||||||
intern_plugin_unlock(NULL, old_table_plugin);
|
intern_plugin_unlock(NULL, old_table_plugin);
|
||||||
|
intern_plugin_unlock(NULL, old_tmp_table_plugin);
|
||||||
mysql_mutex_unlock(&LOCK_plugin);
|
mysql_mutex_unlock(&LOCK_plugin);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
@ -3100,7 +3106,8 @@ void plugin_thdvar_init(THD *thd)
|
|||||||
static void unlock_variables(THD *thd, struct system_variables *vars)
|
static void unlock_variables(THD *thd, struct system_variables *vars)
|
||||||
{
|
{
|
||||||
intern_plugin_unlock(NULL, vars->table_plugin);
|
intern_plugin_unlock(NULL, vars->table_plugin);
|
||||||
vars->table_plugin= NULL;
|
intern_plugin_unlock(NULL, vars->tmp_table_plugin);
|
||||||
|
vars->table_plugin= vars->tmp_table_plugin= NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3136,6 +3143,7 @@ static void cleanup_variables(THD *thd, struct system_variables *vars)
|
|||||||
mysql_rwlock_unlock(&LOCK_system_variables_hash);
|
mysql_rwlock_unlock(&LOCK_system_variables_hash);
|
||||||
|
|
||||||
DBUG_ASSERT(vars->table_plugin == NULL);
|
DBUG_ASSERT(vars->table_plugin == NULL);
|
||||||
|
DBUG_ASSERT(vars->tmp_table_plugin == NULL);
|
||||||
|
|
||||||
my_free(vars->dynamic_variables_ptr);
|
my_free(vars->dynamic_variables_ptr);
|
||||||
vars->dynamic_variables_ptr= NULL;
|
vars->dynamic_variables_ptr= NULL;
|
||||||
|
@ -1112,7 +1112,7 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry)
|
|||||||
frm_action= TRUE;
|
frm_action= TRUE;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
plugin_ref plugin= ha_resolve_by_name(thd, &handler_name);
|
plugin_ref plugin= ha_resolve_by_name(thd, &handler_name, false);
|
||||||
if (!plugin)
|
if (!plugin)
|
||||||
{
|
{
|
||||||
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), ddl_log_entry->handler_name);
|
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), ddl_log_entry->handler_name);
|
||||||
|
@ -2382,7 +2382,7 @@ create:
|
|||||||
if ((lex->create_info.used_fields & HA_CREATE_USED_ENGINE) &&
|
if ((lex->create_info.used_fields & HA_CREATE_USED_ENGINE) &&
|
||||||
!lex->create_info.db_type)
|
!lex->create_info.db_type)
|
||||||
{
|
{
|
||||||
lex->create_info.db_type= ha_default_handlerton(thd);
|
lex->create_info.use_default_db_type(thd);
|
||||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
|
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
|
||||||
ER_WARN_USING_OTHER_HANDLER,
|
ER_WARN_USING_OTHER_HANDLER,
|
||||||
ER(ER_WARN_USING_OTHER_HANDLER),
|
ER(ER_WARN_USING_OTHER_HANDLER),
|
||||||
@ -5835,7 +5835,8 @@ default_collation:
|
|||||||
storage_engines:
|
storage_engines:
|
||||||
ident_or_text
|
ident_or_text
|
||||||
{
|
{
|
||||||
plugin_ref plugin= ha_resolve_by_name(thd, &$1);
|
plugin_ref plugin= ha_resolve_by_name(thd, &$1,
|
||||||
|
thd->lex->create_info.tmp_table());
|
||||||
|
|
||||||
if (plugin)
|
if (plugin)
|
||||||
$$= plugin_hton(plugin);
|
$$= plugin_hton(plugin);
|
||||||
@ -5859,7 +5860,7 @@ known_storage_engines:
|
|||||||
ident_or_text
|
ident_or_text
|
||||||
{
|
{
|
||||||
plugin_ref plugin;
|
plugin_ref plugin;
|
||||||
if ((plugin= ha_resolve_by_name(thd, &$1)))
|
if ((plugin= ha_resolve_by_name(thd, &$1, false)))
|
||||||
$$= plugin_hton(plugin);
|
$$= plugin_hton(plugin);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3292,6 +3292,12 @@ static Sys_var_plugin Sys_storage_engine(
|
|||||||
MYSQL_STORAGE_ENGINE_PLUGIN, DEFAULT(&default_storage_engine),
|
MYSQL_STORAGE_ENGINE_PLUGIN, DEFAULT(&default_storage_engine),
|
||||||
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_not_null));
|
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_not_null));
|
||||||
|
|
||||||
|
static Sys_var_plugin Sys_default_tmp_storage_engine(
|
||||||
|
"default_tmp_storage_engine", "The default storage engine for user-created temporary tables",
|
||||||
|
SESSION_VAR(tmp_table_plugin), NO_CMD_LINE,
|
||||||
|
MYSQL_STORAGE_ENGINE_PLUGIN, DEFAULT(&default_tmp_storage_engine),
|
||||||
|
NO_MUTEX_GUARD, NOT_IN_BINLOG);
|
||||||
|
|
||||||
#if defined(ENABLED_DEBUG_SYNC)
|
#if defined(ENABLED_DEBUG_SYNC)
|
||||||
/*
|
/*
|
||||||
Variable can be set for the session only.
|
Variable can be set for the session only.
|
||||||
|
@ -1344,7 +1344,7 @@ public:
|
|||||||
|
|
||||||
// special code for storage engines (e.g. to handle historical aliases)
|
// special code for storage engines (e.g. to handle historical aliases)
|
||||||
if (plugin_type == MYSQL_STORAGE_ENGINE_PLUGIN)
|
if (plugin_type == MYSQL_STORAGE_ENGINE_PLUGIN)
|
||||||
plugin= ha_resolve_by_name(thd, &pname);
|
plugin= ha_resolve_by_name(thd, &pname, false);
|
||||||
else
|
else
|
||||||
plugin= my_plugin_lock_by_name(thd, &pname, plugin_type);
|
plugin= my_plugin_lock_by_name(thd, &pname, plugin_type);
|
||||||
if (!plugin)
|
if (!plugin)
|
||||||
@ -1366,7 +1366,7 @@ public:
|
|||||||
plugin_ref oldval= *valptr;
|
plugin_ref oldval= *valptr;
|
||||||
if (oldval != newval)
|
if (oldval != newval)
|
||||||
{
|
{
|
||||||
*valptr= my_plugin_lock(NULL, newval);
|
*valptr= newval ? my_plugin_lock(NULL, newval) : 0;
|
||||||
plugin_unlock(NULL, oldval);
|
plugin_unlock(NULL, oldval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1385,24 +1385,29 @@ public:
|
|||||||
void session_save_default(THD *thd, set_var *var)
|
void session_save_default(THD *thd, set_var *var)
|
||||||
{
|
{
|
||||||
plugin_ref plugin= global_var(plugin_ref);
|
plugin_ref plugin= global_var(plugin_ref);
|
||||||
var->save_result.plugin= my_plugin_lock(thd, plugin);
|
var->save_result.plugin= plugin ? my_plugin_lock(thd, plugin) : 0;
|
||||||
}
|
}
|
||||||
void global_save_default(THD *thd, set_var *var)
|
void global_save_default(THD *thd, set_var *var)
|
||||||
{
|
{
|
||||||
LEX_STRING pname;
|
LEX_STRING pname;
|
||||||
char **default_value= reinterpret_cast<char**>(option.def_value);
|
char *default_value= *reinterpret_cast<char**>(option.def_value);
|
||||||
pname.str= *default_value;
|
if (!default_value)
|
||||||
|
var->save_result.plugin= 0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pname.str= default_value;
|
||||||
pname.length= strlen(pname.str);
|
pname.length= strlen(pname.str);
|
||||||
|
|
||||||
plugin_ref plugin;
|
plugin_ref plugin;
|
||||||
if (plugin_type == MYSQL_STORAGE_ENGINE_PLUGIN)
|
if (plugin_type == MYSQL_STORAGE_ENGINE_PLUGIN)
|
||||||
plugin= ha_resolve_by_name(thd, &pname);
|
plugin= ha_resolve_by_name(thd, &pname, false);
|
||||||
else
|
else
|
||||||
plugin= my_plugin_lock_by_name(thd, &pname, plugin_type);
|
plugin= my_plugin_lock_by_name(thd, &pname, plugin_type);
|
||||||
DBUG_ASSERT(plugin);
|
DBUG_ASSERT(plugin);
|
||||||
|
|
||||||
var->save_result.plugin= my_plugin_lock(thd, plugin);
|
var->save_result.plugin= my_plugin_lock(thd, plugin);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
bool check_update_type(Item_result type)
|
bool check_update_type(Item_result type)
|
||||||
{ return type != STRING_RESULT; }
|
{ return type != STRING_RESULT; }
|
||||||
uchar *session_value_ptr(THD *thd, LEX_STRING *base)
|
uchar *session_value_ptr(THD *thd, LEX_STRING *base)
|
||||||
|
@ -982,7 +982,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
|||||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||||
{
|
{
|
||||||
LEX_STRING name= { (char*)extra2, length };
|
LEX_STRING name= { (char*)extra2, length };
|
||||||
share->default_part_plugin= ha_resolve_by_name(NULL, &name);
|
share->default_part_plugin= ha_resolve_by_name(NULL, &name, false);
|
||||||
if (!share->default_part_plugin)
|
if (!share->default_part_plugin)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
@ -1136,7 +1136,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
|||||||
name.str= (char*) next_chunk + 2;
|
name.str= (char*) next_chunk + 2;
|
||||||
name.length= str_db_type_length;
|
name.length= str_db_type_length;
|
||||||
|
|
||||||
plugin_ref tmp_plugin= ha_resolve_by_name(thd, &name);
|
plugin_ref tmp_plugin= ha_resolve_by_name(thd, &name, false);
|
||||||
if (tmp_plugin != NULL && !plugin_equals(tmp_plugin, se_plugin))
|
if (tmp_plugin != NULL && !plugin_equals(tmp_plugin, se_plugin))
|
||||||
{
|
{
|
||||||
if (se_plugin)
|
if (se_plugin)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user