⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.124
Server IP:
50.28.103.30
Server:
Linux host.jcukjv-lwsites.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
Server Software:
nginx/1.28.0
PHP Version:
8.3.12
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
www
/
server
/
mysql
/
mysql-test
/
suite
/
innodb
/
t
/
View File Name :
innodb-import-partition-rpl.test
# 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