Current Path : /usr/opt/mysql57/mysql-test/suite/ndb/t/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/opt/mysql57/mysql-test/suite/ndb/t/ndb_restore_conv_lossy_integral.test |
# The include statement below is a temp one for tests that are yet to #be ported to run with InnoDB, #but needs to be kept for tests that would need MyISAM in future. --source include/force_myisam_default.inc ###################################################################### # Test restoring backups with lossy conversions on integral types ###################################################################### -- source include/have_ndb.inc # mysqld's configuration is not relevant to this test -- source include/not_embedded.inc # Turn off STRICT sql_mode since test intentionally truncates # data when preparing the test data(those offending statements # are within enable/disable_warnings) --source suite/ndb/include/turn_off_strict_sql_mode.inc --echo ************************************************************ --echo * Creating table with integral types --echo ************************************************************ CREATE TABLE t1( t1 tinyint, t2 tinyint, ut1 tinyint unsigned, s1 smallint, s2 smallint, us1 smallint unsigned, m1 mediumint, m2 mediumint, um1 mediumint unsigned, i1 int, i2 int, ui1 int unsigned, b1 bigint, b2 bigint, ub1 bigint unsigned ) ENGINE=NDB; INSERT INTO t1 VALUES( -128, 127, 255, -32768, 32767, 65535, -8388608, 8388607, 16777215, -2147483648, 2147483647, 4294967295, -9223372036854775808, 9223372036854775807, 18446744073709551615 ); --echo ************************************************************ --echo * Backing up table with integral types --echo ************************************************************ --source include/ndb_backup.inc # command shortcuts --let $restore_cmd=$NDB_RESTORE --no-defaults -b $the_backup_id --let $restore_cmd=$restore_cmd -r --backup_path=$NDB_BACKUPS-$the_backup_id --echo ************************************************************ --echo * Restoring table with unchanged integral types: --echo * tinyint[unsigned] --> tinyint[unsigned] --echo * smallint[unsigned] --> smallint[unsigned] --echo * mediumint[unsigned] --> mediumint[unsigned] --echo * int[unsigned] --> int[unsigned] --echo * bigint[unsigned] --> bigint[unsigned] --echo ************************************************************ # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1; # restore table DELETE FROM t1; # for debugging: # --exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 1 -L -r --print $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT # --exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 2 -L -r --print $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT --exec $restore_cmd -n 1 --print -L > /dev/null --exec $restore_cmd -n 2 --print -L > /dev/null SELECT * FROM t1; # verify data SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam; DROP TABLE t1_myisam; --echo ************************************************************ --echo * Restoring table with 1st degree demoted integral types: --echo * tinyint[unsigned] --> tinyint[unsigned] --echo * smallint[unsigned] --> tinyint[unsigned] --echo * mediumint[unsigned] --> smallint[unsigned] --echo * int[unsigned] --> mediumint[unsigned] --echo * bigint[unsigned] --> int[unsigned] --echo ************************************************************ # demote integral type attibutes --disable_warnings ALTER TABLE t1 modify t1 tinyint, modify t2 tinyint, modify ut1 tinyint unsigned, modify s1 tinyint, modify s2 tinyint, modify us1 tinyint unsigned, modify m1 smallint, modify m2 smallint, modify um1 smallint unsigned, modify i1 mediumint, modify i2 mediumint, modify ui1 mediumint unsigned, modify b1 int, modify b2 int, modify ub1 int unsigned; --enable_warnings SELECT * FROM t1; # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1; # restore table DELETE FROM t1; --exec $restore_cmd -n 1 --print -L > /dev/null --exec $restore_cmd -n 2 --print -L > /dev/null SELECT * FROM t1; # verify data SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam; DROP TABLE t1_myisam; --echo ************************************************************ --echo * Restoring table with 2nd degree demoted integral types: --echo * tinyint[unsigned] --> tinyint[unsigned] --echo * smallint[unsigned] --> tinyint[unsigned] --echo * mediumint[unsigned] --> tinyint[unsigned] --echo * int[unsigned] --> smallint[unsigned] --echo * bigint[unsigned] --> mediumint[unsigned] --echo ************************************************************ # demote integral type attibutes --disable_warnings ALTER TABLE t1 modify t1 tinyint, modify t2 tinyint, modify ut1 tinyint unsigned, modify s1 tinyint, modify s2 tinyint, modify us1 tinyint unsigned, modify m1 tinyint, modify m2 tinyint, modify um1 tinyint unsigned, modify i1 smallint, modify i2 smallint, modify ui1 smallint unsigned, modify b1 mediumint, modify b2 mediumint, modify ub1 mediumint unsigned; --enable_warnings SELECT * FROM t1; # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1; # restore table DELETE FROM t1; --exec $restore_cmd -n 1 --print -L > /dev/null --exec $restore_cmd -n 2 --print -L > /dev/null SELECT * FROM t1; # verify data SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam; DROP TABLE t1_myisam; --echo ************************************************************ --echo * Restoring table with 3rd degree demoted integral types: --echo * tinyint[unsigned] --> tinyint[unsigned] --echo * smallint[unsigned] --> tinyint[unsigned] --echo * mediumint[unsigned] --> tinyint[unsigned] --echo * int[unsigned] --> tinyint[unsigned] --echo * bigint[unsigned] --> smallint[unsigned] --echo ************************************************************ # demote integral type attibutes --disable_warnings ALTER TABLE t1 modify t1 tinyint, modify t2 tinyint, modify ut1 tinyint unsigned, modify s1 tinyint, modify s2 tinyint, modify us1 tinyint unsigned, modify m1 tinyint, modify m2 tinyint, modify um1 tinyint unsigned, modify i1 tinyint, modify i2 tinyint, modify ui1 tinyint unsigned, modify b1 smallint, modify b2 smallint, modify ub1 smallint unsigned; --enable_warnings SELECT * FROM t1; # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1; # restore table DELETE FROM t1; --exec $restore_cmd -n 1 --print -L > /dev/null --exec $restore_cmd -n 2 --print -L > /dev/null SELECT * FROM t1; # verify data SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam; DROP TABLE t1_myisam; --echo ************************************************************ --echo * Restoring table with 4th degree demoted integral types: --echo * tinyint[unsigned] --> tinyint[unsigned] --echo * smallint[unsigned] --> tinyint[unsigned] --echo * mediumint[unsigned] --> tinyint[unsigned] --echo * int[unsigned] --> tinyint[unsigned] --echo * bigint[unsigned] --> tinyint[unsigned] --echo ************************************************************ # demote integral type attibutes --disable_warnings ALTER TABLE t1 modify t1 tinyint, modify t2 tinyint, modify ut1 tinyint unsigned, modify s1 tinyint, modify s2 tinyint, modify us1 tinyint unsigned, modify m1 tinyint, modify m2 tinyint, modify um1 tinyint unsigned, modify i1 tinyint, modify i2 tinyint, modify ui1 tinyint unsigned, modify b1 tinyint, modify b2 tinyint, modify ub1 tinyint unsigned; --enable_warnings SELECT * FROM t1; # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1; # restore table DELETE FROM t1; --exec $restore_cmd -n 1 --print -L > /dev/null --exec $restore_cmd -n 2 --print -L > /dev/null SELECT * FROM t1; # verify data SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam; DROP TABLE t1_myisam; --echo ************************************************************ --echo * Restoring table with changed signedness: --echo * tinyint unsigned/signed --> tinyint signed/unsigned --echo * smallint unsigned/signed --> smallint signed/unsigned --echo * mediumint unsigned/signed --> mediumint signed/unsigned --echo * int unsigned/signed --> int signed/unsigned --echo * bigint unsigned/signed --> bigint signed/unsigned --echo ************************************************************ # convert signedness of integral type attibutes --disable_warnings DELETE FROM t1; ALTER TABLE t1 modify t1 tinyint unsigned, modify t2 tinyint unsigned, modify ut1 tinyint signed, modify s1 smallint unsigned, modify s2 smallint unsigned, modify us1 smallint signed, modify m1 mediumint unsigned, modify m2 mediumint unsigned, modify um1 mediumint signed, modify i1 int unsigned, modify i2 int unsigned, modify ui1 int signed, modify b1 bigint unsigned, modify b2 bigint unsigned, modify ub1 bigint signed; INSERT INTO t1 VALUES( -128, 127, 255, -32768, 32767, 65535, -8388608, 8388607, 16777215, -2147483648, 2147483647, 4294967295, -9223372036854775808, 9223372036854775807, 18446744073709551615 ); --enable_warnings SELECT * FROM t1; # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1; # restore table DELETE FROM t1; --exec $restore_cmd -n 1 --print -L > /dev/null --exec $restore_cmd -n 2 --print -L > /dev/null SELECT * FROM t1; # verify data SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam; DROP TABLE t1_myisam; --echo ************************************************************ --echo * Restoring table with changed signedness + 1st degree promoted types: --echo * tinyint unsigned/signed --> smallint signed/unsigned --echo * smallint unsigned/signed --> mediumint signed/unsigned --echo * mediumint unsigned/signed --> int signed/unsigned --echo * int unsigned/signed --> bigint signed/unsigned --echo * bigint unsigned/signed --> bigint signed/unsigned --echo ************************************************************ # convert signedness of integral type attibutes --disable_warnings DELETE FROM t1; ALTER TABLE t1 modify t1 smallint unsigned, modify t2 smallint unsigned, modify ut1 smallint signed, modify s1 mediumint unsigned, modify s2 mediumint unsigned, modify us1 mediumint signed, modify m1 int unsigned, modify m2 int unsigned, modify um1 int signed, modify i1 bigint unsigned, modify i2 bigint unsigned, modify ui1 bigint signed, modify b1 bigint unsigned, modify b2 bigint unsigned, modify ub1 bigint signed; INSERT INTO t1 VALUES( -128, 127, 255, -32768, 32767, 65535, -8388608, 8388607, 16777215, -2147483648, 2147483647, 4294967295, -9223372036854775808, 9223372036854775807, 18446744073709551615 ); --enable_warnings SELECT * FROM t1; # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1; # restore table DELETE FROM t1; --exec $restore_cmd -n 1 --print -L > /dev/null --exec $restore_cmd -n 2 --print -L > /dev/null SELECT * FROM t1; # verify data SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam; DROP TABLE t1_myisam; --echo ************************************************************ --echo * Restoring table with changed signedness + 2nd degree promoted types: --echo * tinyint unsigned/signed --> mediumint signed/unsigned --echo * smallint unsigned/signed --> int signed/unsigned --echo * mediumint unsigned/signed --> bigint signed/unsigned --echo * int unsigned/signed --> bigint signed/unsigned --echo * bigint unsigned/signed --> bigint signed/unsigned --echo ************************************************************ # convert signedness of integral type attibutes --disable_warnings DELETE FROM t1; ALTER TABLE t1 modify t1 mediumint unsigned, modify t2 mediumint unsigned, modify ut1 mediumint signed, modify s1 int unsigned, modify s2 int unsigned, modify us1 int signed, modify m1 bigint unsigned, modify m2 bigint unsigned, modify um1 bigint signed, modify i1 bigint unsigned, modify i2 bigint unsigned, modify ui1 bigint signed, modify b1 bigint unsigned, modify b2 bigint unsigned, modify ub1 bigint signed; INSERT INTO t1 VALUES( -128, 127, 255, -32768, 32767, 65535, -8388608, 8388607, 16777215, -2147483648, 2147483647, 4294967295, -9223372036854775808, 9223372036854775807, 18446744073709551615 ); --enable_warnings SELECT * FROM t1; # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1; # restore table DELETE FROM t1; --exec $restore_cmd -n 1 --print -L > /dev/null --exec $restore_cmd -n 2 --print -L > /dev/null SELECT * FROM t1; # verify data SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam; DROP TABLE t1_myisam; --echo ************************************************************ --echo * Restoring table with changed signedness + 3rd degree promoted types: --echo * tinyint unsigned/signed --> int signed/unsigned --echo * smallint unsigned/signed --> bigint signed/unsigned --echo * mediumint unsigned/signed --> bigint signed/unsigned --echo * int unsigned/signed --> bigint signed/unsigned --echo * bigint unsigned/signed --> bigint signed/unsigned --echo ************************************************************ # convert signedness of integral type attibutes --disable_warnings DELETE FROM t1; ALTER TABLE t1 modify t1 int unsigned, modify t2 int unsigned, modify ut1 int signed, modify s1 bigint unsigned, modify s2 bigint unsigned, modify us1 bigint signed, modify m1 bigint unsigned, modify m2 bigint unsigned, modify um1 bigint signed, modify i1 bigint unsigned, modify i2 bigint unsigned, modify ui1 bigint signed, modify b1 bigint unsigned, modify b2 bigint unsigned, modify ub1 bigint signed; INSERT INTO t1 VALUES( -128, 127, 255, -32768, 32767, 65535, -8388608, 8388607, 16777215, -2147483648, 2147483647, 4294967295, -9223372036854775808, 9223372036854775807, 18446744073709551615 ); --enable_warnings SELECT * FROM t1; # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1; # restore table DELETE FROM t1; --exec $restore_cmd -n 1 --print -L > /dev/null --exec $restore_cmd -n 2 --print -L > /dev/null SELECT * FROM t1; # verify data SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam; DROP TABLE t1_myisam; --echo ************************************************************ --echo * Restoring table with changed signedness + 4th degree promoted types: --echo * tinyint unsigned/signed --> bigint signed/unsigned --echo * smallint unsigned/signed --> bigint signed/unsigned --echo * mediumint unsigned/signed --> bigint signed/unsigned --echo * int unsigned/signed --> bigint signed/unsigned --echo * bigint unsigned/signed --> bigint signed/unsigned --echo ************************************************************ # convert signedness of integral type attibutes --disable_warnings DELETE FROM t1; ALTER TABLE t1 modify t1 bigint unsigned, modify t2 bigint unsigned, modify ut1 bigint signed, modify s1 bigint unsigned, modify s2 bigint unsigned, modify us1 bigint signed, modify m1 bigint unsigned, modify m2 bigint unsigned, modify um1 bigint signed, modify i1 bigint unsigned, modify i2 bigint unsigned, modify ui1 bigint signed, modify b1 bigint unsigned, modify b2 bigint unsigned, modify ub1 bigint signed; INSERT INTO t1 VALUES( -128, 127, 255, -32768, 32767, 65535, -8388608, 8388607, 16777215, -2147483648, 2147483647, 4294967295, -9223372036854775808, 9223372036854775807, 18446744073709551615 ); --enable_warnings SELECT * FROM t1; # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1; # restore table DELETE FROM t1; --exec $restore_cmd -n 1 --print -L > /dev/null --exec $restore_cmd -n 2 --print -L > /dev/null SELECT * FROM t1; # verify data SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam; DROP TABLE t1_myisam; --echo ************************************************************ --echo * Restoring table with changed signedness + 1st degree demoted types: --echo * tinyint unsigned/signed --> tinyint signed/unsigned --echo * smallint unsigned/signed --> tinyint signed/unsigned --echo * mediumint unsigned/signed --> smallint signed/unsigned --echo * int unsigned/signed --> mediumint signed/unsigned --echo * bigint unsigned/signed --> int signed/unsigned --echo ************************************************************ # convert signedness of integral type attibutes --disable_warnings DELETE FROM t1; ALTER TABLE t1 modify t1 tinyint unsigned, modify t2 tinyint unsigned, modify ut1 tinyint signed, modify s1 tinyint unsigned, modify s2 tinyint unsigned, modify us1 tinyint signed, modify m1 smallint unsigned, modify m2 smallint unsigned, modify um1 smallint signed, modify i1 mediumint unsigned, modify i2 mediumint unsigned, modify ui1 mediumint signed, modify b1 int unsigned, modify b2 int unsigned, modify ub1 int signed; INSERT INTO t1 VALUES( -128, 127, 255, -32768, 32767, 65535, -8388608, 8388607, 16777215, -2147483648, 2147483647, 4294967295, -9223372036854775808, 9223372036854775807, 18446744073709551615 ); --enable_warnings SELECT * FROM t1; # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1; # restore table DELETE FROM t1; --exec $restore_cmd -n 1 --print -L > /dev/null --exec $restore_cmd -n 2 --print -L > /dev/null SELECT * FROM t1; # verify data SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam; DROP TABLE t1_myisam; --echo ************************************************************ --echo * Restoring table with changed signedness + 2nd degree demoted types: --echo * tinyint unsigned/signed --> tinyint signed/unsigned --echo * smallint unsigned/signed --> tinyint signed/unsigned --echo * mediumint unsigned/signed --> tinyint signed/unsigned --echo * int unsigned/signed --> smallint signed/unsigned --echo * bigint unsigned/signed --> mediumint signed/unsigned --echo ************************************************************ # convert signedness of integral type attibutes --disable_warnings DELETE FROM t1; ALTER TABLE t1 modify t1 tinyint unsigned, modify t2 tinyint unsigned, modify ut1 tinyint signed, modify s1 tinyint unsigned, modify s2 tinyint unsigned, modify us1 tinyint signed, modify m1 tinyint unsigned, modify m2 tinyint unsigned, modify um1 tinyint signed, modify i1 smallint unsigned, modify i2 smallint unsigned, modify ui1 smallint signed, modify b1 mediumint unsigned, modify b2 mediumint unsigned, modify ub1 mediumint signed; INSERT INTO t1 VALUES( -128, 127, 255, -32768, 32767, 65535, -8388608, 8388607, 16777215, -2147483648, 2147483647, 4294967295, -9223372036854775808, 9223372036854775807, 18446744073709551615 ); --enable_warnings SELECT * FROM t1; # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1; # restore table DELETE FROM t1; --exec $restore_cmd -n 1 --print -L > /dev/null --exec $restore_cmd -n 2 --print -L > /dev/null SELECT * FROM t1; # verify data SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam; DROP TABLE t1_myisam; --echo ************************************************************ --echo * Restoring table with changed signedness + 3rd degree demoted types: --echo * tinyint unsigned/signed --> tinyint signed/unsigned --echo * smallint unsigned/signed --> tinyint signed/unsigned --echo * mediumint unsigned/signed --> tinyint signed/unsigned --echo * int unsigned/signed --> tinyint signed/unsigned --echo * bigint unsigned/signed --> smallint signed/unsigned --echo ************************************************************ # convert signedness of integral type attibutes --disable_warnings DELETE FROM t1; ALTER TABLE t1 modify t1 tinyint unsigned, modify t2 tinyint unsigned, modify ut1 tinyint signed, modify s1 tinyint unsigned, modify s2 tinyint unsigned, modify us1 tinyint signed, modify m1 tinyint unsigned, modify m2 tinyint unsigned, modify um1 tinyint signed, modify i1 tinyint unsigned, modify i2 tinyint unsigned, modify ui1 tinyint signed, modify b1 smallint unsigned, modify b2 smallint unsigned, modify ub1 smallint signed; INSERT INTO t1 VALUES( -128, 127, 255, -32768, 32767, 65535, -8388608, 8388607, 16777215, -2147483648, 2147483647, 4294967295, -9223372036854775808, 9223372036854775807, 18446744073709551615 ); --enable_warnings SELECT * FROM t1; # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1; # restore table DELETE FROM t1; --exec $restore_cmd -n 1 --print -L > /dev/null --exec $restore_cmd -n 2 --print -L > /dev/null SELECT * FROM t1; # verify data SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam; DROP TABLE t1_myisam; --echo ************************************************************ --echo * Restoring table with changed signedness + 4th degree demoted types: --echo * tinyint unsigned/signed --> tinyint signed/unsigned --echo * smallint unsigned/signed --> tinyint signed/unsigned --echo * mediumint unsigned/signed --> tinyint signed/unsigned --echo * int unsigned/signed --> tinyint signed/unsigned --echo * bigint unsigned/signed --> tinyint signed/unsigned --echo ************************************************************ # convert signedness of integral type attibutes --disable_warnings DELETE FROM t1; ALTER TABLE t1 modify t1 tinyint unsigned, modify t2 tinyint unsigned, modify ut1 tinyint signed, modify s1 tinyint unsigned, modify s2 tinyint unsigned, modify us1 tinyint signed, modify m1 tinyint unsigned, modify m2 tinyint unsigned, modify um1 tinyint signed, modify i1 tinyint unsigned, modify i2 tinyint unsigned, modify ui1 tinyint signed, modify b1 tinyint unsigned, modify b2 tinyint unsigned, modify ub1 tinyint signed; INSERT INTO t1 VALUES( -128, 127, 255, -32768, 32767, 65535, -8388608, 8388607, 16777215, -2147483648, 2147483647, 4294967295, -9223372036854775808, 9223372036854775807, 18446744073709551615 ); --enable_warnings SELECT * FROM t1; # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t1_myisam ENGINE=MYISAM AS SELECT * FROM t1; # restore table DELETE FROM t1; --exec $restore_cmd -n 1 --print -L > /dev/null --exec $restore_cmd -n 2 --print -L > /dev/null SELECT * FROM t1; # verify data SELECT COUNT(*) FROM t1 NATURAL JOIN t1_myisam; DROP TABLE t1_myisam; --echo ************************************************************ --echo * Deleting table with integral types --echo ************************************************************ DROP TABLE t1; --source suite/ndb/include/restore_sql_mode_after_turn_off_strict.inc