Commit c3ce3430 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

parent 3e8252ff
set autocommit=1;
reset master;
create table bug16206 (a int);
insert into bug16206 values(1);
start transaction;
insert into bug16206 values(2);
commit;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
f n Query 1 n use `test`; create table bug16206 (a int)
f n Query 1 n use `test`; insert into bug16206 values(1)
f n Query 1 n use `test`; insert into bug16206 values(2)
drop table bug16206;
reset master;
create table bug16206 (a int) engine= bdb;
insert into bug16206 values(0);
insert into bug16206 values(1);
start transaction;
insert into bug16206 values(2);
commit;
insert into bug16206 values(3);
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
f n Query 1 n use `test`; create table bug16206 (a int) engine= bdb
f n Query 1 n use `test`; insert into bug16206 values(0)
f n Query 1 n use `test`; insert into bug16206 values(1)
f n Query 1 n use `test`; BEGIN
f n Query 1 n use `test`; insert into bug16206 values(2)
f n Query 1 n use `test`; COMMIT
f n Query 1 n use `test`; insert into bug16206 values(3)
drop table bug16206;
set autocommit=0;
End of 5.0 tests
......@@ -25,11 +25,12 @@ update t1 set b=b+100;
update t1 set b=b+100 where a > 7;
delete from t1;
insert into t1 select * from t2;
create unique index new_index on t1 (b,c);
drop 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
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
select * from t1 where a = 1;
ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from ndbcluster
......
-- source include/not_embedded.inc
-- source include/have_bdb.inc
#
# Bug #16206: Superfluous COMMIT event in binlog when updating BDB in autocommit mode
#
set autocommit=1;
let $VERSION=`select version()`;
reset master;
create table bug16206 (a int);
insert into bug16206 values(1);
start transaction;
insert into bug16206 values(2);
commit;
--replace_result $VERSION VERSION
--replace_column 1 f 2 n 5 n
show binlog events;
drop table bug16206;
reset master;
create table bug16206 (a int) engine= bdb;
insert into bug16206 values(0);
insert into bug16206 values(1);
start transaction;
insert into bug16206 values(2);
commit;
insert into bug16206 values(3);
--replace_result $VERSION VERSION
--replace_column 1 f 2 n 5 n
show binlog events;
drop table bug16206;
set autocommit=0;
--echo End of 5.0 tests
......@@ -46,15 +46,18 @@ update t1 set b=b+100 where a > 7;
# delete with full table scan
delete from t1;
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
--connection server2
--error 1051
drop table t1;
--error 1296
create index new_index on t1 (c);
create index new_index_fail on t1 (c);
--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
select * from t1 where a = 1;
--error 1296
......
......@@ -6883,6 +6883,7 @@ Dbdict::createIndex_toCreateTable(Signal* signal, OpCreateIndexPtr opPtr)
w.add(DictTabInfo::NoOfKeyAttr, indexPtr.p->noOfPrimkey);
w.add(DictTabInfo::NoOfNullable, indexPtr.p->noOfNullAttr);
w.add(DictTabInfo::KeyLength, indexPtr.p->tupKeyLength);
w.add(DictTabInfo::SingleUserMode, (Uint32)1);
// write index key attributes
AttributeRecordPtr aRecPtr;
c_attributeRecordPool.getPtr(aRecPtr, tablePtr.p->firstAttribute);
......
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