| 1 |
-- source include/have_ndb.inc |
| 2 |
-- source include/have_ndb_debug.inc |
| 3 |
-- source suite/ndb/include/backup_restore_setup.inc |
| 4 |
|
| 5 |
|
| 6 |
--echo ****************************** |
| 7 |
--echo Tests for unsupported features |
| 8 |
--echo ****************************** |
| 9 |
|
| 10 |
create table test.t1 (a varchar(20) not null, |
| 11 |
b varchar(20) not null, |
| 12 |
c varchar(20) not null, |
| 13 |
d varchar(20) not null, |
| 14 |
e varchar(20), |
| 15 |
primary key(a,b)) engine=ndb; |
| 16 |
|
| 17 |
insert into test.t1 values |
| 18 |
("1a","1b","1c","1d","1e"), |
| 19 |
("2a","2b","2c","2d","2e"), |
| 20 |
("3a","3b","3c","3d","3e"), |
| 21 |
("4a","4b","4c","4d","4e"), |
| 22 |
("5a","5b","5c","5d","5e"), |
| 23 |
("6a","6b","6c","6d","6e"); |
| 24 |
|
| 25 |
--echo Stall backup completion |
| 26 |
--exec $NDB_MGM -e "all error 10039" >> $NDB_TOOLS_OUTPUT 2>&1 |
| 27 |
--echo Run backup |
| 28 |
--source suite/ndb/t/ndb_backup_nowait_start.inc |
| 29 |
|
| 30 |
--echo Make some changes which will be logged... |
| 31 |
insert into test.t1 values |
| 32 |
("7a","7b","7c","7d","7e"), |
| 33 |
("8a","8b","8c","8d","8e"), |
| 34 |
("9a","9b","9c","9d","9e"); |
| 35 |
|
| 36 |
# update column d |
| 37 |
update test.t1 set d=concat(d, "-modified"); |
| 38 |
|
| 39 |
# update column c |
| 40 |
update test.t1 set c=concat(c, "-modified") where a in ("1a", "2a", "3a"); |
| 41 |
|
| 42 |
# update all 3 data columns |
| 43 |
# Giving |
| 44 |
# - multiple updates to the same rows |
| 45 |
# - updates with multiple columns affected |
| 46 |
# |
| 47 |
update test.t1 set c=concat(c, "2"), d=concat(d, "2"), e=concat(e,"-modified") where a in ("4a", "5a", "6a"); |
| 48 |
|
| 49 |
# Some deletes |
| 50 |
delete from test.t1 where a in ("5a","8a"); |
| 51 |
|
| 52 |
--echo Allow backup to complete... |
| 53 |
--exec $NDB_MGM -e "all error 0" >> $NDB_TOOLS_OUTPUT 2>&1 |
| 54 |
|
| 55 |
--source suite/ndb/t/ndb_backup_nowait_wait.inc |
| 56 |
|
| 57 |
select * from test.t1 order by a; |
| 58 |
|
| 59 |
drop table test.t1; |
| 60 |
|
| 61 |
--echo Show that we cannot change pk without --allow-pk-changes |
| 62 |
--echo Extend PK (a,b) -> (a,b,c) |
| 63 |
|
| 64 |
create table test.t1 (a varchar(20) not null, |
| 65 |
b varchar(20) not null, |
| 66 |
c varchar(20) not null, |
| 67 |
d varchar(20) not null, |
| 68 |
e varchar(20), |
| 69 |
primary key(a,b,c)) engine=ndb; |
| 70 |
|
| 71 |
--echo Run restore |
| 72 |
--echo Expect error |
| 73 |
--error 1 |
| 74 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r $NDB_BACKUPS-$the_backup_id > $NDB_TOOLS_OUTPUT 2>&1 |
| 75 |
|
| 76 |
--let $check_file=$NDB_TOOLS_OUTPUT |
| 77 |
--let $check_pattern=without allow-pk-changes |
| 78 |
--source suite/ndb/include/ndb_check_file_contains.inc |
| 79 |
|
| 80 |
drop table test.t1; |
| 81 |
|
| 82 |
--echo Show that we cannot change pk if the new column has updates |
| 83 |
--echo with --ignore-extended-pk-updates |
| 84 |
|
| 85 |
create table test.t1 (a varchar(20) not null, |
| 86 |
b varchar(20) not null, |
| 87 |
c varchar(20) not null, |
| 88 |
d varchar(20) not null, |
| 89 |
e varchar(20), |
| 90 |
primary key(a,b,c)) engine=ndb; |
| 91 |
|
| 92 |
--echo Run restore |
| 93 |
--echo Expect error |
| 94 |
--error 1 |
| 95 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r $NDB_BACKUPS-$the_backup_id --allow-pk-changes > $NDB_TOOLS_OUTPUT 2>&1 |
| 96 |
|
| 97 |
--let $check_file=$NDB_TOOLS_OUTPUT |
| 98 |
--let $check_pattern=ignore-extended-pk-updates switch is missing |
| 99 |
--source suite/ndb/include/ndb_check_file_contains.inc |
| 100 |
|
| 101 |
drop table test.t1; |
| 102 |
|
| 103 |
--echo Show that we cannot add a pk column from nowhere |
| 104 |
|
| 105 |
create table test.t1 (a varchar(20) not null, |
| 106 |
b varchar(20) not null, |
| 107 |
c varchar(20) not null, |
| 108 |
d varchar(20) not null, |
| 109 |
e varchar(20), |
| 110 |
x varchar(20) not null, |
| 111 |
primary key(a,b,x)) engine=ndb; |
| 112 |
|
| 113 |
--echo Run restore |
| 114 |
--echo Expect error |
| 115 |
--error 1 |
| 116 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r --exclude-missing-columns --allow-pk-changes $NDB_BACKUPS-$the_backup_id > $NDB_TOOLS_OUTPUT 2>&1 |
| 117 |
--let $check_file=$NDB_TOOLS_OUTPUT |
| 118 |
--let $check_pattern=structure incompatible |
| 119 |
--source suite/ndb/include/ndb_check_file_contains.inc |
| 120 |
|
| 121 |
drop table test.t1; |
| 122 |
|
| 123 |
--echo Show that we cannot add an autoincrement pk from nowhere |
| 124 |
|
| 125 |
create table test.t1 (a varchar(20) not null, |
| 126 |
b varchar(20) not null, |
| 127 |
c varchar(20) not null, |
| 128 |
d varchar(20) not null, |
| 129 |
e varchar(20), |
| 130 |
x int auto_increment not null, |
| 131 |
primary key(a,b,x)) engine=ndb; |
| 132 |
|
| 133 |
--echo Run restore |
| 134 |
--echo Expect error |
| 135 |
--error 1 |
| 136 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r --exclude-missing-columns --allow-pk-changes $NDB_BACKUPS-$the_backup_id 2>&1 > $NDB_TOOLS_OUTPUT 2>&1 |
| 137 |
--let $check_file=$NDB_TOOLS_OUTPUT |
| 138 |
--let $check_pattern=structure incompatible |
| 139 |
--source suite/ndb/include/ndb_check_file_contains.inc |
| 140 |
|
| 141 |
drop table test.t1; |
| 142 |
|
| 143 |
# This fails as cannot create mapping index |
| 144 |
# Really 3 types of x-form |
| 145 |
# 1. Safe (guaranteed unique) |
| 146 |
# 2. Unsafe1 (some unique element, may not be totally unique) |
| 147 |
# 3. Unsafe2 (no unique element, may not be totally unique) |
| 148 |
# 2 + 3 not much different |
| 149 |
# Could be done with staging table... |
| 150 |
# If transform is not guaranteed unique, use staging |
| 151 |
# Consider log angle |
| 152 |
|
| 153 |
--echo Complete key change with nothing of old key remaining |
| 154 |
--echo Will fail as the log apply lookup for update/delete |
| 155 |
--echo needs an index which has nothing to index |
| 156 |
--echo |
| 157 |
create table test.t1 (c varchar(20) not null, |
| 158 |
d varchar(20) not null, |
| 159 |
e varchar(20), |
| 160 |
primary key(c,d)) engine=ndb; |
| 161 |
|
| 162 |
--echo Run restore |
| 163 |
--error 1 |
| 164 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r --exclude-missing-columns --allow-pk-changes --lossy-conversions $NDB_BACKUPS-$the_backup_id 2>&1 > $NDB_TOOLS_OUTPUT 2>&1 |
| 165 |
--let $check_file=$NDB_TOOLS_OUTPUT |
| 166 |
--let $check_pattern=no columns |
| 167 |
--source suite/ndb/include/ndb_check_file_contains.inc |
| 168 |
|
| 169 |
drop table test.t1; |
| 170 |
|
| 171 |
# Add autoincrement key |
| 172 |
# Add autoincrement key from non-pks |
| 173 |
# Remove all existing keys + add one? |
| 174 |
# Multiple tables |
| 175 |
# Rewrite DB |
| 176 |
|
| 177 |
--source suite/ndb/include/backup_restore_cleanup.inc |
| 178 |
--remove_file $NDB_TOOLS_OUTPUT |