| 1 |
# Inc file to check if parent's metadata is flushed out when child's |
| 2 |
# table definition is updated. |
| 3 |
# It does the following : |
| 4 |
# 1. Cache parent table definition in server1 |
| 5 |
# 2. Run the given DDL in server2 |
| 6 |
# 3. Run 'alter .. change column a ..' on parent at server1 |
| 7 |
# to check if the cached table has been flushed out |
| 8 |
# |
| 9 |
# Input : |
| 10 |
# $ddl_query : The DDL query to run in server2. |
| 11 |
# $expect_alter_failure : Updating parent's column 'a' in server1 after |
| 12 |
# running $ddl_query in server2 is expected to |
| 13 |
# fail if this value is set to 1 and expected to |
| 14 |
# pass if the value is set to 0. |
| 15 |
|
| 16 |
--echo #cache parent table in server1 |
| 17 |
--connection server1 |
| 18 |
select * from parent order by a; |
| 19 |
|
| 20 |
--echo #now run the DDL query in server2 |
| 21 |
--connection server2 |
| 22 |
--eval $ddl_query |
| 23 |
|
| 24 |
--echo #check if the parent metadata has been reset in server1 |
| 25 |
--connection server1 |
| 26 |
if (!$expect_alter_failure) |
| 27 |
{ |
| 28 |
--echo #altering column should pass |
| 29 |
} |
| 30 |
if ($expect_alter_failure) |
| 31 |
{ |
| 32 |
--echo #altering column should fail with error |
| 33 |
--error ER_FK_INCOMPATIBLE_COLUMNS |
| 34 |
} |
| 35 |
alter table parent |
| 36 |
change column a a varchar(64) not null; |
| 37 |
|
| 38 |
if (!$expect_alter_failure) |
| 39 |
{ |
| 40 |
--echo #check parent's new definition |
| 41 |
show create table parent; |
| 42 |
|
| 43 |
--echo #restore parent to old definition |
| 44 |
alter table parent change column a a int; |
| 45 |
} |
| 46 |
|
| 47 |
#reset input |
| 48 |
let $ddl_query=; |