config root man

Current Path : /home/usr.opt/mysql57/mysql-test/suite/innodb/t/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //home/usr.opt/mysql57/mysql-test/suite/innodb/t/innodb_wl6560_1.test

#
# WL#6560: InnoDB: separate tablespace for innodb-temp-tables.
#

--source include/have_innodb.inc
# Embedded server does not support crashing
--source include/not_embedded.inc
# Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc

call mtr.add_suppression("Please add another temp-data file or use 'autoextend' for the last data file");
call mtr.add_suppression("The table 't1' is full");

################################################################################
#
# Will test following scenarios:

#
# 1. ddl + dml operation involving temp-tablespace.
#    a) insert/delete/update/transacion/select
#    b) create index/drop index/add column/drop column
#    c) alter inplace/copy on temp table

# 2. ddl + dml operation on temp table from 2 sessions.
#    a) Both session create 20 tables each of same name.
#    b) No error expected across session as temp tables are not be
#    visible across session.
#    c) create drop same table multiple time

# 3. Temp table operation -
#    a) can not create temp table with partition
#    b) can not create/drop view on temp tables.
#    c) select/join on temp tables.
#    d) Lock/flush on tables
#    e) create temp table as select


# 4. Temp table operation -
#    a) restart on existing datadir and see ibtmp1 removed on clean shutdown
#

################################################################################

#-----------------------------------------------------------------------------
#

set global innodb_file_per_table = off;
let $MYSQL_DATA_DIR = `select @@datadir`;
let $MYSQL_TMP_DIR = `select @@tmpdir`;

#-----------------------------------------------------------------------------
#
# 1. ddl + dml operation involving temp-tablespace.
#    a) insert/delete/update/transacion/select
#    b) create index/drop index/add column/drop column
#    c) alter inplace/copy on temp table
SELECT @@global.innodb_file_per_table;
--replace_column 1 NUM
SELECT @mycount_SYS_DATAFILES:=COUNT(*)  FROM information_schema.INNODB_SYS_DATAFILES;
CREATE TEMPORARY TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b FLOAT(5,3),
c BLOB(100),d VARCHAR(100),e TEXT) ENGINE=InnoDB;

--echo # creation of shared temp-tablespace in MYSQL_DATA_DIR
--list_files $MYSQL_DATA_DIR/ ibtmp1*

--echo # check no entries made INNODB_SYS_DATAFILES
SELECT @mycount_SYS_DATAFILES=COUNT(*)  FROM information_schema.INNODB_SYS_DATAFILES;

INSERT INTO t1(b,c,d,e) VALUES (11.111,REPEAT('a1',50),REPEAT('a1',50),
REPEAT('a1',50));

# DML+TRANSACTION
START TRANSACTION;
INSERT INTO t1(b,c,d,e) VALUES (12.111,REPEAT('a2',50),REPEAT('a2',50),
REPEAT('a2',50));
INSERT INTO t1(b,c,d,e) VALUES (13.111,REPEAT('a3',50),REPEAT('a3',50),
REPEAT('a3',50));
UPDATE t1 SET e = REPEAT('ta',50);
DELETE FROM t1 WHERE a = 3;
SAVEPOINT A;
INSERT INTO t1(b,c,d,e) VALUES (14.111,REPEAT('a4',50),REPEAT('a4',50),
REPEAT('a4',50));
UPDATE t1 SET e = REPEAT('yb',50);
DELETE FROM t1 WHERE a = 1;
SAVEPOINT B;
SELECT a,RIGHT(b,10),RIGHT(c,10),RIGHT(d,10),RIGHT(e,10) FROM t1;
ROLLBACK TO SAVEPOINT A;
COMMIT;
SELECT a,RIGHT(b,10),RIGHT(c,10),RIGHT(d,10),RIGHT(e,10) FROM t1;

# DDL
ALTER TABLE t1 ADD COLUMN f BLOB(100), ADD INDEX `idx1` (d);
SELECT a,RIGHT(b,10),RIGHT(c,10),RIGHT(d,10),RIGHT(e,10),RIGHT(f,10) FROM t1;
--error 1845
ALTER TABLE t1 DROP COLUMN f, DROP INDEX `idx1` , ADD INDEX `idx2` (d), ALGORITHM=INPLACE;
ALTER TABLE t1 DROP COLUMN f, DROP INDEX `idx1` , ADD INDEX `idx2` (d), ALGORITHM=COPY;
SELECT a,RIGHT(b,10),RIGHT(c,10),RIGHT(d,10),RIGHT(e,10) FROM t1;
# drop table
DROP TABLE t1;


