| 1 |
###################################################################### |
| 2 |
# Test restoring backups of different endianness |
| 3 |
###################################################################### |
| 4 |
|
| 5 |
-- source include/have_multi_ndb.inc |
| 6 |
-- source suite/ndb/include/backup_restore_setup.inc |
| 7 |
|
| 8 |
# |
| 9 |
# Bug #27543 restore of backup from different endian does not work for blob column |
| 10 |
# Bug #30024 restore of backup from different endian does not work for datetime column |
| 11 |
# Bug #28674 backup will run forever if disk full and later write succes will kill ndb node |
| 12 |
# |
| 13 |
# The table structure and data list below |
| 14 |
# |
| 15 |
# CREATE TABLE t_num ( |
| 16 |
# t_pk INT PRIMARY KEY, |
| 17 |
# t_bit BIT(64), |
| 18 |
# t_tinyint TINYINT, |
| 19 |
# t_bool BOOL, |
| 20 |
# t_smallint SMALLINT, |
| 21 |
# t_mediumint MEDIUMINT, |
| 22 |
# t_int INT, |
| 23 |
# t_bigint BIGINT, |
| 24 |
# t_float FLOAT, |
| 25 |
# t_double DOUBLE, |
| 26 |
# t_decimal DECIMAL (37, 16) |
| 27 |
# ) ENGINE=NDBCLUSTER; |
| 28 |
# |
| 29 |
# INSERT INTO t_num VALUE ( |
| 30 |
# 1, |
| 31 |
# b'1010101010101010101010101010101010101010101010101010101010101010', |
| 32 |
# 125, |
| 33 |
# 1, |
| 34 |
# 32765, |
| 35 |
# 8388606, |
| 36 |
# 2147483647, |
| 37 |
# 9223372036854775807, |
| 38 |
# 1e+20, |
| 39 |
# 1e+150, |
| 40 |
# '331.0000000000' |
| 41 |
# ); |
| 42 |
# |
| 43 |
# CREATE TABLE t_datetime ( |
| 44 |
# t_pk INT PRIMARY KEY, |
| 45 |
# t_date DATE, |
| 46 |
# t_datetime DATETIME, |
| 47 |
# t_timestamp TIMESTAMP, |
| 48 |
# t_time TIME, |
| 49 |
# t_year YEAR |
| 50 |
# ) ENGINE=NDBCLUSTER; |
| 51 |
# |
| 52 |
# INSERT INTO t_datetime VALUE ( |
| 53 |
# 1, |
| 54 |
# '1998-01-01', |
| 55 |
# '2006-08-10 10:11:12', |
| 56 |
# 20021029165106, |
| 57 |
# '19:38:34', |
| 58 |
# 2155 |
| 59 |
# ); |
| 60 |
# |
| 61 |
# CREATE TABLE t_string_1 ( |
| 62 |
# t_pk INT PRIMARY KEY, |
| 63 |
# t_char CHAR(255), |
| 64 |
# t_varchar VARCHAR(655), |
| 65 |
# t_binary BINARY(255), |
| 66 |
# t_varbinary VARBINARY(6553) |
| 67 |
# ) ENGINE=NDBCLUSTER; |
| 68 |
# |
| 69 |
# CREATE TABLE t_string_2 ( |
| 70 |
# t_pk INT PRIMARY KEY, |
| 71 |
# t_tinyblob TINYBLOB, |
| 72 |
# t_tinytext TINYTEXT, |
| 73 |
# t_blob BLOB, |
| 74 |
# t_text TEXT, |
| 75 |
# t_mediumblob MEDIUMBLOB, |
| 76 |
# t_mediumtext MEDIUMTEXT, |
| 77 |
# t_longblob LONGBLOB, |
| 78 |
# t_longtext LONGTEXT, |
| 79 |
# t_enum ENUM('001001','001004','001010','001018','001019','001020','001021','001027','001028','001029','001030','001031','001100','002003','002004','002005','002007')DEFAULT '001001' NOT NULL, |
| 80 |
# t_set SET('a','B') |
| 81 |
# ) ENGINE=NDBCLUSTER; |
| 82 |
# |
| 83 |
# INSERT INTO t_string_1 VALUE ( |
| 84 |
# 1, |
| 85 |
# 'abcdefghijklmn', |
| 86 |
# 'abcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmn', |
| 87 |
# 0x612020, |
| 88 |
# 0x4100 |
| 89 |
# ); |
| 90 |
# |
| 91 |
# INSERT INTO t_string_2 VALUE ( |
| 92 |
# 1, |
| 93 |
# 'abcdefghijklmnabcdefghijklmn', |
| 94 |
# 'abcdefghijklmnabcdefghijklmn', |
| 95 |
# 'a123456789b123456789c123456789d123456789e123456789f123456789g123456789', |
| 96 |
# 'a123456789b123456789c123456789d123456789e123456789f123456789g123456789', |
| 97 |
# 'a123456789b123456789c123456789d123456789e123456789f123456789g123456789', |
| 98 |
# 'a123456789b123456789c123456789d123456789e123456789f123456789g123456789', |
| 99 |
# 'a123456789b123456789c123456789d123456789e123456789f123456789g123456789', |
| 100 |
# 'a123456789b123456789c123456789d123456789e123456789f123456789g123456789', |
| 101 |
# '001001', |
| 102 |
# 'a' |
| 103 |
# ); |
| 104 |
# |
| 105 |
# CREATE TABLE t_gis ( |
| 106 |
# t_pk INT PRIMARY KEY, |
| 107 |
# t_point POINT, |
| 108 |
# t_linestring LINESTRING, |
| 109 |
# t_polygon POLYGON, |
| 110 |
# t_multipoint MULTIPOINT, |
| 111 |
# t_multilinestring MULTILINESTRING, |
| 112 |
# t_multipolygon MULTIPOLYGON, |
| 113 |
# t_geometrycollection GEOMETRYCOLLECTION, |
| 114 |
# t_geometry GEOMETRY |
| 115 |
# ) ENGINE=NDBCLUSTER; |
| 116 |
# |
| 117 |
# INSERT INTO t_gis VALUE ( |
| 118 |
# 1, |
| 119 |
# ST_PointFromText('POINT(10 10)'), |
| 120 |
# ST_LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)'), |
| 121 |
# ST_PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'), |
| 122 |
# ST_MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)'), |
| 123 |
# ST_MLineFromText('MULTILINESTRING((10 48,10 21,10 0))'), |
| 124 |
# ST_MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))'), |
| 125 |
# ST_GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))'), |
| 126 |
# ST_MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))') |
| 127 |
# ); |
| 128 |
# |
| 129 |
# INSERT INTO t_gis VALUE ( |
| 130 |
# 2, |
| 131 |
# ST_PointFromWKB(ST_AsWKB(ST_PointFromText('POINT(10 20)'))), |
| 132 |
# ST_LineStringFromWKB(LineString(Point(10, 10), Point(40, 10))), |
| 133 |
# ST_PolyFromWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))), |
| 134 |
# ST_MPointFromWKB(MultiPoint(Point(3, 6), Point(4, 10))), |
| 135 |
# ST_MLineFromWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))), |
| 136 |
# ST_MPolyFromWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))), |
| 137 |
# ST_GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))), |
| 138 |
# ST_GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))) |
| 139 |
# ); |
| 140 |
|
| 141 |
# Turn off metadata check so it doesn't intefere with table discovery |
| 142 |
--connection server2 |
| 143 |
SET @old_ndb_metadata_check_mysqld2 = @@global.ndb_metadata_check; |
| 144 |
SET GLOBAL ndb_metadata_check = false; |
| 145 |
--connection server1 |
| 146 |
SET @old_ndb_metadata_check_mysqld1 = @@global.ndb_metadata_check; |
| 147 |
SET GLOBAL ndb_metadata_check = false; |
| 148 |
|
| 149 |
# Suppress expected warnings in the log due to table with old temporal types |
| 150 |
--disable_query_log |
| 151 |
call mtr.add_suppression("Table upgrade required"); |
| 152 |
call mtr.add_suppression("Failed to create entry in DD for table"); |
| 153 |
call mtr.add_suppression("Failed to install table"); |
| 154 |
--enable_query_log |
| 155 |
|
| 156 |
# |
| 157 |
# Restore backup files (from little endian) |
| 158 |
# |
| 159 |
|
| 160 |
--exec $NDB_RESTORE $NDB_RESTORE_NO_ENCR -b 1 -n 1 -m -r $NDB_SAVED_BACKUPS/51_data_le >> $NDB_TOOLS_OUTPUT |
| 161 |
--exec $NDB_RESTORE $NDB_RESTORE_NO_ENCR -b 1 -n 2 -r $NDB_SAVED_BACKUPS/51_data_le >> $NDB_TOOLS_OUTPUT |
| 162 |
|
| 163 |
SHOW CREATE TABLE t_num; |
| 164 |
# The `t_datetime` table is not expected to be usable. It contains old |
| 165 |
# temporal types which have been removed in 8.0. The upgrade of the |
| 166 |
# table metadata is not supported |
| 167 |
--error ER_NO_SUCH_TABLE |
| 168 |
SHOW CREATE TABLE t_datetime; |
| 169 |
SHOW WARNINGS; |
| 170 |
SHOW CREATE TABLE t_string_1; |
| 171 |
SHOW CREATE TABLE t_string_2; |
| 172 |
SHOW CREATE TABLE t_gis; |
| 173 |
--error ER_NO_SUCH_TABLE |
| 174 |
SELECT * FROM t_datetime; |
| 175 |
SHOW WARNINGS; |
| 176 |
SELECT t_pk,hex(t_bit),t_tinyint,t_bool,t_smallint,t_mediumint,t_int,t_bigint,t_float,t_double,t_decimal FROM t_num; |
| 177 |
SELECT t_pk,t_char,t_varchar,hex(t_binary),hex(t_varbinary) FROM t_string_1; |
| 178 |
SELECT * FROM t_string_2; |
| 179 |
SELECT ST_AsText(t_point), ST_AsText(t_linestring),ST_AsText(t_polygon) FROM t_gis ORDER by t_pk; |
| 180 |
SELECT ST_AsText(t_multipoint), ST_AsText(t_multilinestring),ST_AsText(t_multipolygon) FROM t_gis ORDER by t_pk; |
| 181 |
SELECT ST_AsText(t_geometrycollection), ST_AsText(t_geometry) FROM t_gis ORDER by t_pk; |
| 182 |
|
| 183 |
# Clean up tables |
| 184 |
DROP TABLE t_num,t_string_1,t_string_2,t_gis; |
| 185 |
--exec $NDB_DROP_TABLE -d test t_datetime >> $NDB_TOOLS_OUTPUT |
| 186 |
|
| 187 |
# |
| 188 |
# Restore backup files (from big endian) |
| 189 |
# |
| 190 |
|
| 191 |
--exec $NDB_RESTORE $NDB_RESTORE_NO_ENCR -b 1 -n 1 -m -r $NDB_SAVED_BACKUPS/51_data_be >> $NDB_TOOLS_OUTPUT |
| 192 |
--exec $NDB_RESTORE $NDB_RESTORE_NO_ENCR -b 1 -n 2 -r $NDB_SAVED_BACKUPS/51_data_be >> $NDB_TOOLS_OUTPUT |
| 193 |
|
| 194 |
SHOW CREATE TABLE t_num; |
| 195 |
--error ER_NO_SUCH_TABLE |
| 196 |
SHOW CREATE TABLE t_datetime; |
| 197 |
SHOW WARNINGS; |
| 198 |
SHOW CREATE TABLE t_string_1; |
| 199 |
SHOW CREATE TABLE t_string_2; |
| 200 |
SHOW CREATE TABLE t_gis; |
| 201 |
--error ER_NO_SUCH_TABLE |
| 202 |
SELECT * FROM t_datetime; |
| 203 |
SHOW WARNINGS; |
| 204 |
SELECT t_pk,hex(t_bit),t_tinyint,t_bool,t_smallint,t_mediumint,t_int,t_bigint,t_float,t_double,t_decimal FROM t_num; |
| 205 |
SELECT t_pk,t_char,t_varchar,hex(t_binary),hex(t_varbinary) FROM t_string_1; |
| 206 |
SELECT * FROM t_string_2; |
| 207 |
SELECT ST_AsText(t_point), ST_AsText(t_linestring),ST_AsText(t_polygon) FROM t_gis ORDER by t_pk; |
| 208 |
SELECT ST_AsText(t_multipoint), ST_AsText(t_multilinestring),ST_AsText(t_multipolygon) FROM t_gis ORDER by t_pk; |
| 209 |
SELECT ST_AsText(t_geometrycollection), ST_AsText(t_geometry) FROM t_gis ORDER by t_pk; |
| 210 |
|
| 211 |
DROP TABLE t_num,t_string_1,t_string_2,t_gis; |
| 212 |
--exec $NDB_DROP_TABLE -d test t_datetime >> $NDB_TOOLS_OUTPUT |
| 213 |
|
| 214 |
# Reset metadata check value |
| 215 |
--connection server2 |
| 216 |
SET GLOBAL ndb_metadata_check = @old_ndb_metadata_check_mysqld2; |
| 217 |
--connection server1 |
| 218 |
SET GLOBAL ndb_metadata_check = @old_ndb_metadata_check_mysqld1; |
| 219 |
|
| 220 |
--remove_file $NDB_TOOLS_OUTPUT |