Debian Codegraph @

mysql-test/suite/ndb/t/ndb_load.test

raw
1 -- source include/have_ndb.inc
2
3 #
4 # Basic test for different types of loading data
5 #
6
7 # should give duplicate key
8 CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=NDB;
9 --error 1022
10 LOAD DATA INFILE '../../../std_data/words.dat' INTO TABLE t1 ;
11 DROP TABLE t1;
12
13 # now without a primary key we should be ok
14 CREATE TABLE t1 (word CHAR(20) NOT NULL) ENGINE=NDB;
15 LOAD DATA INFILE '../../../std_data/words.dat' INTO TABLE t1 ;
16 SELECT * FROM t1 ORDER BY word;
17 DROP TABLE t1;
18
19 # End of 4.1 tests
20
21 --echo Test single statement load from MyISAM table with and
22 --echo without ndb_use_transactions
23 --echo (Bug#43236)
24 --echo ndb_use_transactions = 0 should allow bulk inserts to
25 --echo succeed by automatically splitting into smaller
26 --echo transactions.
27
28 CREATE TABLE t1 (a int) engine=MyIsam;
29
30 show tables;
31
32 DELIMITER %;
33
34 CREATE PROCEDURE bulkinsert (in num int)
35 BEGIN
36 set @total= num;
37 repeat
38 insert into t1 values (@total);
39 set @total= @total -1;
40 until @total = 0 end repeat;
41 end %
42
43 DELIMITER ;%
44
45
46 --echo Insert 15000 rows which should exceed default number
47 --echo of concurrent operations (include/default_ndbd.cnf)
48 --echo when trying to move over to ndb.
49 CALL bulkinsert(15000);
50
51 show tables;
52
53 SELECT COUNT(*) FROM t1;
54
55 SET ndb_use_transactions= 1;
56
57 CREATE TABLE t2 (a int) engine=Ndb;
58
59 --echo Will fail with too many concurrent operations error
60 --error 1297, 921, 1296, 1217
61 INSERT INTO t2 SELECT * FROM t1;
62
63 SELECT COUNT(*) FROM t2;
64
65 SET ndb_use_transactions= 0;
66
67 --echo Should pass as insert is split
68 --echo into multiple transactions
69 INSERT INTO t2 SELECT * FROM t1;
70
71 SELECT COUNT(*) FROM t2;
72
73 DROP PROCEDURE bulkinsert;
74 DROP TABLE t2;
75
76 --echo Now check bulk insert using create .. as select.
77 SHOW VARIABLES LIKE 'default_storage_engine';
78 # Change default_storage_engine to NDB
79 SET default_storage_engine="ndb";
80
81 --disable_warnings
82 CREATE TABLE t2 AS SELECT * FROM t1;
83 --enable_warnings
84
85 SELECT COUNT(*) FROM t2;
86
87 DROP TABLE t2;
88
89 # Reset default_storage_engine to InnoDB
90 SET default_storage_engine="InnoDB";
91
92 --echo Now check Alter table to Ndb
93 ALTER TABLE t1 ENGINE= Ndb;
94
95 SELECT COUNT(*) FROM t1;
96
97 --echo Now check Alter table within Ndb
98 ALTER TABLE t1 ADD COLUMN extra int default 6;
99
100 SELECT COUNT(*) FROM t1;
101
102 DROP TABLE t1;