Bug #27712 Single user mode. Creating logfile group and tablespace is allowed

parent 9ca17d3c
......@@ -2,7 +2,37 @@ use test;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
create table t1 (a int key, b int unique, c int) engine ndb;
ERROR HY000: Can't create table 'test.t1' (errno: 299)
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
ERROR HY000: Failed to create LOGFILE GROUP
show warnings;
Level Code Message
Error 1296 Got error 299 'Operation not allowed or aborted due to single user mode' from NDB
Error 1516 Failed to create LOGFILE GROUP
create table t1 (a int key, b int unique, c int) engine ndb;
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB;
ERROR HY000: Failed to create TABLESPACE
show warnings;
Level Code Message
Error 1296 Got error 299 'Operation not allowed or aborted due to single user mode' from NDB
Error 1516 Failed to create TABLESPACE
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB;
insert into t1 values (1,1,0),(2,2,0),(3,3,0),(4,4,0),(5,5,0),(6,6,0),(7,7,0),(8,8,0),(9,9,0),(10,10,0);
create table t2 as select * from t1;
select * from t1 where a = 1;
......
......@@ -20,13 +20,43 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" --single-user >> $NDB_TOOLS_OUTPUT
# verify that we are indeed in single user mode
# and test that some operations give correct errors
--connection server2
--error 1005
create table t1 (a int key, b int unique, c int) engine ndb;
# Bug #27712 Single user mode. Creating logfile group and tablespace is allowed
# - before bug fix these would succeed
--error 1516
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
show warnings;
# test some sql on first mysqld
--connection server1
create table t1 (a int key, b int unique, c int) engine ndb;
# Check that we can create logfile group
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
--connection server2
--error 1516
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB;
show warnings;
--connection server1
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB;
insert into t1 values (1,1,0),(2,2,0),(3,3,0),(4,4,0),(5,5,0),(6,6,0),(7,7,0),(8,8,0),(9,9,0),(10,10,0);
create table t2 as select * from t1;
# read with pk
......
......@@ -66,7 +66,8 @@ struct CreateFilegroupRef {
InvalidExtentSize = 764,
InvalidUndoBufferSize = 779,
NoSuchLogfileGroup = 767,
InvalidFilegroupVersion = 768
InvalidFilegroupVersion = 768,
SingleUser = 299
};
Uint32 senderData;
......@@ -159,7 +160,8 @@ struct CreateFileRef {
FilenameAlreadyExists = 760,
OutOfFileRecords = 751,
InvalidFileType = 750,
NotSupportedWhenDiskless = 775
NotSupportedWhenDiskless = 775,
SingleUser = 299
};
Uint32 senderData;
......
......@@ -66,7 +66,8 @@ struct DropFilegroupRef {
NotMaster = 702,
NoSuchFilegroup = 767,
FilegroupInUse = 768,
InvalidSchemaObjectVersion = 774
InvalidSchemaObjectVersion = 774,
SingleUser = 299
};
Uint32 senderData;
......@@ -152,7 +153,8 @@ struct DropFileRef {
NotMaster = 702,
NoSuchFile = 766,
DropUndoFileNotSupported = 769,
InvalidSchemaObjectVersion = 774
InvalidSchemaObjectVersion = 774,
SingleUser = 299
};
Uint32 senderData;
......
......@@ -14084,6 +14084,15 @@ Dbdict::execCREATE_FILE_REQ(Signal* signal){
break;
}
if (checkSingleUserMode(senderRef))
{
ref->errorCode = CreateFileRef::SingleUser;
ref->status = 0;
ref->errorKey = 0;
ref->errorLine = __LINE__;
break;
}
Ptr<SchemaTransaction> trans_ptr;
if (! c_Trans.seize(trans_ptr)){
ref->errorCode = CreateFileRef::Busy;
......@@ -14189,6 +14198,15 @@ Dbdict::execCREATE_FILEGROUP_REQ(Signal* signal){
break;
}
if (checkSingleUserMode(senderRef))
{
ref->errorCode = CreateFilegroupRef::SingleUser;
ref->status = 0;
ref->errorKey = 0;
ref->errorLine = __LINE__;
break;
}
Ptr<SchemaTransaction> trans_ptr;
if (! c_Trans.seize(trans_ptr)){
ref->errorCode = CreateFilegroupRef::Busy;
......@@ -14291,6 +14309,14 @@ Dbdict::execDROP_FILE_REQ(Signal* signal)
break;
}
if (checkSingleUserMode(senderRef))
{
ref->errorCode = DropFileRef::SingleUser;
ref->errorKey = 0;
ref->errorLine = __LINE__;
break;
}
Ptr<File> file_ptr;
if (!c_file_hash.find(file_ptr, objId))
{
......@@ -14309,7 +14335,7 @@ Dbdict::execDROP_FILE_REQ(Signal* signal)
Ptr<SchemaTransaction> trans_ptr;
if (! c_Trans.seize(trans_ptr))
{
ref->errorCode = CreateFileRef::Busy;
ref->errorCode = DropFileRef::Busy;
ref->errorLine = __LINE__;
break;
}
......@@ -14392,6 +14418,14 @@ Dbdict::execDROP_FILEGROUP_REQ(Signal* signal)
break;
}
if (checkSingleUserMode(senderRef))
{
ref->errorCode = DropFilegroupRef::SingleUser;
ref->errorKey = 0;
ref->errorLine = __LINE__;
break;
}
Ptr<Filegroup> filegroup_ptr;
if (!c_filegroup_hash.find(filegroup_ptr, objId))
{
......@@ -14410,7 +14444,7 @@ Dbdict::execDROP_FILEGROUP_REQ(Signal* signal)
Ptr<SchemaTransaction> trans_ptr;
if (! c_Trans.seize(trans_ptr))
{
ref->errorCode = CreateFilegroupRef::Busy;
ref->errorCode = DropFilegroupRef::Busy;
ref->errorLine = __LINE__;
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment