Server IP : 172.67.216.182 / Your IP : 162.158.170.16 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/mysql/src/mysql-test/suite/ndb/t/ |
Upload File : |
# 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 preserving padding in char/bin conversions ###################################################################### -- 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 char+binary types --echo ************************************************************ CREATE TABLE t3( c1 char(32), b1 binary(32) ) ENGINE=NDB; INSERT INTO t3 VALUES('aaaaaaaa', 'bbbbbbbb'); SELECT length(c1), length(b1) FROM t3; --echo ************************************************************ --echo * Backing up table with char+binary 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 char+binary types (sanity check): --echo * char(32) --> char(32) --echo * binary(32) --> binary(32) --echo ************************************************************ # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3; # restore table DELETE FROM t3; # 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 > /dev/null --exec $restore_cmd -n 2 --print > /dev/null SELECT length(c1), length(b1) FROM t3; # verify data SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam; DROP TABLE t3_myisam; --echo ************************************************************ --echo * Restoring table with promoted char+binary types preserving padding: --echo * char(32) --> varchar(32) --echo * binary(32) --> varbinary(32) --echo ************************************************************ # demote char+binary type attibutes --disable_warnings ALTER TABLE t3 MODIFY c1 varchar(32), MODIFY b1 varbinary(32); --enable_warnings SELECT length(c1), length(b1) FROM t3; # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3; # restore table DELETE FROM t3; --exec $restore_cmd -n 1 --print -A -P > /dev/null --exec $restore_cmd -n 2 --print -A -P > /dev/null SELECT length(c1), length(b1) FROM t3; # verify data SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam; DROP TABLE t3_myisam; --echo ************************************************************ --echo * Restoring table with promoted char+binary types preserving padding: --echo * char(32) --> varchar(64) --echo * binary(32) --> varbinary(64) --echo ************************************************************ # demote char+binary type attibutes --disable_warnings ALTER TABLE t3 MODIFY c1 varchar(64), MODIFY b1 varbinary(64); --enable_warnings SELECT length(c1), length(b1) FROM t3; # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3; # restore table DELETE FROM t3; --exec $restore_cmd -n 1 --print -A -P > /dev/null --exec $restore_cmd -n 2 --print -A -P > /dev/null SELECT length(c1), length(b1) FROM t3; # verify data SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam; DROP TABLE t3_myisam; --echo ************************************************************ --echo * Restoring table with promoted char+binary types preserving padding: --echo * char(32) --> varchar(512) --echo * binary(32) --> varbinary(512) --echo ************************************************************ # demote char+binary type attibutes --disable_warnings ALTER TABLE t3 MODIFY c1 varchar(512), MODIFY b1 varbinary(512); --enable_warnings SELECT length(c1), length(b1) FROM t3; # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3; # restore table DELETE FROM t3; --exec $restore_cmd -n 1 --print -A -P > /dev/null --exec $restore_cmd -n 2 --print -A -P > /dev/null SELECT length(c1), length(b1) FROM t3; # verify data SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam; DROP TABLE t3_myisam; --echo ************************************************************ --echo * Restoring table with demoted char+binary types preserving padding: --echo * char(32) --> varchar(16) --echo * binary(32) --> varbinary(16) --echo ************************************************************ # demote char+binary type attibutes --disable_warnings ALTER TABLE t3 MODIFY c1 varchar(16), MODIFY b1 varbinary(16); --enable_warnings SELECT length(c1), length(b1) FROM t3; # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3; # restore table DELETE FROM t3; --exec $restore_cmd -n 1 --print -L -P > /dev/null --exec $restore_cmd -n 2 --print -L -P > /dev/null SELECT length(c1), length(b1) FROM t3; # verify data SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam; DROP TABLE t3_myisam; --echo ************************************************************ --echo * Restoring table with promoted char+binary types discarding padding: --echo * char(32) --> varchar(32) --echo * binary(32) --> varbinary(32) --echo ************************************************************ # demote char+binary type attibutes --disable_warnings DELETE FROM t3; ALTER TABLE t3 MODIFY c1 varchar(32), MODIFY b1 varbinary(32); INSERT INTO t3 VALUES('aaaaaaaa', 'bbbbbbbb'); --enable_warnings SELECT length(c1), length(b1) FROM t3; # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3; # restore table DELETE FROM t3; --exec $restore_cmd -n 1 --print -A > /dev/null --exec $restore_cmd -n 2 --print -A > /dev/null SELECT length(c1), length(b1) FROM t3; # verify data SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam; DROP TABLE t3_myisam; --echo ************************************************************ --echo * Restoring table with promoted char+binary types discarding padding: --echo * char(32) --> varchar(64) --echo * binary(32) --> varbinary(64) --echo ************************************************************ # demote char+binary type attibutes --disable_warnings ALTER TABLE t3 MODIFY c1 varchar(64), MODIFY b1 varbinary(64); --enable_warnings SELECT length(c1), length(b1) FROM t3; # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3; # restore table DELETE FROM t3; --exec $restore_cmd -n 1 --print -A > /dev/null --exec $restore_cmd -n 2 --print -A > /dev/null SELECT length(c1), length(b1) FROM t3; # verify data SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam; DROP TABLE t3_myisam; --echo ************************************************************ --echo * Restoring table with promoted char+binary types discarding padding: --echo * char(32) --> varchar(512) --echo * binary(32) --> varbinary(512) --echo ************************************************************ # demote char+binary type attibutes --disable_warnings ALTER TABLE t3 MODIFY c1 varchar(512), MODIFY b1 varbinary(512); --enable_warnings SELECT length(c1), length(b1) FROM t3; # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3; # restore table DELETE FROM t3; --exec $restore_cmd -n 1 --print -A > /dev/null --exec $restore_cmd -n 2 --print -A > /dev/null SELECT length(c1), length(b1) FROM t3; # verify data SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam; DROP TABLE t3_myisam; --echo ************************************************************ --echo * Restoring table with demoted char+binary types discarding padding: --echo * char(32) --> varchar(16) --echo * binary(32) --> varbinary(16) --echo ************************************************************ # demote char+binary type attibutes --disable_warnings ALTER TABLE t3 MODIFY c1 varchar(16), MODIFY b1 varbinary(16); --enable_warnings SELECT length(c1), length(b1) FROM t3; # create a MyISAM table from NDB table, against which to compare data CREATE TABLE t3_myisam ENGINE=MYISAM AS SELECT * FROM t3; # restore table DELETE FROM t3; --exec $restore_cmd -n 1 --print -L > /dev/null --exec $restore_cmd -n 2 --print -L > /dev/null SELECT length(c1), length(b1) FROM t3; # verify data SELECT COUNT(*) FROM t3 NATURAL JOIN t3_myisam; DROP TABLE t3_myisam; --echo ************************************************************ --echo * Deleting table with char+binary types --echo ************************************************************ DROP TABLE t3; --source suite/ndb/include/restore_sql_mode_after_turn_off_strict.inc