bug#18604 create logfile for MyISAM tables
- changed alter tablespace truct to work with handlerton pointer (to avoid crash in parser on unknown db type" - pushed warnings when default storage engine is used and/or tablespace stuff is not supported by storage engine mysql-test/r/ndb_dd_basic.result: bug#18604 create logfile for MyISAM tables mysql-test/t/ndb_dd_basic.test: bug#18604 create logfile for MyISAM tables
This commit is contained in:
parent
0ba08ecf78
commit
8b308fbbc5
@ -3,11 +3,32 @@ CREATE LOGFILE GROUP lg1
|
|||||||
ADD UNDOFILE 'undofile.dat'
|
ADD UNDOFILE 'undofile.dat'
|
||||||
INITIAL_SIZE 16M
|
INITIAL_SIZE 16M
|
||||||
UNDO_BUFFER_SIZE = 1M
|
UNDO_BUFFER_SIZE = 1M
|
||||||
ENGINE=NDB;
|
ENGINE=MYISAM;
|
||||||
|
Warnings:
|
||||||
|
Error 1539 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
|
||||||
|
ALTER LOGFILE GROUP lg1
|
||||||
|
ADD UNDOFILE 'undofile02.dat'
|
||||||
|
INITIAL_SIZE = 4M
|
||||||
|
ENGINE=XYZ;
|
||||||
|
Warnings:
|
||||||
|
Error 1266 Using storage engine MyISAM for table 'lg1'
|
||||||
|
Error 1539 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
|
||||||
|
CREATE TABLESPACE ts1
|
||||||
|
ADD DATAFILE 'datafile.dat'
|
||||||
|
USE LOGFILE GROUP lg1
|
||||||
|
INITIAL_SIZE 12M;
|
||||||
|
Warnings:
|
||||||
|
Error 1539 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP'
|
||||||
|
set storage_engine=ndb;
|
||||||
|
CREATE LOGFILE GROUP lg1
|
||||||
|
ADD UNDOFILE 'undofile.dat'
|
||||||
|
INITIAL_SIZE 16M
|
||||||
|
UNDO_BUFFER_SIZE = 1M;
|
||||||
ALTER LOGFILE GROUP lg1
|
ALTER LOGFILE GROUP lg1
|
||||||
ADD UNDOFILE 'undofile02.dat'
|
ADD UNDOFILE 'undofile02.dat'
|
||||||
INITIAL_SIZE = 4M
|
INITIAL_SIZE = 4M
|
||||||
ENGINE=NDB;
|
ENGINE=NDB;
|
||||||
|
set storage_engine=myisam;
|
||||||
CREATE TABLESPACE ts1
|
CREATE TABLESPACE ts1
|
||||||
ADD DATAFILE 'datafile.dat'
|
ADD DATAFILE 'datafile.dat'
|
||||||
USE LOGFILE GROUP lg1
|
USE LOGFILE GROUP lg1
|
||||||
|
@ -14,16 +14,33 @@
|
|||||||
DROP TABLE IF EXISTS t1;
|
DROP TABLE IF EXISTS t1;
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
|
|
||||||
|
# some negative tests
|
||||||
|
CREATE LOGFILE GROUP lg1
|
||||||
|
ADD UNDOFILE 'undofile.dat'
|
||||||
|
INITIAL_SIZE 16M
|
||||||
|
UNDO_BUFFER_SIZE = 1M
|
||||||
|
ENGINE=MYISAM;
|
||||||
|
|
||||||
|
ALTER LOGFILE GROUP lg1
|
||||||
|
ADD UNDOFILE 'undofile02.dat'
|
||||||
|
INITIAL_SIZE = 4M
|
||||||
|
ENGINE=XYZ;
|
||||||
|
|
||||||
|
CREATE TABLESPACE ts1
|
||||||
|
ADD DATAFILE 'datafile.dat'
|
||||||
|
USE LOGFILE GROUP lg1
|
||||||
|
INITIAL_SIZE 12M;
|
||||||
|
|
||||||
##################################
|
##################################
|
||||||
# Basic test of disk tables for NDB
|
# Basic test of disk tables for NDB
|
||||||
# Start by creating a logfile group
|
# Start by creating a logfile group
|
||||||
##################################
|
##################################
|
||||||
|
|
||||||
|
set storage_engine=ndb;
|
||||||
CREATE LOGFILE GROUP lg1
|
CREATE LOGFILE GROUP lg1
|
||||||
ADD UNDOFILE 'undofile.dat'
|
ADD UNDOFILE 'undofile.dat'
|
||||||
INITIAL_SIZE 16M
|
INITIAL_SIZE 16M
|
||||||
UNDO_BUFFER_SIZE = 1M
|
UNDO_BUFFER_SIZE = 1M;
|
||||||
ENGINE=NDB;
|
|
||||||
|
|
||||||
ALTER LOGFILE GROUP lg1
|
ALTER LOGFILE GROUP lg1
|
||||||
ADD UNDOFILE 'undofile02.dat'
|
ADD UNDOFILE 'undofile02.dat'
|
||||||
@ -34,6 +51,7 @@ ENGINE=NDB;
|
|||||||
# Create a tablespace connected to the logfile group
|
# Create a tablespace connected to the logfile group
|
||||||
###################################################
|
###################################################
|
||||||
|
|
||||||
|
set storage_engine=myisam;
|
||||||
CREATE TABLESPACE ts1
|
CREATE TABLESPACE ts1
|
||||||
ADD DATAFILE 'datafile.dat'
|
ADD DATAFILE 'datafile.dat'
|
||||||
USE LOGFILE GROUP lg1
|
USE LOGFILE GROUP lg1
|
||||||
|
@ -402,6 +402,7 @@ enum tablespace_access_mode
|
|||||||
TS_NOT_ACCESSIBLE = 2
|
TS_NOT_ACCESSIBLE = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct handlerton;
|
||||||
class st_alter_tablespace : public Sql_alloc
|
class st_alter_tablespace : public Sql_alloc
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -419,7 +420,7 @@ class st_alter_tablespace : public Sql_alloc
|
|||||||
ulonglong autoextend_size;
|
ulonglong autoextend_size;
|
||||||
ulonglong max_size;
|
ulonglong max_size;
|
||||||
uint nodegroup_id;
|
uint nodegroup_id;
|
||||||
enum legacy_db_type storage_engine;
|
const handlerton *storage_engine;
|
||||||
bool wait_until_completed;
|
bool wait_until_completed;
|
||||||
const char *ts_comment;
|
const char *ts_comment;
|
||||||
enum tablespace_access_mode ts_access_mode;
|
enum tablespace_access_mode ts_access_mode;
|
||||||
@ -437,7 +438,7 @@ class st_alter_tablespace : public Sql_alloc
|
|||||||
initial_size= 128*1024*1024; //Default 128 MByte
|
initial_size= 128*1024*1024; //Default 128 MByte
|
||||||
autoextend_size= 0; //No autoextension as default
|
autoextend_size= 0; //No autoextension as default
|
||||||
max_size= 0; //Max size == initial size => no extension
|
max_size= 0; //Max size == initial size => no extension
|
||||||
storage_engine= DB_TYPE_UNKNOWN;
|
storage_engine= NULL;
|
||||||
nodegroup_id= UNDEF_NODEGROUP;
|
nodegroup_id= UNDEF_NODEGROUP;
|
||||||
wait_until_completed= TRUE;
|
wait_until_completed= TRUE;
|
||||||
ts_comment= NULL;
|
ts_comment= NULL;
|
||||||
@ -468,7 +469,7 @@ enum ha_stat_type { HA_ENGINE_STATUS, HA_ENGINE_LOGS, HA_ENGINE_MUTEX };
|
|||||||
|
|
||||||
savepoint_*, prepare, recover, and *_by_xid pointers can be 0.
|
savepoint_*, prepare, recover, and *_by_xid pointers can be 0.
|
||||||
*/
|
*/
|
||||||
typedef struct
|
struct handlerton
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
handlerton structure version
|
handlerton structure version
|
||||||
@ -581,7 +582,7 @@ typedef struct
|
|||||||
const char *query, uint query_length,
|
const char *query, uint query_length,
|
||||||
const char *db, const char *table_name);
|
const char *db, const char *table_name);
|
||||||
int (*release_temporary_latches)(THD *thd);
|
int (*release_temporary_latches)(THD *thd);
|
||||||
} handlerton;
|
};
|
||||||
|
|
||||||
extern const handlerton default_hton;
|
extern const handlerton default_hton;
|
||||||
|
|
||||||
|
@ -21,32 +21,51 @@
|
|||||||
int mysql_alter_tablespace(THD *thd, st_alter_tablespace *ts_info)
|
int mysql_alter_tablespace(THD *thd, st_alter_tablespace *ts_info)
|
||||||
{
|
{
|
||||||
int error= HA_ADMIN_NOT_IMPLEMENTED;
|
int error= HA_ADMIN_NOT_IMPLEMENTED;
|
||||||
handlerton *hton;
|
const handlerton *hton= ts_info->storage_engine;
|
||||||
|
|
||||||
DBUG_ENTER("mysql_alter_tablespace");
|
DBUG_ENTER("mysql_alter_tablespace");
|
||||||
/*
|
/*
|
||||||
If the user haven't defined an engine, this will fallback to using the
|
If the user haven't defined an engine, this will fallback to using the
|
||||||
default storage engine.
|
default storage engine.
|
||||||
*/
|
*/
|
||||||
hton= ha_resolve_by_legacy_type(thd, ts_info->storage_engine != DB_TYPE_UNKNOWN ?
|
if (hton == NULL || hton == &default_hton || hton->state != SHOW_OPTION_YES)
|
||||||
ts_info->storage_engine : DB_TYPE_DEFAULT);
|
|
||||||
|
|
||||||
if (hton->state == SHOW_OPTION_YES &&
|
|
||||||
hton->alter_tablespace && (error= hton->alter_tablespace(thd, ts_info)))
|
|
||||||
{
|
{
|
||||||
if (error == HA_ADMIN_NOT_IMPLEMENTED)
|
hton= ha_resolve_by_legacy_type(thd, DB_TYPE_DEFAULT);
|
||||||
|
if (ts_info->storage_engine != 0)
|
||||||
|
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
|
||||||
|
ER_WARN_USING_OTHER_HANDLER,
|
||||||
|
ER(ER_WARN_USING_OTHER_HANDLER),
|
||||||
|
hton->name,
|
||||||
|
ts_info->tablespace_name
|
||||||
|
? ts_info->tablespace_name : ts_info->logfile_group_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hton->alter_tablespace)
|
||||||
|
{
|
||||||
|
if ((error= hton->alter_tablespace(thd, ts_info)))
|
||||||
{
|
{
|
||||||
my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "");
|
if (error == HA_ADMIN_NOT_IMPLEMENTED)
|
||||||
|
{
|
||||||
|
my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "");
|
||||||
|
}
|
||||||
|
else if (error == 1)
|
||||||
|
{
|
||||||
|
DBUG_RETURN(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
my_error(error, MYF(0));
|
||||||
|
}
|
||||||
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
else if (error == 1)
|
}
|
||||||
{
|
else
|
||||||
DBUG_RETURN(1);
|
{
|
||||||
}
|
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
|
||||||
else
|
ER_ILLEGAL_HA_CREATE_OPTION,
|
||||||
{
|
ER(ER_ILLEGAL_HA_CREATE_OPTION),
|
||||||
my_error(error, MYF(0));
|
hton->name,
|
||||||
}
|
"TABLESPACE or LOGFILE GROUP");
|
||||||
DBUG_RETURN(error);
|
|
||||||
}
|
}
|
||||||
if (mysql_bin_log.is_open())
|
if (mysql_bin_log.is_open())
|
||||||
{
|
{
|
||||||
|
@ -3187,13 +3187,13 @@ opt_ts_engine:
|
|||||||
opt_storage ENGINE_SYM opt_equal storage_engines
|
opt_storage ENGINE_SYM opt_equal storage_engines
|
||||||
{
|
{
|
||||||
LEX *lex= Lex;
|
LEX *lex= Lex;
|
||||||
if (lex->alter_tablespace_info->storage_engine != DB_TYPE_UNKNOWN)
|
if (lex->alter_tablespace_info->storage_engine != NULL)
|
||||||
{
|
{
|
||||||
my_error(ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),
|
my_error(ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),
|
||||||
"STORAGE ENGINE");
|
"STORAGE ENGINE");
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
lex->alter_tablespace_info->storage_engine= $4->db_type;
|
lex->alter_tablespace_info->storage_engine= $4 ? $4 : &default_hton;
|
||||||
};
|
};
|
||||||
|
|
||||||
opt_ts_wait:
|
opt_ts_wait:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user