| 1 |
-- source connect.inc |
| 2 |
-- source include/have_debug.inc |
| 3 |
|
| 4 |
|
| 5 |
--echo # |
| 6 |
--echo # WL#12936 Implement DDL transaction context logger in ndbcluster |
| 7 |
--echo # Test failure after the create has been distributed to other servers. |
| 8 |
--echo # |
| 9 |
|
| 10 |
--echo # Setup |
| 11 |
CREATE TABLE t1 ( |
| 12 |
a int, |
| 13 |
b int |
| 14 |
) ENGINE NDB; |
| 15 |
|
| 16 |
INSERT INTO t1 VALUES (1, NULL); |
| 17 |
|
| 18 |
# Use CREATE TABLE .. AS SELECT .. FROM t1 and create a similar table t1 |
| 19 |
# with column a NOT NULL. This will fail when the Server tries to copy rows |
| 20 |
# from t1 to t2 but only after the CREATE has been distributed to other |
| 21 |
# other tables. The CREATE should fail and drop the table in NDB and across |
| 22 |
# drop the table in NDB and across all connected mysqlds during |
| 23 |
# rollback. |
| 24 |
|
| 25 |
--echo # Create should fail when copying rows |
| 26 |
--error ER_BAD_NULL_ERROR |
| 27 |
CREATE TABLE t2 ( |
| 28 |
a int, |
| 29 |
b int not null |
| 30 |
) ENGINE NDB |
| 31 |
AS SELECT * FROM t1; |
| 32 |
|
| 33 |
--echo # Verify that table does not exist |
| 34 |
--error ER_NO_SUCH_TABLE |
| 35 |
SELECT * FROM t2; |
| 36 |
|
| 37 |
--echo # Cleanup |
| 38 |
DROP TABLE t1; |
| 39 |
|
| 40 |
--echo # Verify that the table is not present in any other server |
| 41 |
--echo # and all the shares have been properly dropped. |
| 42 |
let $i = $NUM_MYSQLDS; |
| 43 |
while($i) |
| 44 |
{ |
| 45 |
--connection mysqld$i |
| 46 |
--error ER_NO_SUCH_TABLE |
| 47 |
SELECT * FROM t2; |
| 48 |
set global ndb_dbg_check_shares=1; |
| 49 |
dec $i; |
| 50 |
} |
| 51 |
--connection default |