| 1 |
--source include/have_ndb.inc |
| 2 |
--source suite/ndb/include/backup_restore_setup.inc |
| 3 |
|
| 4 |
# test ndb_restore between old types and new types of precision 0 |
| 5 |
# uses table definition and data from wl_946_pre.test |
| 6 |
|
| 7 |
select @@session.time_zone; |
| 8 |
set time_zone = '+00:00'; |
| 9 |
select @@session.time_zone; |
| 10 |
|
| 11 |
--echo # create table prec 0 |
| 12 |
--let $prec= |
| 13 |
--let $frac= |
| 14 |
--source ndb_wl946_create.inc |
| 15 |
show create table t1; |
| 16 |
--source show_attributes.inc |
| 17 |
--source show_indexes.inc |
| 18 |
|
| 19 |
--echo # test defaults |
| 20 |
insert into t1 (a) values (0); |
| 21 |
select * from t1; |
| 22 |
delete from t1; |
| 23 |
|
| 24 |
--echo # restore data from wl946_pre with promote |
| 25 |
--exec $NDB_RESTORE $NDB_RESTORE_NO_ENCR -b 1 -n 1 -r --promote-attributes $NDB_SAVED_BACKUPS/wl946_pre >> $NDB_TOOLS_OUTPUT |
| 26 |
--exec $NDB_RESTORE $NDB_RESTORE_NO_ENCR -b 1 -n 2 -r --promote-attributes $NDB_SAVED_BACKUPS/wl946_pre >> $NDB_TOOLS_OUTPUT |
| 27 |
|
| 28 |
--echo # check contents |
| 29 |
select count(*), sum(crc32(concat(a,b,c,d,e,f))) from t1; |
| 30 |
|
| 31 |
--echo # run backup |
| 32 |
--source include/ndb_backup.inc |
| 33 |
|
| 34 |
--echo # drop table |
| 35 |
drop table t1; |
| 36 |
|
| 37 |
--echo # restore meta from backup |
| 38 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -m --print-meta $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 39 |
|
| 40 |
show create table t1; |
| 41 |
--source show_attributes.inc |
| 42 |
--source show_indexes.inc |
| 43 |
|
| 44 |
--echo # restore data from backup |
| 45 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 46 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 47 |
|
| 48 |
--echo # check contents |
| 49 |
select count(*), sum(crc32(concat(a,b,c,d,e,f))) from t1; |
| 50 |
|
| 51 |
--echo # drop table |
| 52 |
drop table t1; |
| 53 |
|
| 54 |
# restore table with old types |
| 55 |
--echo # restore meta wl946_pre |
| 56 |
--exec $NDB_RESTORE $NDB_RESTORE_NO_ENCR -b 1 -n 1 -m --print-meta $NDB_SAVED_BACKUPS/wl946_pre >> $NDB_TOOLS_OUTPUT |
| 57 |
|
| 58 |
# datetime,timestamp default wrong on solaris (probably bug#53818) |
| 59 |
# show create table t1; |
| 60 |
--source show_attributes.inc |
| 61 |
--source show_indexes.inc |
| 62 |
|
| 63 |
--echo # restore data from backup with demote |
| 64 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r --promote-attributes $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 65 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r --promote-attributes $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 66 |
|
| 67 |
--echo # check contents |
| 68 |
# The `t1` table is not expected to be usable. It contains old |
| 69 |
# temporal types which have been removed in 8.0. The upgrade of the |
| 70 |
# table metadata is not supported |
| 71 |
--disable_query_log |
| 72 |
call mtr.add_suppression("Table upgrade required"); |
| 73 |
--enable_query_log |
| 74 |
--error ER_NO_SUCH_TABLE |
| 75 |
select count(*), sum(crc32(concat(a,b,c,d,e,f))) from t1; |
| 76 |
SHOW WARNINGS; |
| 77 |
|
| 78 |
set time_zone = default; |
| 79 |
select @@session.time_zone; |
| 80 |
|
| 81 |
--exec $NDB_DROP_TABLE -d test t1 >> $NDB_TOOLS_OUTPUT |
| 82 |
|
| 83 |
--source suite/ndb/include/backup_restore_cleanup.inc |
| 84 |
--remove_file $NDB_TOOLS_OUTPUT |