#At file:///home/frazer/bzr/mysql-5.1-telco-6.4/
2879 Frazer Clement 2009-04-06 [merge]
Merge 6.3->7.0. Add fix for bug#43236
modified:
mysql-test/suite/ndb/r/ndb_load.result
mysql-test/suite/ndb/t/ndb_load.test
sql/ha_ndbcluster.cc
=== modified file 'mysql-test/suite/ndb/r/ndb_load.result'
--- a/mysql-test/suite/ndb/r/ndb_load.result 2007-12-12 17:19:24 +0000
+++ b/mysql-test/suite/ndb/r/ndb_load.result 2009-04-06 10:37:55 +0000
@@ -78,3 +78,70 @@ Abernathy
aberrant
aberration
DROP TABLE t1;
+Test single statement load from MyISAM table with and
+without ndb_use_transactions
+(Bug#43236)
+ndb_use_transactions = 0 should allow bulk inserts to
+succeed by automatically splitting into smaller
+transactions.
+CREATE TABLE t1 (a int) engine=MyIsam;
+show tables;
+Tables_in_test
+t1
+CREATE PROCEDURE bulkinsert (in num int)
+BEGIN
+set @total= num;
+repeat
+insert into t1 values (@total);
+set @total= @total -1;
+until @total = 0 end repeat;
+end %
+Insert 15000 rows which should exceed default number
+of concurrent operations (include/default_ndbd.cnf)
+when trying to move over to ndb.
+CALL bulkinsert(15000);
+show tables;
+Tables_in_test
+t1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+15000
+SET ndb_use_transactions= 1;
+CREATE TABLE t2 (a int) engine=Ndb;
+Will fail with too many concurrent operations error
+INSERT INTO t2 SELECT * FROM t1;
+ERROR HY000: Got temporary error 233 'Out of operation records in transaction coordinator (increase MaxNoOfConcurrentOperations)' from NDBCLUSTER
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+0
+SET ndb_use_transactions= 0;
+Should pass as insert is split
+into multiple transactions
+INSERT INTO t2 SELECT * FROM t1;
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+15000
+DROP PROCEDURE bulkinsert;
+DROP TABLE t2;
+Now check bulk insert using create .. as select.
+SHOW VARIABLES LIKE '%storage_engine%';
+Variable_name Value
+storage_engine MyISAM
+SET storage_engine="ndb";
+CREATE TABLE t2 AS SELECT * FROM t1;
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+15000
+DROP TABLE t2;
+SET storage_engine="MyIsam";
+Now check Alter table to Ndb
+ALTER TABLE t1 ENGINE= Ndb;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+15000
+Now check Alter table within Ndb
+ALTER TABLE t1 ADD COLUMN extra int default 6;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+15000
+DROP TABLE t1;
=== modified file 'mysql-test/suite/ndb/t/ndb_load.test'
--- a/mysql-test/suite/ndb/t/ndb_load.test 2009-02-03 13:35:56 +0000
+++ b/mysql-test/suite/ndb/t/ndb_load.test 2009-04-06 10:37:55 +0000
@@ -21,3 +21,82 @@ SELECT * FROM t1 ORDER BY word;
DROP TABLE t1;
# End of 4.1 tests
+
+--echo Test single statement load from MyISAM table with and
+--echo without ndb_use_transactions
+--echo (Bug#43236)
+--echo ndb_use_transactions = 0 should allow bulk inserts to
+--echo succeed by automatically splitting into smaller
+--echo transactions.
+
+CREATE TABLE t1 (a int) engine=MyIsam;
+
+show tables;
+
+DELIMITER %;
+
+CREATE PROCEDURE bulkinsert (in num int)
+BEGIN
+ set @total= num;
+ repeat
+ insert into t1 values (@total);
+ set @total= @total -1;
+ until @total = 0 end repeat;
+end %
+
+DELIMITER ;%
+
+
+--echo Insert 15000 rows which should exceed default number
+--echo of concurrent operations (include/default_ndbd.cnf)
+--echo when trying to move over to ndb.
+CALL bulkinsert(15000);
+
+show tables;
+
+SELECT COUNT(*) FROM t1;
+
+SET ndb_use_transactions= 1;
+
+CREATE TABLE t2 (a int) engine=Ndb;
+
+--echo Will fail with too many concurrent operations error
+--error 1297
+INSERT INTO t2 SELECT * FROM t1;
+
+SELECT COUNT(*) FROM t2;
+
+SET ndb_use_transactions= 0;
+
+--echo Should pass as insert is split
+--echo into multiple transactions
+INSERT INTO t2 SELECT * FROM t1;
+
+SELECT COUNT(*) FROM t2;
+
+DROP PROCEDURE bulkinsert;
+DROP TABLE t2;
+
+--echo Now check bulk insert using create .. as select.
+SHOW VARIABLES LIKE '%storage_engine%';
+SET storage_engine="ndb";
+
+CREATE TABLE t2 AS SELECT * FROM t1;
+
+SELECT COUNT(*) FROM t2;
+
+DROP TABLE t2;
+
+SET storage_engine="MyIsam";
+
+--echo Now check Alter table to Ndb
+ALTER TABLE t1 ENGINE= Ndb;
+
+SELECT COUNT(*) FROM t1;
+
+--echo Now check Alter table within Ndb
+ALTER TABLE t1 ADD COLUMN extra int default 6;
+
+SELECT COUNT(*) FROM t1;
+
+DROP TABLE t1;
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2009-03-14 20:42:04 +0000
+++ b/sql/ha_ndbcluster.cc 2009-04-06 10:46:56 +0000
@@ -5879,6 +5879,8 @@ ha_ndbcluster::start_transaction_row(con
DBUG_ASSERT(m_thd_ndb);
DBUG_ASSERT(m_thd_ndb->trans == NULL);
+ transaction_checks(table->in_use, m_thd_ndb);
+
Ndb *ndb= m_thd_ndb->ndb;
Uint64 tmp[(MAX_KEY_SIZE_IN_WORDS*MAX_XFRM_MULTIPLY) >> 1];
@@ -5908,6 +5910,8 @@ ha_ndbcluster::start_transaction_key(uin
DBUG_ASSERT(m_thd_ndb);
DBUG_ASSERT(m_thd_ndb->trans == NULL);
+ transaction_checks(table->in_use, m_thd_ndb);
+
Ndb *ndb= m_thd_ndb->ndb;
const NdbRecord *key_rec= m_index[inx_no].ndb_unique_record_key;
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-7.0 branch (frazer:2879) Bug#43236 | Frazer Clement | 6 Apr |