Server IP : 104.21.38.3 / Your IP : 162.158.88.30 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/innodb/t/ |
Upload File : |
# Testcase for import/export partition table with replication for InnoDB # Only hash partition table is used for sanity check --source include/have_innodb.inc --source include/have_partition.inc --source include/master-slave.inc --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings # Set file per table on slave --echo # On slave connection slave; let $slave_per_table = `select @@innodb_file_per_table`; set global innodb_file_per_table = 1; --echo # On master # Set file per table on master connection master; LET $MYSQLD_DATA_DIR = `select @@datadir`; let $master_per_table = `select @@innodb_file_per_table`; set global innodb_file_per_table = 1; LET $MYSQLD_MASTER_DATA_DIR = `select @@datadir`; --echo # Create partitioned table on master CREATE TABLE t1 ( i INT ) ENGINE = InnoDB PARTITION BY HASH(i) PARTITIONS 3; CREATE TABLE t2 ( i INT ) ENGINE = InnoDB PARTITION BY KEY(i) PARTITIONS 3; INSERT INTO t1 VALUES (1),(111),(321); INSERT INTO t2 VALUES (0),(1),(2); FLUSH TABLES t1,t2 FOR EXPORT; --source include/sync_slave_sql_with_master.inc --echo # set MYSQLD_DATADIR with master datadir to copy idb and cfg files LET MYSQLD_DATADIR = $MYSQLD_MASTER_DATA_DIR; perl; do 'include/innodb-util.inc'; ib_backup_tablespaces("test", "t1#P#p0", "t1#P#p1", "t1#P#p2"); ib_backup_tablespaces("test", "t2#P#p0", "t2#P#p1"); EOF --echo # On slave connection slave; --echo # check table created on slave SELECT * FROM t1; SELECT * FROM t2; --echo # On master --echo # DISCARD TABLESPACE on master.It will be also discarded from slave. connection master; UNLOCK TABLES; ALTER TABLE t1 DISCARD TABLESPACE; #--source include/sync_slave_sql_with_master.inc ALTER TABLE t2 DISCARD PARTITION p0,p1 TABLESPACE; --source include/sync_slave_sql_with_master.inc --echo # Copy back ibd and cfg files on master LET MYSQLD_DATADIR = $MYSQLD_MASTER_DATA_DIR; perl; do 'include/innodb-util.inc'; ib_discard_tablespaces("test", "t1#P#p0", "t1#P#p1", "t1#P#p2"); ib_restore_tablespaces("test", "t1#P#p0", "t1#P#p1", "t1#P#p2"); ib_discard_tablespaces("test", "t2#P#p0", "t2#P#p1"); ib_restore_tablespaces("test", "t2#P#p0", "t2#P#p1"); EOF --echo # Copy back ibd and cfg files on slave connection slave; LET $MYSQLD_SLAVE_DATA_DIR = `select @@datadir`; LET MYSQLD_DATADIR = $MYSQLD_SLAVE_DATA_DIR; perl; do 'include/innodb-util.inc'; ib_discard_tablespaces("test", "t1#P#p0", "t1#P#p1", "t1#P#p2"); ib_restore_tablespaces("test", "t1#P#p0", "t1#P#p1", "t1#P#p2"); ib_discard_tablespaces("test", "t2#P#p0", "t2#P#p1"); ib_restore_tablespaces("test", "t2#P#p0", "t2#P#p1"); EOF --echo # IMPORT TABLESPACE on master.It will be also imported on slave. connection master; ALTER TABLE t1 IMPORT TABLESPACE; SELECT * FROM t1; ALTER TABLE t2 IMPORT PARTITION p0,p1 TABLESPACE; SELECT * FROM t2; --source include/sync_slave_sql_with_master.inc --echo # On slave --echo # Verify table data on slave connection slave; SELECT * FROM t1; SELECT * FROM t2; # Cleanup connection slave; eval set global innodb_file_per_table = $slave_per_table; connection master; eval set global innodb_file_per_table = $master_per_table; DROP TABLE t1; DROP TABLE t2; --source include/rpl_end.inc call mtr.add_suppression("Got error -1 when reading table '.*'"); call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'.*"); call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded"); --remove_files_wildcard $MYSQLTEST_VARDIR/tmp t1*.ibd --remove_files_wildcard $MYSQLTEST_VARDIR/tmp t1*.cfg