mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 02:51:44 +01:00
40 lines
1.2 KiB
Text
40 lines
1.2 KiB
Text
FLUSH TABLES;
|
|
#
|
|
# MDEV-11369: Instant ADD COLUMN for InnoDB
|
|
#
|
|
connect to_be_killed, localhost, root;
|
|
CREATE TABLE empty (id INT PRIMARY KEY, c2 INT UNIQUE) ENGINE=InnoDB;
|
|
CREATE TABLE once LIKE empty;
|
|
CREATE TABLE twice LIKE empty;
|
|
INSERT INTO once SET id=1,c2=1;
|
|
INSERT INTO twice SET id=1,c2=1;
|
|
ALTER TABLE empty ADD COLUMN (d1 INT DEFAULT 15);
|
|
ALTER TABLE once ADD COLUMN (d1 INT DEFAULT 20);
|
|
ALTER TABLE twice ADD COLUMN (d1 INT DEFAULT 20);
|
|
ALTER TABLE twice ADD COLUMN
|
|
(d2 INT NOT NULL DEFAULT 10,
|
|
d3 VARCHAR(15) NOT NULL DEFAULT 'var och en char');
|
|
BEGIN;
|
|
INSERT INTO empty set id=0,c2=42;
|
|
UPDATE once set c2=c2+1;
|
|
UPDATE twice set c2=c2+1;
|
|
INSERT INTO twice SET id=2,c2=0,d3='';
|
|
connection default;
|
|
SET GLOBAL innodb_flush_log_at_trx_commit=1;
|
|
CREATE TABLE foo(a INT PRIMARY KEY) ENGINE=InnoDB;
|
|
# Kill the server
|
|
disconnect to_be_killed;
|
|
SET @saved_frequency= @@GLOBAL.innodb_purge_rseg_truncate_frequency;
|
|
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
|
|
DROP TABLE foo;
|
|
InnoDB 0 transactions not purged
|
|
SET GLOBAL innodb_purge_rseg_truncate_frequency=@saved_frequency;
|
|
SELECT * FROM empty;
|
|
id c2 d1
|
|
SELECT * FROM once;
|
|
id c2 d1
|
|
1 1 20
|
|
SELECT * FROM twice;
|
|
id c2 d1 d2 d3
|
|
1 1 20 10 var och en char
|
|
DROP TABLE empty, once, twice;
|