| 1 |
-- source include/have_ndb.inc |
| 2 |
-- source suite/ndb/include/backup_restore_setup.inc |
| 3 |
|
| 4 |
|
| 5 |
# |
| 6 |
# Check failure / check behavious wrt remap feature |
| 7 |
# Parsing |
| 8 |
# Range checks |
| 9 |
# |
| 10 |
# 2^64 = 18446744073709551616 |
| 11 |
# 2^63 = 9223372036854775808 |
| 12 |
# 2^32 = 4294967296 |
| 13 |
# 2^31 = 2147483648 |
| 14 |
# |
| 15 |
|
| 16 |
create table t1 (ki int primary key, |
| 17 |
dis int, |
| 18 |
diu int unsigned, |
| 19 |
dbs bigint, |
| 20 |
dbu bigint unsigned, |
| 21 |
dmi mediumint) engine = ndb; |
| 22 |
|
| 23 |
insert into t1 values |
| 24 |
(0, |
| 25 |
2147483547, # Max - 100 |
| 26 |
4294967195, # Max - 100 |
| 27 |
9223372036854775707, # Max - 100 |
| 28 |
18446744073709551515, # Max - 100 |
| 29 |
0), |
| 30 |
(1, |
| 31 |
-2147483548, # Min + 100 |
| 32 |
100, # Min + 100 |
| 33 |
-9223372036854775708, # Min + 100 |
| 34 |
100, # Min + 100 |
| 35 |
0); |
| 36 |
|
| 37 |
|
| 38 |
select ki, dis, diu, dbs, dbu, dmi from test.t1 order by ki; |
| 39 |
|
| 40 |
--echo Run backup |
| 41 |
--source include/ndb_backup.inc |
| 42 |
|
| 43 |
truncate t1; |
| 44 |
|
| 45 |
--echo Malformed spec : db |
| 46 |
--error 2 |
| 47 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 48 |
|
| 49 |
--echo Malformed spec : db. |
| 50 |
--error 2 |
| 51 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test. $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 52 |
|
| 53 |
--echo Malformed spec : db.table |
| 54 |
--error 2 |
| 55 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 56 |
|
| 57 |
--echo Malformed spec : db.table.column |
| 58 |
--error 2 |
| 59 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.ki $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 60 |
|
| 61 |
--echo Malformed spec : db.table.column |
| 62 |
--error 1 |
| 63 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.ki: $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 64 |
|
| 65 |
--echo Malformed spec : db.table.column:function |
| 66 |
--error 1 |
| 67 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.ki:offset $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 68 |
|
| 69 |
--echo Malformed spec : db.table.column:function:badargument |
| 70 |
--error 1 |
| 71 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.ki:offset:DrRay $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 72 |
|
| 73 |
--echo Non existent db+table not allowed |
| 74 |
--error 1 |
| 75 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x lucan.t2.ki:offset:10 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 76 |
|
| 77 |
--echo Non existent table not allowed |
| 78 |
--error 1 |
| 79 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.lucan.ki:offset:10 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 80 |
|
| 81 |
--echo Non existent table not allowed |
| 82 |
--error 1 |
| 83 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.lucan:offset:10 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 84 |
|
| 85 |
--echo Bad function name |
| 86 |
--error 1 |
| 87 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.lucan:randomise:10 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 88 |
|
| 89 |
--echo Out of range offsets |
| 90 |
--error 1 |
| 91 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.lucan:randomise:10 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 92 |
|
| 93 |
--echo Unsupported type (mediumint) |
| 94 |
--error 1 |
| 95 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.dmi:offset:10 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 96 |
|
| 97 |
--echo Test limits of offset ranges (limited to +/- signed type range) |
| 98 |
|
| 99 |
--echo Too large offsets |
| 100 |
--echo Signed int |
| 101 |
--error 1 |
| 102 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.dis:offset:2147483648 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 103 |
|
| 104 |
--error 1 |
| 105 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.dis:offset:-2147483649 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 106 |
|
| 107 |
--echo Unsigned int |
| 108 |
--error 1 |
| 109 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.diu:offset:2147483648 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 110 |
|
| 111 |
--error 1 |
| 112 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.diu:offset:-2147483649 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 113 |
|
| 114 |
--echo Signed bigint |
| 115 |
--error 1 |
| 116 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.dbs:offset:9223372036854775808 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 117 |
|
| 118 |
--error 1 |
| 119 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.dbs:offset:-9223372036854775809 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 120 |
|
| 121 |
--echo Unsigned bigint |
| 122 |
--error 1 |
| 123 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.dbu:offset:9223372036854775808 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 124 |
|
| 125 |
--error 1 |
| 126 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.dbu:offset:-9223372036854775809 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 127 |
|
| 128 |
--echo Test data over/underflow errors |
| 129 |
--echo Signed int |
| 130 |
truncate t1; |
| 131 |
--error 0,1 |
| 132 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.dis:offset:101 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 133 |
--error 0,1 |
| 134 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 --restore-data -x test.t1.dis:offset:101 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 135 |
|
| 136 |
# Expect no row 0 |
| 137 |
select count(1) from t1 where ki = 0; |
| 138 |
|
| 139 |
truncate t1; |
| 140 |
--error 0,1 |
| 141 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.dis:offset:-101 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 142 |
--error 0,1 |
| 143 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 --restore-data -x test.t1.dis:offset:-101 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 144 |
|
| 145 |
# Expect no row 1 |
| 146 |
select count(1) from t1 where ki = 1; |
| 147 |
|
| 148 |
--echo Unsigned int |
| 149 |
truncate t1; |
| 150 |
--error 0,1 |
| 151 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.diu:offset:101 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 152 |
--error 0,1 |
| 153 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 --restore-data -x test.t1.diu:offset:101 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 154 |
|
| 155 |
# Expect no row 0 |
| 156 |
select count(1) from t1 where ki = 0; |
| 157 |
|
| 158 |
truncate t1; |
| 159 |
--error 0,1 |
| 160 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.diu:offset:-101 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 161 |
--error 0,1 |
| 162 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 --restore-data -x test.t1.diu:offset:-101 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 163 |
|
| 164 |
# Expect no row 1 |
| 165 |
select count(1) from t1 where ki = 1; |
| 166 |
|
| 167 |
--echo Signed bigint |
| 168 |
truncate t1; |
| 169 |
--error 0,1 |
| 170 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.dbs:offset:101 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 171 |
--error 0,1 |
| 172 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 --restore-data -x test.t1.dbs:offset:101 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 173 |
|
| 174 |
# Expect no row 0 |
| 175 |
select count(1) from t1 where ki = 0; |
| 176 |
|
| 177 |
truncate t1; |
| 178 |
--error 0,1 |
| 179 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.dbs:offset:-101 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 180 |
--error 0,1 |
| 181 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 --restore-data -x test.t1.dbs:offset:-101 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 182 |
|
| 183 |
# Expect no row 1 |
| 184 |
select count(1) from t1 where ki = 1; |
| 185 |
|
| 186 |
--echo Unsigned bigint |
| 187 |
truncate t1; |
| 188 |
--error 0,1 |
| 189 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.dbu:offset:101 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 190 |
--error 0,1 |
| 191 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 --restore-data -x test.t1.dbu:offset:101 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 192 |
|
| 193 |
# Expect no row 0 |
| 194 |
select count(1) from t1 where ki = 0; |
| 195 |
|
| 196 |
truncate t1; |
| 197 |
--error 0,1 |
| 198 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --restore-data -x test.t1.dbu:offset:-101 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 199 |
--error 0,1 |
| 200 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 --restore-data -x test.t1.dbu:offset:-101 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 201 |
|
| 202 |
# Expect no row 1 |
| 203 |
select count(1) from t1 where ki = 1; |
| 204 |
|
| 205 |
drop table t1; |
| 206 |
|
| 207 |
|
| 208 |
--source suite/ndb/include/backup_restore_cleanup.inc |
| 209 |
--remove_file $NDB_TOOLS_OUTPUT |