#-----------------------------------------------------------------------------
#
# 2. ddl + dml operation on temp table from 2 sessions.
#    a) Both session create 20 tables each of same name.
#    b) No error expected across session as temp tables are not be
#    visible across session.
#    c) create drop same table multiple time
#
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP DATABASE IF EXISTS test_db;
--enable_warnings
# check by allowing file per table on
set global innodb_file_per_table = on;
SELECT @@global.innodb_file_per_table;
let $counter= 2;

CREATE DATABASE test_db;

--echo "Create con1 client connection"
connect (con1,localhost,root,,);

--disable_query_log
while ($counter<23) {
# create table from con1 connection
connection con1;
USE test_db;
EVAL CREATE TEMPORARY TABLE t$counter (a INT AUTO_INCREMENT PRIMARY KEY, b FLOAT(5,3),
c BLOB(100),d VARCHAR(100),e TEXT) ENGINE=InnoDB;
EVAL INSERT INTO t$counter(b,c,d,e) VALUES (11.111,REPEAT('a1',50),REPEAT('a1',50),
REPEAT('a1',50));
START TRANSACTION;
EVAL INSERT INTO t$counter(b,c,d,e) VALUES (12.111,REPEAT('a2',50),REPEAT('a2',50),
REPEAT('a2',50));
EVAL INSERT INTO t$counter(b,c,d,e) VALUES (13.111,REPEAT('a3',50),REPEAT('a3',50),
REPEAT('a3',50));
EVAL UPDATE t$counter SET e = REPEAT('ta',50);
EVAL DELETE FROM t$counter WHERE a = 3;
SAVEPOINT A;
EVAL INSERT INTO t$counter(b,c,d,e) VALUES (14.111,REPEAT('a4',50),REPEAT('a4',50),
REPEAT('a4',50));
EVAL UPDATE t$counter SET e = REPEAT('yb',50);
EVAL DELETE FROM t$counter WHERE a = 1;
SAVEPOINT B;
ROLLBACK TO SAVEPOINT A;
COMMIT;
EVAL ALTER TABLE t$counter ADD COLUMN f BLOB(100), ADD INDEX `idx1` (d);
EVAL ALTER TABLE t$counter DROP COLUMN f, DROP INDEX `idx1` , ADD INDEX `idx2` (d), ALGORITHM=COPY;

# create same table from default connection
connection default;
USE test_db;
EVAL CREATE TEMPORARY TABLE t$counter (a INT AUTO_INCREMENT PRIMARY KEY, b FLOAT(5,3),
c BLOB(100),d VARCHAR(100),e TEXT) ENGINE=InnoDB;
EVAL INSERT INTO t$counter(b,c,d,e) VALUES (11.111,REPEAT('a1',50),REPEAT('a1',50),
REPEAT('a1',50));
START TRANSACTION;
EVAL INSERT INTO t$counter(b,c,d,e) VALUES (12.111,REPEAT('a2',50),REPEAT('a2',50),
REPEAT('a2',50));
EVAL INSERT INTO t$counter(b,c,d,e) VALUES (13.111,REPEAT('a3',50),REPEAT('a3',50),
REPEAT('a3',50));
EVAL UPDATE t$counter SET e = REPEAT('ta',50);
EVAL DELETE FROM t$counter WHERE a = 3;
SAVEPOINT A;
EVAL INSERT INTO t$counter(b,c,d,e) VALUES (14.111,REPEAT('a4',50),REPEAT('a4',50),
REPEAT('a4',50));
EVAL UPDATE t$counter SET e = REPEAT('yb',50);
EVAL DELETE FROM t$counter WHERE a = 1;
SAVEPOINT B;
ROLLBACK TO SAVEPOINT A;
COMMIT;
EVAL ALTER TABLE t$counter ADD COLUMN f BLOB(100), ADD INDEX `idx1` (d);
EVAL ALTER TABLE t$counter DROP COLUMN f, DROP INDEX `idx1` , ADD INDEX `idx2` (d), ALGORITHM=COPY;

# create and drop same table in loop
CREATE TEMPORARY TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b FLOAT(5,3),
c BLOB(100),d VARCHAR(100),e TEXT) ENGINE=InnoDB;
INSERT INTO t1(b,c,d,e) VALUES (11.111,REPEAT('a1',50),REPEAT('a1',50),
REPEAT('a1',50));
START TRANSACTION;
INSERT INTO t1(b,c,d,e) VALUES (12.111,REPEAT('a2',50),REPEAT('a2',50),
REPEAT('a2',50));
INSERT INTO t1(b,c,d,e) VALUES (13.111,REPEAT('a3',50),REPEAT('a3',50),
REPEAT('a3',50));
UPDATE t1 SET e = REPEAT('ta',50);
DELETE FROM t1 WHERE a = 3;
SAVEPOINT A;
INSERT INTO t1(b,c,d,e) VALUES (14.111,REPEAT('a4',50),REPEAT('a4',50),
REPEAT('a4',50));
UPDATE t1 SET e = REPEAT('yb',50);
DELETE FROM t1 WHERE a = 1;
SAVEPOINT B;
ROLLBACK TO SAVEPOINT A;
COMMIT;
ALTER TABLE t1 ADD COLUMN f BLOB(100), ADD INDEX `idx1` (d);
ALTER TABLE t1 DROP COLUMN f, DROP INDEX `idx1` , ADD INDEX `idx2` (d), ALGORITHM=COPY;
DROP TABLE t1;

