Loading config/ac-macros/ha_ndbcluster.m4 +1 −1 Original line number Diff line number Diff line Loading @@ -197,7 +197,7 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [ MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --with-ndbcluster" # CXXFLAGS="$CXXFLAGS \$(NDB_CXXFLAGS)" CXXFLAGS="$CXXFLAGS \$(NDB_CXXFLAGS)" if test "$have_ndb_debug" = "default" then have_ndb_debug=$with_debug Loading mysql-test/r/ndb_lock.result +80 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,86 @@ pk u o 5 5 5 insert into t1 values (1,1,1); drop table t1; create table t1 (x integer not null primary key, y varchar(32), z integer, key(z)) engine = ndb; insert into t1 values (1,'one',1), (2,'two',2),(3,"three",3); begin; select * from t1 where x = 1 for update; x y z 1 one 1 begin; select * from t1 where x = 2 for update; x y z 2 two 2 select * from t1 where x = 1 for update; ERROR HY000: Lock wait timeout exceeded; try restarting transaction rollback; commit; begin; select * from t1 where y = 'one' or y = 'three' order by x for update; x y z 1 one 1 3 three 3 begin; select * from t1 where x = 1 for update; ERROR HY000: Lock wait timeout exceeded; try restarting transaction rollback; commit; begin; select * from t1 where z > 1 and z < 3 for update; x y z 2 two 2 begin; select * from t1 where x = 1 for update; x y z 1 one 1 select * from t1 where x = 2 for update; ERROR HY000: Lock wait timeout exceeded; try restarting transaction rollback; commit; begin; select * from t1 where x = 1 lock in share mode; x y z 1 one 1 begin; select * from t1 where x = 1 lock in share mode; x y z 1 one 1 select * from t1 where x = 2 for update; x y z 2 two 2 select * from t1 where x = 1 for update; ERROR HY000: Lock wait timeout exceeded; try restarting transaction rollback; commit; begin; select * from t1 where y = 'one' or y = 'three' order by x lock in share mode; x y z 1 one 1 3 three 3 begin; select * from t1 where y = 'one' lock in share mode; x y z 1 one 1 select * from t1 where x = 1 for update; ERROR HY000: Lock wait timeout exceeded; try restarting transaction rollback; commit; begin; select * from t1 where z > 1 and z < 3 lock in share mode; x y z 2 two 2 begin; select * from t1 where z = 1 lock in share mode; x y z 1 one 1 select * from t1 where x = 1 for update; x y z 1 one 1 select * from t1 where x = 2 for update; ERROR HY000: Lock wait timeout exceeded; try restarting transaction rollback; commit; drop table t1; create table t3 (id2 int) engine=ndb; lock tables t3 write; unlock tables; Loading mysql-test/r/ndb_truncate.result +16 −7 Original line number Diff line number Diff line DROP TABLE IF EXISTS t2; CREATE TABLE t2 ( a bigint unsigned NOT NULL PRIMARY KEY, DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 ( a bigint unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, b int unsigned not null, c int unsigned ) engine=ndbcluster; select count(*) from t2; select count(*) from t1; count(*) 5000 truncate table t2; select count(*) from t2; select * from t1 order by a limit 2; a b c 1 509 2500 2 510 7 truncate table t1; select count(*) from t1; count(*) 0 drop table t2; insert into t1 values(NULL,1,1),(NULL,2,2); select * from t1 order by a; a b c 1 1 1 2 2 2 drop table t1; mysql-test/r/rpl_ndb_basic.result +15 −0 Original line number Diff line number Diff line Loading @@ -146,4 +146,19 @@ c1 c2 3 NULL 4 NULL 5 NULL TRUNCATE t1; SELECT count(*) FROM t1; count(*) 0 INSERT INTO t1 VALUES (101,NULL),(102,NULL),(103,NULL),(104,NULL),(105,NULL),(106,NULL),(107,NULL),(108,NULL),(109,NULL),(1010,NULL); SELECT count(*) FROM t1; count(*) 10 SELECT c1 FROM t1 ORDER BY c1 LIMIT 5; c1 101 102 103 104 105 DROP TABLE t1; mysql-test/t/ndb_lock.test +113 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,119 @@ insert into t1 values (1,1,1); drop table t1; # Lock for update create table t1 (x integer not null primary key, y varchar(32), z integer, key(z)) engine = ndb; insert into t1 values (1,'one',1), (2,'two',2),(3,"three",3); # PK access connection con1; begin; select * from t1 where x = 1 for update; connection con2; begin; select * from t1 where x = 2 for update; --error 1205 select * from t1 where x = 1 for update; rollback; connection con1; commit; # table scan connection con1; begin; select * from t1 where y = 'one' or y = 'three' order by x for update; connection con2; begin; # Have to check with pk access here since scans take locks on # all rows and then release them in chunks # Bug #20390 SELECT FOR UPDATE does not release locks of untouched rows in full table scans #select * from t1 where x = 2 for update; --error 1205 select * from t1 where x = 1 for update; rollback; connection con1; commit; # index scan connection con1; begin; select * from t1 where z > 1 and z < 3 for update; connection con2; begin; # Have to check with pk access here since scans take locks on # all rows and then release them in chunks select * from t1 where x = 1 for update; --error 1205 select * from t1 where x = 2 for update; rollback; connection con1; commit; # share locking # PK access connection con1; begin; select * from t1 where x = 1 lock in share mode; connection con2; begin; select * from t1 where x = 1 lock in share mode; select * from t1 where x = 2 for update; --error 1205 select * from t1 where x = 1 for update; rollback; connection con1; commit; # table scan connection con1; begin; select * from t1 where y = 'one' or y = 'three' order by x lock in share mode; connection con2; begin; select * from t1 where y = 'one' lock in share mode; # Have to check with pk access here since scans take locks on # all rows and then release them in chunks # Bug #20390 SELECT FOR UPDATE does not release locks of untouched rows in full table scans #select * from t1 where x = 2 for update; --error 1205 select * from t1 where x = 1 for update; rollback; connection con1; commit; # index scan connection con1; begin; select * from t1 where z > 1 and z < 3 lock in share mode; connection con2; begin; select * from t1 where z = 1 lock in share mode; # Have to check with pk access here since scans take locks on # all rows and then release them in chunks select * from t1 where x = 1 for update; --error 1205 select * from t1 where x = 2 for update; rollback; connection con1; commit; drop table t1; # End of 4.1 tests # Loading Loading
config/ac-macros/ha_ndbcluster.m4 +1 −1 Original line number Diff line number Diff line Loading @@ -197,7 +197,7 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [ MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --with-ndbcluster" # CXXFLAGS="$CXXFLAGS \$(NDB_CXXFLAGS)" CXXFLAGS="$CXXFLAGS \$(NDB_CXXFLAGS)" if test "$have_ndb_debug" = "default" then have_ndb_debug=$with_debug Loading
mysql-test/r/ndb_lock.result +80 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,86 @@ pk u o 5 5 5 insert into t1 values (1,1,1); drop table t1; create table t1 (x integer not null primary key, y varchar(32), z integer, key(z)) engine = ndb; insert into t1 values (1,'one',1), (2,'two',2),(3,"three",3); begin; select * from t1 where x = 1 for update; x y z 1 one 1 begin; select * from t1 where x = 2 for update; x y z 2 two 2 select * from t1 where x = 1 for update; ERROR HY000: Lock wait timeout exceeded; try restarting transaction rollback; commit; begin; select * from t1 where y = 'one' or y = 'three' order by x for update; x y z 1 one 1 3 three 3 begin; select * from t1 where x = 1 for update; ERROR HY000: Lock wait timeout exceeded; try restarting transaction rollback; commit; begin; select * from t1 where z > 1 and z < 3 for update; x y z 2 two 2 begin; select * from t1 where x = 1 for update; x y z 1 one 1 select * from t1 where x = 2 for update; ERROR HY000: Lock wait timeout exceeded; try restarting transaction rollback; commit; begin; select * from t1 where x = 1 lock in share mode; x y z 1 one 1 begin; select * from t1 where x = 1 lock in share mode; x y z 1 one 1 select * from t1 where x = 2 for update; x y z 2 two 2 select * from t1 where x = 1 for update; ERROR HY000: Lock wait timeout exceeded; try restarting transaction rollback; commit; begin; select * from t1 where y = 'one' or y = 'three' order by x lock in share mode; x y z 1 one 1 3 three 3 begin; select * from t1 where y = 'one' lock in share mode; x y z 1 one 1 select * from t1 where x = 1 for update; ERROR HY000: Lock wait timeout exceeded; try restarting transaction rollback; commit; begin; select * from t1 where z > 1 and z < 3 lock in share mode; x y z 2 two 2 begin; select * from t1 where z = 1 lock in share mode; x y z 1 one 1 select * from t1 where x = 1 for update; x y z 1 one 1 select * from t1 where x = 2 for update; ERROR HY000: Lock wait timeout exceeded; try restarting transaction rollback; commit; drop table t1; create table t3 (id2 int) engine=ndb; lock tables t3 write; unlock tables; Loading
mysql-test/r/ndb_truncate.result +16 −7 Original line number Diff line number Diff line DROP TABLE IF EXISTS t2; CREATE TABLE t2 ( a bigint unsigned NOT NULL PRIMARY KEY, DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 ( a bigint unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, b int unsigned not null, c int unsigned ) engine=ndbcluster; select count(*) from t2; select count(*) from t1; count(*) 5000 truncate table t2; select count(*) from t2; select * from t1 order by a limit 2; a b c 1 509 2500 2 510 7 truncate table t1; select count(*) from t1; count(*) 0 drop table t2; insert into t1 values(NULL,1,1),(NULL,2,2); select * from t1 order by a; a b c 1 1 1 2 2 2 drop table t1;
mysql-test/r/rpl_ndb_basic.result +15 −0 Original line number Diff line number Diff line Loading @@ -146,4 +146,19 @@ c1 c2 3 NULL 4 NULL 5 NULL TRUNCATE t1; SELECT count(*) FROM t1; count(*) 0 INSERT INTO t1 VALUES (101,NULL),(102,NULL),(103,NULL),(104,NULL),(105,NULL),(106,NULL),(107,NULL),(108,NULL),(109,NULL),(1010,NULL); SELECT count(*) FROM t1; count(*) 10 SELECT c1 FROM t1 ORDER BY c1 LIMIT 5; c1 101 102 103 104 105 DROP TABLE t1;
mysql-test/t/ndb_lock.test +113 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,119 @@ insert into t1 values (1,1,1); drop table t1; # Lock for update create table t1 (x integer not null primary key, y varchar(32), z integer, key(z)) engine = ndb; insert into t1 values (1,'one',1), (2,'two',2),(3,"three",3); # PK access connection con1; begin; select * from t1 where x = 1 for update; connection con2; begin; select * from t1 where x = 2 for update; --error 1205 select * from t1 where x = 1 for update; rollback; connection con1; commit; # table scan connection con1; begin; select * from t1 where y = 'one' or y = 'three' order by x for update; connection con2; begin; # Have to check with pk access here since scans take locks on # all rows and then release them in chunks # Bug #20390 SELECT FOR UPDATE does not release locks of untouched rows in full table scans #select * from t1 where x = 2 for update; --error 1205 select * from t1 where x = 1 for update; rollback; connection con1; commit; # index scan connection con1; begin; select * from t1 where z > 1 and z < 3 for update; connection con2; begin; # Have to check with pk access here since scans take locks on # all rows and then release them in chunks select * from t1 where x = 1 for update; --error 1205 select * from t1 where x = 2 for update; rollback; connection con1; commit; # share locking # PK access connection con1; begin; select * from t1 where x = 1 lock in share mode; connection con2; begin; select * from t1 where x = 1 lock in share mode; select * from t1 where x = 2 for update; --error 1205 select * from t1 where x = 1 for update; rollback; connection con1; commit; # table scan connection con1; begin; select * from t1 where y = 'one' or y = 'three' order by x lock in share mode; connection con2; begin; select * from t1 where y = 'one' lock in share mode; # Have to check with pk access here since scans take locks on # all rows and then release them in chunks # Bug #20390 SELECT FOR UPDATE does not release locks of untouched rows in full table scans #select * from t1 where x = 2 for update; --error 1205 select * from t1 where x = 1 for update; rollback; connection con1; commit; # index scan connection con1; begin; select * from t1 where z > 1 and z < 3 lock in share mode; connection con2; begin; select * from t1 where z = 1 lock in share mode; # Have to check with pk access here since scans take locks on # all rows and then release them in chunks select * from t1 where x = 1 for update; --error 1205 select * from t1 where x = 2 for update; rollback; connection con1; commit; drop table t1; # End of 4.1 tests # Loading