--source include/have_innodb.inc --let $MYSQLD_DATADIR= `SELECT @@datadir` --let $MYSQLD_BACKUPDIR= `SELECT @@backupdir` --disable_warnings DROP TABLE IF EXISTS t11, t12, t21, t22, t31, t32; --enable_warnings --echo # --echo # WL#4844 - Implement a locking scheme for RESTORE --echo # --echo # Show how BACKUP/RESTORE treat AUTO_INCREMENT. --echo # CREATE DATABASE wl4844_db1; USE wl4844_db1; --echo # CREATE TABLE t11 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=MyISAM; --echo # Insert values 1, 2, 3. INSERT INTO t11 VALUES (NULL), (NULL), (NULL); --echo # Delete 3, auto_increment stays at 4. DELETE FROM t11 WHERE c1=3; --echo # Set an explicit auto_increment value. ALTER TABLE t11 AUTO_INCREMENT=8; SHOW CREATE TABLE t11; --echo # CREATE TABLE t12 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=MyISAM; --echo # Insert values 1, 2, 3. INSERT INTO t12 VALUES (NULL), (NULL), (NULL); --echo # Delete 2. DELETE FROM t12 WHERE c1=2; --echo # Set an explicit auto_increment value. ALTER TABLE t12 AUTO_INCREMENT=2; SHOW CREATE TABLE t12; --echo # CREATE TABLE t13 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=MyISAM; --echo # Insert values 1, 2, 3. INSERT INTO t13 VALUES (NULL), (NULL), (NULL); --echo # Delete 3. DELETE FROM t13 WHERE c1=3; --echo # Set an explicit auto_increment value. ALTER TABLE t13 AUTO_INCREMENT=2; SHOW CREATE TABLE t13; --echo # CREATE TABLE t21 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=MEMORY; --echo # Insert values 1, 2, 3. INSERT INTO t21 VALUES (NULL), (NULL), (NULL); --echo # Delete 3, auto_increment stays at 4. DELETE FROM t21 WHERE c1=3; --echo # Set an explicit auto_increment value. ALTER TABLE t21 AUTO_INCREMENT=8; SHOW CREATE TABLE t21; --echo # CREATE TABLE t22 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=MEMORY; --echo # Insert values 1, 2, 3. INSERT INTO t22 VALUES (NULL), (NULL), (NULL); --echo # Delete 2. DELETE FROM t22 WHERE c1=2; --echo # Set an explicit auto_increment value. ALTER TABLE t22 AUTO_INCREMENT=2; SHOW CREATE TABLE t22; --echo # CREATE TABLE t23 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=MEMORY; --echo # Insert values 1, 2, 3. INSERT INTO t23 VALUES (NULL), (NULL), (NULL); --echo # Delete 3. DELETE FROM t23 WHERE c1=3; --echo # Set an explicit auto_increment value. ALTER TABLE t23 AUTO_INCREMENT=2; SHOW CREATE TABLE t23; --echo # CREATE TABLE t31 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; --echo # Insert values 1, 2, 3. INSERT INTO t31 VALUES (NULL), (NULL), (NULL); --echo # Delete 3, auto_increment stays at 4. DELETE FROM t31 WHERE c1=3; --echo # Set an explicit auto_increment value. ALTER TABLE t31 AUTO_INCREMENT=8; SHOW CREATE TABLE t31; --echo # CREATE TABLE t32 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; --echo # Insert values 1, 2, 3. INSERT INTO t32 VALUES (NULL), (NULL), (NULL); --echo # Delete 2. DELETE FROM t32 WHERE c1=2; --echo # Set an explicit auto_increment value. ALTER TABLE t32 AUTO_INCREMENT=2; SHOW CREATE TABLE t32; --echo # CREATE TABLE t33 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; --echo # Insert values 1, 2, 3. INSERT INTO t33 VALUES (NULL), (NULL), (NULL); --echo # Delete 3. DELETE FROM t33 WHERE c1=3; --echo # Set an explicit auto_increment value. ALTER TABLE t33 AUTO_INCREMENT=2; SHOW CREATE TABLE t33; --echo # --replace_column 1 ### BACKUP DATABASE wl4844_db1 TO 'wl4844_db1.bak'; --echo # DROP DATABASE wl4844_db1; --echo # --replace_column 1 ### RESTORE FROM 'wl4844_db1.bak'; USE wl4844_db1; --echo # SHOW CREATE TABLE t11; SHOW CREATE TABLE t12; SHOW CREATE TABLE t13; SHOW CREATE TABLE t21; SHOW CREATE TABLE t22; SHOW CREATE TABLE t23; SHOW CREATE TABLE t31; SHOW CREATE TABLE t32; SHOW CREATE TABLE t33; --echo # INSERT INTO t11 VALUES (NULL); INSERT INTO t12 VALUES (NULL); INSERT INTO t13 VALUES (NULL); INSERT INTO t21 VALUES (NULL); INSERT INTO t22 VALUES (NULL); INSERT INTO t23 VALUES (NULL); INSERT INTO t31 VALUES (NULL); INSERT INTO t32 VALUES (NULL); INSERT INTO t33 VALUES (NULL); --echo # SELECT * FROM t11; SELECT * FROM t12; SELECT * FROM t13; SELECT * FROM t21; SELECT * FROM t22; SELECT * FROM t23; SELECT * FROM t31; SELECT * FROM t32; SELECT * FROM t33; --echo # DROP DATABASE wl4844_db1; USE test; --remove_file $MYSQLD_BACKUPDIR/wl4844_db1.bak