# check separate ibd file is not created
--list_files $MYSQL_DATA_DIR/test_db/ *ibd
--inc $counter
}


DROP DATABASE test_db;
USE test;
--enable_query_log
--echo # creation of shared temp-tablespace in MYSQL_DATA_DIR
--list_files $MYSQL_DATA_DIR/ ibtmp1*

#-----------------------------------------------------------------------------
#
# 3. Temp table operation -
#    a) can not create temp table with partition
#    b) can not create/drop view on temp tables.
#    c) select/join on temp tables.
#    d) Lock/flush on tables 
#    e) create temp table as select
#
--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3,t4;
--enable_warnings
# check by allowing file per table on
SELECT @@global.innodb_file_per_table;
USE test;

CREATE TEMPORARY TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b FLOAT(5,3),
c BLOB(100),d VARCHAR(100),e TEXT) ENGINE=InnoDB;
CREATE TEMPORARY TABLE t2 (a INT AUTO_INCREMENT PRIMARY KEY, b FLOAT, c BLOB(100),
d VARCHAR(100),e TEXT) ENGINE=InnoDB;

# Can not create temp table with partition
--ERROR 1562
CREATE TEMPORARY TABLE t3 (val INT) ENGINE = InnoDB PARTITION BY LIST(val)(
  PARTITION mypart1 VALUES IN (1,3,5),
  PARTITION MyPart2 VALUES IN (2,4,6)
 );

INSERT INTO t1(b,c,d,e) VALUES (11.111,REPEAT('a1',50),REPEAT('a1',50),
REPEAT('a1',50));
INSERT INTO t2(b,c,d,e) VALUES (11.111,REPEAT('t1',50),REPEAT('t1',50),
REPEAT('a2',50));
INSERT INTO t2(b,c,d,e) VALUES (11.111,REPEAT('t2',50),REPEAT('t2',50),
REPEAT('a2',50));

# Check with join of
SELECT t1.a,t2.a,RIGHT(t1.c,10),RIGHT(t2.c,10) FROM t1,t2 WHERE t1.c LIKE t2.c;
SELECT t1.a,t2.a,RIGHT(t1.c,10),RIGHT(t2.c,10) FROM t1,t2 WHERE t1.c NOT LIKE t2.c AND t1.a=t2.a;

# you cannot create a TEMPORARY view
--ERROR 1352
CREATE OR REPLACE VIEW vw1 AS SELECT * FROM t1;

# Check with create temp as <select>
CREATE TEMPORARY TABLE t3 AS
SELECT t1.a,RIGHT(t1.c,10),RIGHT(t2.c,10) FROM t1,t2
WHERE t1.c NOT LIKE t2.c AND t1.a=t2.a;
SELECT * FROM t3;
CREATE TABLE t4 AS
SELECT t1.a,RIGHT(t1.c,10),RIGHT(t2.c,10) FROM t1,t2
WHERE t1.c NOT LIKE t2.c AND t1.a=t2.a;
SELECT * FROM t4;
# join on temp and non temp table
SELECT * FROM t3,t4 WHERE t3.a=t4.a;
SELECT * FROM t3,t4 WHERE t3.a!=t4.a;

