Commit 504bd235 authored by unknown's avatar unknown

Bug #27710 Creating unique index fails during single user mode

- enable indexes to be used always, if in single user, reject will happen before, and if it is kerlel doing stuff, it should always be allowed


mysql-test/r/ndb_single_user.result:
  Bug #27710 Creating unique index fails during single user mode
mysql-test/t/ndb_single_user.test:
  Bug #27710 Creating unique index fails during single user mode
parent 41d1220b
...@@ -55,11 +55,12 @@ update t1 set b=b+100; ...@@ -55,11 +55,12 @@ update t1 set b=b+100;
update t1 set b=b+100 where a > 7; update t1 set b=b+100 where a > 7;
delete from t1; delete from t1;
insert into t1 select * from t2; insert into t1 select * from t2;
create unique index new_index on t1 (b,c);
drop table t1; drop table t1;
ERROR 42S02: Unknown table 't1' ERROR 42S02: Unknown table 't1'
create index new_index on t1 (c); create index new_index_fail on t1 (c);
ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
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); insert into t1 values (21,21,0),(22,22,0),(23,23,0),(24,24,0),(25,25,0),(26,26,0),(27,27,0),(28,28,0),(29,29,0),(210,210,0);
ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
select * from t1 where a = 1; select * from t1 where a = 1;
ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
......
...@@ -76,15 +76,18 @@ update t1 set b=b+100 where a > 7; ...@@ -76,15 +76,18 @@ update t1 set b=b+100 where a > 7;
# delete with full table scan # delete with full table scan
delete from t1; delete from t1;
insert into t1 select * from t2; insert into t1 select * from t2;
# Bug #27710 Creating unique index fails during single user mode
# - prior to bugfix this would fail
create unique index new_index on t1 (b,c);
# test some sql on other mysqld # test some sql on other mysqld
--connection server2 --connection server2
--error 1051 --error 1051
drop table t1; drop table t1;
--error 1296 --error 1296
create index new_index on t1 (c); create index new_index_fail on t1 (c);
--error 1296 --error 1296
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); insert into t1 values (21,21,0),(22,22,0),(23,23,0),(24,24,0),(25,25,0),(26,26,0),(27,27,0),(28,28,0),(29,29,0),(210,210,0);
--error 1296 --error 1296
select * from t1 where a = 1; select * from t1 where a = 1;
--error 1296 --error 1296
......
...@@ -8158,6 +8158,7 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr) ...@@ -8158,6 +8158,7 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr)
w.add(DictTabInfo::NoOfKeyAttr, indexPtr.p->noOfPrimkey); w.add(DictTabInfo::NoOfKeyAttr, indexPtr.p->noOfPrimkey);
w.add(DictTabInfo::NoOfNullable, indexPtr.p->noOfNullAttr); w.add(DictTabInfo::NoOfNullable, indexPtr.p->noOfNullAttr);
w.add(DictTabInfo::KeyLength, indexPtr.p->tupKeyLength); w.add(DictTabInfo::KeyLength, indexPtr.p->tupKeyLength);
w.add(DictTabInfo::SingleUserMode, (Uint32)1);
// write index key attributes // write index key attributes
for (k = 0; k < opPtr.p->m_attrList.sz; k++) { for (k = 0; k < opPtr.p->m_attrList.sz; k++) {
// insert the attributes in the order decided above in attrid_map // insert the attributes in the order decided above in attrid_map
......
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