diff --git a/mysql-test/r/bdb_notembedded.result b/mysql-test/r/bdb_notembedded.result new file mode 100644 index 00000000000..14cb5fad915 --- /dev/null +++ b/mysql-test/r/bdb_notembedded.result @@ -0,0 +1,35 @@ +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 diff --git a/mysql-test/suite/ndb/t/ndb_restore.test b/mysql-test/suite/ndb/t/ndb_restore.test index 18efa66ebe0..940b53adbe1 100644 --- a/mysql-test/suite/ndb/t/ndb_restore.test +++ b/mysql-test/suite/ndb/t/ndb_restore.test @@ -33,15 +33,13 @@ CREATE TABLE `t2_c` ( PRIMARY KEY (`capgotod`), KEY `i quadaddsvr` (`gotod`) ) ENGINE=ndbcluster DEFAULT CHARSET=latin1; -INSERT INTO `t2_c` VALUES (500,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST'),(5,0,'',NULL,NULL,''); +INSERT INTO `t2_c` VALUES (500,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST'); -# Added ROW_FORMAT=FIXED to use below to see that setting is preserved -# by restore CREATE TABLE `t3_c` ( `CapGoaledatta` smallint(5) unsigned NOT NULL default '0', `capgotod` smallint(5) unsigned NOT NULL default '0', PRIMARY KEY (`capgotod`,`CapGoaledatta`) -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED; +) ENGINE=ndbcluster DEFAULT CHARSET=latin1; INSERT INTO `t3_c` VALUES (5,3),(2,4),(5,4),(1,3); # Bug #27775 - mediumint auto inc not restored correctly @@ -149,8 +147,8 @@ INSERT INTO `t9_c` VALUES ('3g4jh8gar2t','joe','q3.net','elredun.com','q3.net',' # auto inc table not handled correctly when restored from cluster backup # - before fix ndb_restore would not set auto inc value correct, # seen by select below -CREATE TABLE t10_c (a INT AUTO_INCREMENT KEY) ENGINE=ndbcluster DEFAULT CHARSET=latin1; -INSERT INTO t10_c VALUES (1),(2),(3); +create table t10_c (a int auto_increment key) ENGINE=ndbcluster; +insert into t10_c values (1),(2),(3); # Bug #27775 - mediumint auto inc not restored correctly # - check int insert into t10_c values (10000),(2000),(3000); @@ -166,27 +164,14 @@ create table t8 engine=myisam as select * from t8_c; create table t9 engine=myisam as select * from t9_c; create table t10 engine=myisam as select * from t10_c; -# check that force varpart is preserved by ndb_restore -# t3_c has ROW_FORMAT=FIXED i.e. ForceVarPart=0 ---exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t3_c | grep ForceVarPart ---exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t2_c | grep ForceVarPart --source include/ndb_backup.inc -drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c; +drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c, t10_c; --exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT -# check that force varpart is preserved by ndb_restore -# t3_c has ROW_FORMAT=FIXED i.e. ForceVarPart=0 ---exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t3_c | grep ForceVarPart ---exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t2_c | grep ForceVarPart -# Bug #30667 -# ndb table discovery does not work correcly with information schema -# - prior to bug fix this would yeild no output and a warning -select * from information_schema.columns where table_name = "t1_c"; +show tables; -# random output order?? -#show tables; select count(*) from t1; select count(*) from t1_c; @@ -246,157 +231,25 @@ select count(*) select * from t10_c order by a; # Bug #27775 cont'd # - auto inc info should be correct ---replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X -show table status like 't1_c'; ---replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X -show table status like 't2_c'; ---replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X -show table status like 't4_c'; ---replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X -show table status like 't7_c'; ---replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X -show table status like 't10_c'; - -# -# Try Partitioned tables as well -# -ALTER TABLE t7_c -PARTITION BY LINEAR KEY (`dardtestard`); - ---source include/ndb_backup.inc -drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c; ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT - -select count(*) from t1; -select count(*) from t1_c; -select count(*) - from (select * from t1 union - select * from t1_c) a; - -select count(*) from t2; -select count(*) from t2_c; -select count(*) - from (select * from t2 union - select * from t2_c) a; - -select count(*) from t3; -select count(*) from t3_c; -select count(*) - from (select * from t3 union - select * from t3_c) a; - -select count(*) from t4; -select count(*) from t4_c; -select count(*) - from (select * from t4 union - select * from t4_c) a; - -select count(*) from t5; -select count(*) from t5_c; -select count(*) - from (select * from t5 union - select * from t5_c) a; - -select count(*) from t6; -select count(*) from t6_c; -select count(*) - from (select * from t6 union - select * from t6_c) a; - -select count(*) from t7; -select count(*) from t7_c; -select count(*) - from (select * from t7 union - select * from t7_c) a; - -select count(*) from t8; -select count(*) from t8_c; -select count(*) - from (select * from t8 union - select * from t8_c) a; - -select count(*) from t9; -select count(*) from t9_c; -select count(*) - from (select * from t9 union - select * from t9_c) a; - -drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c; ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 1 -m -r --ndb-nodegroup_map '(0,0)' --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT - -select count(*) from t1; -select count(*) from t1_c; -select count(*) - from (select * from t1 union - select * from t1_c) a; - -select count(*) from t2; -select count(*) from t2_c; -select count(*) - from (select * from t2 union - select * from t2_c) a; - -select count(*) from t3; -select count(*) from t3_c; -select count(*) - from (select * from t3 union - select * from t3_c) a; - -select count(*) from t4; -select count(*) from t4_c; -select count(*) - from (select * from t4 union - select * from t4_c) a; - -select count(*) from t5; -select count(*) from t5_c; -select count(*) - from (select * from t5 union - select * from t5_c) a; - -select count(*) from t6; -select count(*) from t6_c; -select count(*) - from (select * from t6 union - select * from t6_c) a; - -select count(*) from t7; -select count(*) from t7_c; -select count(*) - from (select * from t7 union - select * from t7_c) a; - -select count(*) from t8; -select count(*) from t8_c; -select count(*) - from (select * from t8 union - select * from t8_c) a; - -select count(*) from t9; -select count(*) from t9_c; -select count(*) - from (select * from t9 union - select * from t9_c) a; - -# -# Drop all table except t2_c -# This to make sure that error returned from ndb_restore above is -# guaranteed to be from t2_c, this since order of tables in backup -# is none deterministic -# -drop table t1_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c; ---source include/ndb_backup.inc ---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --core=0 -b $the_backup_id -n 1 -m -r --ndb-nodegroup_map '(0,1)' $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id 2>&1 | grep Translate || true - -# -# Cleanup -# +select max(capgoaledatta) from t1_c; +select auto_increment from information_schema.tables +where table_name = 't1_c'; +select max(capgotod) from t2_c; +select auto_increment from information_schema.tables +where table_name = 't2_c'; +select max(capfa) from t4_c; +select auto_increment from information_schema.tables +where table_name = 't4_c'; +select max(dardtestard) from t7_c; +select auto_increment from information_schema.tables +where table_name = 't7_c'; +select max(a) from t10_c; +select auto_increment from information_schema.tables +where table_name = 't10_c'; --disable_warnings -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; -drop table if exists t2_c; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9, t10; +drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c, t10_c; --enable_warnings # diff --git a/mysql-test/t/bdb_notembedded.test b/mysql-test/t/bdb_notembedded.test new file mode 100644 index 00000000000..24e64ebbfb2 --- /dev/null +++ b/mysql-test/t/bdb_notembedded.test @@ -0,0 +1,38 @@ +-- 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 diff --git a/storage/ndb/include/ndbapi/Ndb.hpp b/storage/ndb/include/ndbapi/Ndb.hpp index dca19c2ead0..d71b9df9879 100644 --- a/storage/ndb/include/ndbapi/Ndb.hpp +++ b/storage/ndb/include/ndbapi/Ndb.hpp @@ -1540,12 +1540,12 @@ public: int readAutoIncrementValue(const NdbDictionary::Table * aTable, TupleIdRange & range, Uint64 & tupleId); int setAutoIncrementValue(const char* aTableName, - Uint64 tupleId, bool increase); + Uint64 tupleId, bool modify); int setAutoIncrementValue(const NdbDictionary::Table * aTable, - Uint64 tupleId, bool increase); + Uint64 tupleId, bool modify); int setAutoIncrementValue(const NdbDictionary::Table * aTable, TupleIdRange & range, Uint64 tupleId, - bool increase); + bool modify); private: int getTupleIdFromNdb(const NdbTableImpl* table, TupleIdRange & range, Uint64 & tupleId, @@ -1553,7 +1553,7 @@ private: int readTupleIdFromNdb(const NdbTableImpl* table, TupleIdRange & range, Uint64 & tupleId); int setTupleIdInNdb(const NdbTableImpl* table, - TupleIdRange & range, Uint64 tupleId, bool increase); + TupleIdRange & range, Uint64 tupleId, bool modify); int opTupleIdOnNdb(const NdbTableImpl* table, TupleIdRange & range, Uint64 & opValue, Uint32 op); public: