Commit 758305d4 authored by Marko Mäkelä's avatar Marko Mäkelä

Add a debug instrumentation test

parent 8a9aaf0c
SET @save_frequency= @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
CREATE TABLE t1 (
pk INT AUTO_INCREMENT PRIMARY KEY,
c1 INT,
c2 VARCHAR(255),
c3 VARCHAR(255),
c4 INT,
c5 INT,
c6 INT,
c7 VARCHAR(255),
c8 TIMESTAMP NULL
) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL,1,NULL,'foo',NULL,1,NULL,NULL,'2011-11-11 00:00:00');
ALTER TABLE t1 ADD COLUMN f INT;
REPLACE INTO t1 (c7) VALUES ('bar');
CREATE TABLE t2 (i INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t2 VALUES (-1),(1);
ALTER TABLE t2 ADD COLUMN j INT;
BEGIN;
DELETE FROM t2;
ROLLBACK;
TRUNCATE TABLE t2;
INSERT INTO t2 VALUES (1,2);
CREATE TABLE t3 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t3 () VALUES ();
ALTER TABLE t3 ADD COLUMN f INT;
UPDATE t3 SET pk = DEFAULT;
SELECT * FROM t3;
pk f
0 NULL
CREATE TABLE t4 (pk INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t4 VALUES (0);
ALTER TABLE t4 ADD COLUMN b INT;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
LEFT JOIN t4 ON (NUMERIC_SCALE = pk);
COUNT(*)
1733
SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL enter WAIT_FOR delete';
ALTER TABLE t4 ADD COLUMN c INT;
connect dml,localhost,root,,;
SET DEBUG_SYNC='now WAIT_FOR enter';
DELETE FROM t4;
InnoDB 0 transactions not purged
SET DEBUG_SYNC='now SIGNAL delete';
connection default;
CREATE TABLE t5 (i INT, KEY(i)) ENGINE=InnoDB;
INSERT INTO t5 VALUES (-42);
ALTER TABLE t5 ADD UNIQUE ui(i);
ALTER TABLE t5 ADD COLUMN i2 INT, DROP INDEX i;
CREATE TABLE t6 (i INT NOT NULL) ENGINE=InnoDB;
INSERT INTO t6 VALUES (0);
ALTER TABLE t6 ADD COLUMN j INT;
TRUNCATE TABLE t6;
INSERT INTO t6 VALUES (1,2);
CREATE TABLE t7 (i INT) ENGINE=InnoDB;
INSERT INTO t7 VALUES (1),(2),(3),(4),(5);
ALTER TABLE t7 ADD t TEXT DEFAULT '';
CREATE TABLE t8 (i INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
INSERT INTO t8 VALUES (NULL);
ALTER TABLE t8 ADD c CHAR(3);
SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL rebuilt WAIT_FOR dml';
ALTER TABLE t8 FORCE;
connection dml;
SET DEBUG_SYNC='now WAIT_FOR rebuilt';
BEGIN;
INSERT INTO t8 SET i=1;
UPDATE t8 SET i=ISNULL(i);
ROLLBACK;
SET DEBUG_SYNC='now SIGNAL dml';
connection default;
SET DEBUG_SYNC='RESET';
CREATE TABLE t9 (
pk INT AUTO_INCREMENT PRIMARY KEY,
c1 BIGINT UNSIGNED,
c2 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
c3 BIGINT,
c4 VARCHAR(257) CHARACTER SET utf8,
c5 TINYINT UNSIGNED,
c6 TINYINT,
c7 VARCHAR(257) CHARACTER SET latin1,
c8 VARCHAR(257) CHARACTER SET binary
) ENGINE=InnoDB;
INSERT INTO t9 () VALUES ();
ALTER TABLE t9 ADD COLUMN IF NOT EXISTS t TIMESTAMP NULL KEY;
Warnings:
Note 1061 Multiple primary key defined
SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL rebuilt WAIT_FOR dml';
OPTIMIZE TABLE t9;
connection dml;
SET DEBUG_SYNC='now WAIT_FOR rebuilt';
BEGIN;
INSERT INTO t9 () VALUES (),();
UPDATE t9 SET t=current_timestamp();
ROLLBACK;
SET DEBUG_SYNC='now SIGNAL dml';
disconnect dml;
connection default;
Table Op Msg_type Msg_text
test.t9 optimize note Table does not support optimize, doing recreate + analyze instead
test.t9 optimize status OK
SET DEBUG_SYNC='RESET';
CREATE TABLE t10 (pk INT DEFAULT 0 KEY) ENGINE=InnoDB;
INSERT INTO t10 (pk) VALUES (1);
ALTER TABLE t10 ADD c INT;
TRUNCATE TABLE t10;
INSERT INTO t10 VALUES (1,1),(2,2);
ALTER TABLE t10 FORCE;
CREATE TABLE t11 (
c01 enum('a','b'),
c02 bit,
c03 blob,
c04 enum('c','d'),
c05 blob,
c06 decimal,
c07 char(1),
c08 int,
c09 char(1),
c10 set('e','f'),
c11 char(1),
c12 float,
c13 bit,
c14 char(1),
c15 int,
c16 float,
c17 decimal,
c18 char(1) CHARACTER SET utf8 not null default '',
c19 float,
c20 set('g','h'),
c21 char(1),
c22 int,
c23 int,
c24 int,
c25 set('i','j'),
c26 decimal,
c27 float,
c28 char(1),
c29 int,
c30 enum('k','l'),
c31 decimal,
c32 char(1),
c33 decimal,
c34 bit,
c35 enum('m','n'),
c36 set('o','p'),
c37 enum('q','r'),
c38 blob,
c39 decimal,
c40 blob not null default '',
c41 char(1),
c42 int,
c43 float,
c44 float,
c45 enum('s','t'),
c46 decimal,
c47 set('u','v'),
c48 enum('w','x'),
c49 set('y','z'),
c50 float
) ENGINE=InnoDB;
INSERT INTO t11 () VALUES ();
ALTER TABLE t11 ADD COLUMN f INT;
INSERT INTO t11 () VALUES ();
UPDATE t11 SET c22 = 1;
InnoDB 0 transactions not purged
DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency;
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/have_innodb.inc
SET @save_frequency= @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
CREATE TABLE t1 (
pk INT AUTO_INCREMENT PRIMARY KEY,
c1 INT,
c2 VARCHAR(255),
c3 VARCHAR(255),
c4 INT,
c5 INT,
c6 INT,
c7 VARCHAR(255),
c8 TIMESTAMP NULL
) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL,1,NULL,'foo',NULL,1,NULL,NULL,'2011-11-11 00:00:00');
ALTER TABLE t1 ADD COLUMN f INT;
REPLACE INTO t1 (c7) VALUES ('bar');
CREATE TABLE t2 (i INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t2 VALUES (-1),(1);
ALTER TABLE t2 ADD COLUMN j INT;
BEGIN;
DELETE FROM t2;
ROLLBACK;
TRUNCATE TABLE t2;
INSERT INTO t2 VALUES (1,2);
CREATE TABLE t3 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t3 () VALUES ();
ALTER TABLE t3 ADD COLUMN f INT;
UPDATE t3 SET pk = DEFAULT;
SELECT * FROM t3;
CREATE TABLE t4 (pk INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t4 VALUES (0);
ALTER TABLE t4 ADD COLUMN b INT;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
LEFT JOIN t4 ON (NUMERIC_SCALE = pk);
SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL enter WAIT_FOR delete';
--send
ALTER TABLE t4 ADD COLUMN c INT;
connect (dml,localhost,root,,);
SET DEBUG_SYNC='now WAIT_FOR enter';
DELETE FROM t4;
--source include/wait_all_purged.inc
SET DEBUG_SYNC='now SIGNAL delete';
connection default;
reap;
CREATE TABLE t5 (i INT, KEY(i)) ENGINE=InnoDB;
INSERT INTO t5 VALUES (-42);
ALTER TABLE t5 ADD UNIQUE ui(i);
ALTER TABLE t5 ADD COLUMN i2 INT, DROP INDEX i;
CREATE TABLE t6 (i INT NOT NULL) ENGINE=InnoDB;
INSERT INTO t6 VALUES (0);
ALTER TABLE t6 ADD COLUMN j INT;
TRUNCATE TABLE t6;
INSERT INTO t6 VALUES (1,2);
CREATE TABLE t7 (i INT) ENGINE=InnoDB;
INSERT INTO t7 VALUES (1),(2),(3),(4),(5);
ALTER TABLE t7 ADD t TEXT DEFAULT '';
CREATE TABLE t8 (i INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
INSERT INTO t8 VALUES (NULL);
ALTER TABLE t8 ADD c CHAR(3);
SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL rebuilt WAIT_FOR dml';
--send
ALTER TABLE t8 FORCE;
connection dml;
SET DEBUG_SYNC='now WAIT_FOR rebuilt';
BEGIN;
INSERT INTO t8 SET i=1;
UPDATE t8 SET i=ISNULL(i);
ROLLBACK;
SET DEBUG_SYNC='now SIGNAL dml';
connection default;
reap;
SET DEBUG_SYNC='RESET';
CREATE TABLE t9 (
pk INT AUTO_INCREMENT PRIMARY KEY,
c1 BIGINT UNSIGNED,
c2 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
c3 BIGINT,
c4 VARCHAR(257) CHARACTER SET utf8,
c5 TINYINT UNSIGNED,
c6 TINYINT,
c7 VARCHAR(257) CHARACTER SET latin1,
c8 VARCHAR(257) CHARACTER SET binary
) ENGINE=InnoDB;
INSERT INTO t9 () VALUES ();
ALTER TABLE t9 ADD COLUMN IF NOT EXISTS t TIMESTAMP NULL KEY;
SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL rebuilt WAIT_FOR dml';
--send
OPTIMIZE TABLE t9;
connection dml;
SET DEBUG_SYNC='now WAIT_FOR rebuilt';
BEGIN;
INSERT INTO t9 () VALUES (),();
UPDATE t9 SET t=current_timestamp();
ROLLBACK;
SET DEBUG_SYNC='now SIGNAL dml';
disconnect dml;
connection default;
reap;
SET DEBUG_SYNC='RESET';
CREATE TABLE t10 (pk INT DEFAULT 0 KEY) ENGINE=InnoDB;
INSERT INTO t10 (pk) VALUES (1);
ALTER TABLE t10 ADD c INT;
TRUNCATE TABLE t10;
INSERT INTO t10 VALUES (1,1),(2,2);
ALTER TABLE t10 FORCE;
CREATE TABLE t11 (
c01 enum('a','b'),
c02 bit,
c03 blob,
c04 enum('c','d'),
c05 blob,
c06 decimal,
c07 char(1),
c08 int,
c09 char(1),
c10 set('e','f'),
c11 char(1),
c12 float,
c13 bit,
c14 char(1),
c15 int,
c16 float,
c17 decimal,
c18 char(1) CHARACTER SET utf8 not null default '',
c19 float,
c20 set('g','h'),
c21 char(1),
c22 int,
c23 int,
c24 int,
c25 set('i','j'),
c26 decimal,
c27 float,
c28 char(1),
c29 int,
c30 enum('k','l'),
c31 decimal,
c32 char(1),
c33 decimal,
c34 bit,
c35 enum('m','n'),
c36 set('o','p'),
c37 enum('q','r'),
c38 blob,
c39 decimal,
c40 blob not null default '',
c41 char(1),
c42 int,
c43 float,
c44 float,
c45 enum('s','t'),
c46 decimal,
c47 set('u','v'),
c48 enum('w','x'),
c49 set('y','z'),
c50 float
) ENGINE=InnoDB;
INSERT INTO t11 () VALUES ();
ALTER TABLE t11 ADD COLUMN f INT;
INSERT INTO t11 () VALUES ();
UPDATE t11 SET c22 = 1;
--source include/wait_all_purged.inc
DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment