| 1 |
--source setup.inc |
| 2 |
|
| 3 |
# Test that it's possible to turn off inplace ALTER TABLE by |
| 4 |
# setting ndb_use_copying_alter_table = 1. This means that |
| 5 |
# only queries where user explicitly requested ALGORITHM=INPLACE will |
| 6 |
# be allowed |
| 7 |
|
| 8 |
# Save t1's table id |
| 9 |
let $table_id = `SELECT id FROM test.ndbinfo_dict_obj_info |
| 10 |
WHERE fq_name = 'ndb_ddl_test/def/t1'`; |
| 11 |
|
| 12 |
# |
| 13 |
# Show that adding a column is inplace |
| 14 |
# |
| 15 |
ALTER TABLE t1 |
| 16 |
algorithm=inplace, |
| 17 |
add column c int; |
| 18 |
|
| 19 |
# Show t1's table id is the same |
| 20 |
let $new_table_id = `SELECT id FROM test.ndbinfo_dict_obj_info |
| 21 |
WHERE fq_name = 'ndb_ddl_test/def/t1'`; |
| 22 |
if ($table_id != $new_table_id) |
| 23 |
{ |
| 24 |
die The table t1 was not altered inplace, its table id changed; |
| 25 |
} |
| 26 |
|
| 27 |
# |
| 28 |
# Force copying alter table and add a column (normally inplace) |
| 29 |
# which now are forced to copying due to the variable |
| 30 |
# |
| 31 |
set @@ndb_use_copying_alter_table = 1; |
| 32 |
ALTER TABLE t1 |
| 33 |
add column d int; |
| 34 |
set @@ndb_use_copying_alter_table = default; |
| 35 |
|
| 36 |
# Check that t1's table id has changed since this was copying ALTER |
| 37 |
let $new_table_id = `SELECT id FROM test.ndbinfo_dict_obj_info |
| 38 |
WHERE fq_name = 'ndb_ddl_test/def/t1'`; |
| 39 |
if ($table_id == $new_table_id) |
| 40 |
{ |
| 41 |
die The table t1 was not altered copying, its table id did not change; |
| 42 |
} |
| 43 |
let $table_id = $new_table_id; |
| 44 |
|
| 45 |
# Force copying alter table and add a column (normally inplace) |
| 46 |
# which now becomes inplace since user specified ALGORITHM=INPLACE |
| 47 |
set @@ndb_use_copying_alter_table = 1; |
| 48 |
ALTER TABLE t1 |
| 49 |
algorithm=inplace, |
| 50 |
add column e int; |
| 51 |
set @@ndb_use_copying_alter_table = default; |
| 52 |
|
| 53 |
# Show t1's table id is the same |
| 54 |
let $new_table_id = `SELECT id FROM test.ndbinfo_dict_obj_info |
| 55 |
WHERE fq_name = 'ndb_ddl_test/def/t1'`; |
| 56 |
if ($table_id != $new_table_id) |
| 57 |
{ |
| 58 |
die The table t1 was not altered inplace, its table id changed; |
| 59 |
} |
| 60 |
|
| 61 |
--source cleanup.inc |
| 62 |
|
| 63 |
|