#Acquire lock and flush
LOCK TABLES t1 READ;
SELECT t1.a,t2.a,RIGHT(t1.c,10),RIGHT(t2.c,10) FROM t1,t2 WHERE t1.c LIKE t2.c;
SELECT t1.a,t2.a,RIGHT(t1.c,10),RIGHT(t2.c,10) FROM t1,t2 WHERE t1.c NOT LIKE t2.c AND t1.a=t2.a;
# delete records even type is read as lock table is ignored for temp tables
DELETE FROM t1;
SELECT * FROM t1;
UNLOCK TABLES;
LOCK TABLES t2 WRITE,t3 WRITE,t4 WRITE;
DELETE FROM t2 WHERE t2.c LIKE REPEAT('t2',50);
SELECT t2.a,RIGHT(t2.c,10) FROM t2;
DELETE FROM t3;
DELETE FROM t4;
SELECT * FROM t3,t4;
UNLOCK TABLES;

--list_files $MYSQL_DATA_DIR/ ibtmp1*
--list_files $MYSQL_DATA_DIR/test/ t4*ibd*
DROP TABLE t1,t2,t3,t4;


#-----------------------------------------------------------------------------
#
# 4. Temp table operation -
#    a) restart on existing datadir and see ibtmp1 removed on clean shutdown
#
# check by allowing file per table on
SELECT @@global.innodb_file_per_table;

CREATE TEMPORARY TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b FLOAT(5,3),
c BLOB(100),d VARCHAR(100),e TEXT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT AUTO_INCREMENT PRIMARY KEY, b FLOAT(5,3),
c BLOB(100),d VARCHAR(100),e TEXT) ENGINE=InnoDB;

INSERT INTO t1(b,c,d,e) VALUES (11.111,REPEAT('a1',50),REPEAT('a1',50),
REPEAT('a1',50));
INSERT INTO t1(b,c,d,e) VALUES (11.111,REPEAT('a1',50),REPEAT('a1',50),
REPEAT('a1',50));
SELECT a,b,RIGHT(c,10),RIGHT(d,10),RIGHT(e,10) FROM t1;
UPDATE t1 SET a = a + 5;
DELETE FROM t1 WHERE a > 6;
SELECT a,b,RIGHT(c,10),RIGHT(d,10),RIGHT(e,10) FROM t1;

INSERT INTO t2(b,c,d,e) VALUES (11.111,REPEAT('a1',50),REPEAT('a1',50),
REPEAT('a1',50));
SELECT a,b,RIGHT(c,10),RIGHT(d,10),RIGHT(e,10) FROM t2;
UPDATE t2 SET a = a + 5;
DELETE FROM t2 WHERE a > 6;
SELECT a,b,RIGHT(c,10),RIGHT(d,10),RIGHT(e,10) FROM t2;

#
--echo # shutting down the server
--source include/shutdown_mysqld.inc
--echo # list_file, no files expected - temp tablespace cleared on stopping server
--list_files $MYSQL_DATA_DIR/ ibtmp1*
#
--source include/start_mysqld.inc

# check temp table after restart
CREATE TEMPORARY TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b FLOAT(5,3),
c BLOB(100),d VARCHAR(100),e TEXT) ENGINE=InnoDB;

INSERT INTO t1(b,c,d,e) VALUES (11.111,REPEAT('a1',50),REPEAT('a1',50),
REPEAT('a1',50));
INSERT INTO t1(b,c,d,e) VALUES (11.111,REPEAT('a1',50),REPEAT('a1',50),
REPEAT('a1',50));
SELECT a,b,RIGHT(c,10),RIGHT(d,10),RIGHT(e,10) FROM t1;
UPDATE t1 SET a = a + 5;
DELETE FROM t1 WHERE a > 6;
SELECT a,b,RIGHT(c,10),RIGHT(d,10),RIGHT(e,10) FROM t1;
DROP TABLE t1;

--source include/restart_mysqld.inc

# check not temp table
SHOW TABLES;
DROP TABLE t2;

Man Man