Commit ff6cf4bb authored by Alexander Nozdrin's avatar Alexander Nozdrin

Auto-merge from mysql-trunk-innodb.

parents 5cf1d385 bf158eed
......@@ -119,8 +119,12 @@ fi
# Set flags for various build configurations.
# Used in -valgrind builds
valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify "
# Override -DFORCE_INIT_OF_VARS from debug_cflags. It enables the macro
# LINT_INIT(), which is only useful for silencing spurious warnings
# of static analysis tools. We want LINT_INIT() to be a no-op in Valgrind.
valgrind_flags="-UFORCE_INIT_OF_VARS -DHAVE_purify "
valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
valgrind_configs="--with-valgrind"
#
# Used in -debug builds
debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS "
......
......@@ -1010,9 +1010,10 @@ set_ccache_usage()
set_valgrind_flags()
{
if test "x$valgrind_flag" = "xyes" ; then
loc_valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify "
loc_valgrind_flags="-UFORCE_INIT_OF_VARS -DHAVE_purify "
loc_valgrind_flags="$loc_valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
compiler_flags="$compiler_flags $loc_valgrind_flags"
with_flags="$with_flags --with-valgrind"
fi
}
......
......@@ -4,7 +4,7 @@ path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$amd64_cflags $debug_cflags $valgrind_flags"
extra_configs="$amd64_configs $debug_configs $max_configs"
extra_configs="$amd64_configs $debug_configs $valgrind_configs $max_configs"
. "$path/FINISH.sh"
......
......@@ -29,6 +29,6 @@ extra_flags="$pentium_cflags $debug_cflags $valgrind_flags"
c_warnings="-Wall -Wcheck -wd161,444,279,810,981,1292,1469,1572"
cxx_warnings="$c_warnings -wd869,874"
base_cxxflags="-fno-exceptions -fno-rtti"
extra_configs="$pentium_configs $debug_configs"
extra_configs="$pentium_configs $debug_configs $valgrind_configs"
. "$path/FINISH.sh"
......@@ -4,7 +4,7 @@ path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags $valgrind_flags"
extra_configs="$pentium_configs $debug_configs $max_configs"
extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs"
. "$path/FINISH.sh"
......
......@@ -4,7 +4,7 @@ path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags $valgrind_flags"
extra_configs="$pentium_configs $debug_configs $max_no_ndb_configs"
extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_no_ndb_configs"
. "$path/FINISH.sh"
......
......@@ -4,7 +4,7 @@ path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium64_cflags $debug_cflags $valgrind_flags"
extra_configs="$pentium_configs $debug_configs $max_configs"
extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs"
. "$path/FINISH.sh"
......
......@@ -1913,6 +1913,17 @@ else
CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS"
fi
AC_ARG_WITH([valgrind],
[AS_HELP_STRING([--with-valgrind],
[Valgrind instrumentation @<:@default=no@:>@])],
[], [with_valgrind=no])
if test "$with_valgrind" != "no"
then
AC_CHECK_HEADERS([valgrind/valgrind.h valgrind/memcheck.h],
[AC_DEFINE([HAVE_VALGRIND], [1], [Define for Valgrind support])])
fi
# Debug Sync Facility. NOTE: depends on 'with_debug'. Must be behind it.
AC_MSG_CHECKING(if Debug Sync Facility should be enabled.)
AC_ARG_ENABLE(debug_sync,
......
......@@ -127,9 +127,6 @@ extern size_t bcmp(const uchar *s1,const uchar *s2,size_t len);
extern size_t my_bcmp(const uchar *s1,const uchar *s2,size_t len);
#undef bcmp
#define bcmp(A,B,C) my_bcmp((A),(B),(C))
#define bzero_if_purify(A,B) bzero(A,B)
#else
#define bzero_if_purify(A,B)
#endif /* HAVE_purify */
#ifndef bmove512
......
......@@ -28,6 +28,19 @@ typedef struct my_aio_result {
} my_aio_result;
#endif
#ifdef HAVE_VALGRIND
# include <valgrind/memcheck.h>
# define MEM_UNDEFINED(a,len) VALGRIND_MAKE_MEM_UNDEFINED(a,len)
# define MEM_NOACCESS(a,len) VALGRIND_MAKE_MEM_NOACCESS(a,len)
# define MEM_CHECK_ADDRESSABLE(a,len) VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,len)
# define MEM_CHECK_DEFINED(a,len) VALGRIND_CHECK_MEM_IS_DEFINED(a,len)
#else /* HAVE_VALGRIND */
# define MEM_UNDEFINED(a,len) ((void) 0)
# define MEM_NOACCESS(a,len) ((void) 0)
# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
# define MEM_CHECK_DEFINED(a,len) ((void) 0)
#endif /* HAVE_VALGRIND */
#ifndef THREAD
extern int NEAR my_errno; /* Last error in mysys */
#else
......@@ -154,7 +167,7 @@ extern int NEAR my_errno; /* Last error in mysys */
#define my_memdup(A,B,C) _my_memdup((A),(B), __FILE__,__LINE__,C)
#define my_strdup(A,C) _my_strdup((A), __FILE__,__LINE__,C)
#define my_strndup(A,B,C) _my_strndup((A),(B),__FILE__,__LINE__,C)
#define TRASH(A,B) bfill(A, B, 0x8F)
#define TRASH(A,B) do { bfill(A, B, 0x8F); MEM_UNDEFINED(A, B); } while (0)
#define QUICK_SAFEMALLOC sf_malloc_quick=1
#define NORMAL_SAFEMALLOC sf_malloc_quick=0
extern uint sf_malloc_prehunc,sf_malloc_endhunc,sf_malloc_quick;
......@@ -182,7 +195,7 @@ extern char *my_strndup(const char *from, size_t length,
#define CALLER_INFO_PROTO /* nothing */
#define CALLER_INFO /* nothing */
#define ORIG_CALLER_INFO /* nothing */
#define TRASH(A,B) /* nothing */
#define TRASH(A,B) do{MEM_CHECK_ADDRESSABLE(A,B);MEM_UNDEFINED(A,B);} while (0)
#endif
#if defined(ENABLED_DEBUG_SYNC)
......
......@@ -109,13 +109,20 @@ Database: information_schema
| TRIGGERS |
| USER_PRIVILEGES |
| VIEWS |
| INNODB_CMP_RESET |
| INNODB_SYS_FIELDS |
| INNODB_TRX |
| INNODB_CMPMEM_RESET |
| INNODB_SYS_INDEXES |
| INNODB_LOCK_WAITS |
| INNODB_CMPMEM |
| INNODB_SYS_TABLESTATS |
| INNODB_CMP |
| INNODB_SYS_COLUMNS |
| INNODB_CMP_RESET |
| INNODB_SYS_FOREIGN_COLS |
| INNODB_LOCKS |
| INNODB_CMPMEM_RESET |
| INNODB_CMPMEM |
| INNODB_SYS_FOREIGN |
| INNODB_SYS_TABLES |
+---------------------------------------+
Database: INFORMATION_SCHEMA
+---------------------------------------+
......@@ -151,13 +158,20 @@ Database: INFORMATION_SCHEMA
| TRIGGERS |
| USER_PRIVILEGES |
| VIEWS |
| INNODB_CMP_RESET |
| INNODB_SYS_FIELDS |
| INNODB_TRX |
| INNODB_CMPMEM_RESET |
| INNODB_SYS_INDEXES |
| INNODB_LOCK_WAITS |
| INNODB_CMPMEM |
| INNODB_SYS_TABLESTATS |
| INNODB_CMP |
| INNODB_SYS_COLUMNS |
| INNODB_CMP_RESET |
| INNODB_SYS_FOREIGN_COLS |
| INNODB_LOCKS |
| INNODB_CMPMEM_RESET |
| INNODB_CMPMEM |
| INNODB_SYS_FOREIGN |
| INNODB_SYS_TABLES |
+---------------------------------------+
Wildcard: inf_rmation_schema
+--------------------+
......
drop table if exists t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (null);
INSERT INTO t1 VALUES (null);
ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
SELECT * FROM t1;
d1
1
2
SELECT * FROM t1;
d1
1
2
INSERT INTO t1 VALUES(null);
ALTER TABLE t1 AUTO_INCREMENT = 3;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`d1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`d1`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES(null);
SELECT * FROM t1;
d1
1
2
3
4
DROP TABLE t1;
......@@ -868,35 +868,6 @@ Got one of the listed errors
DROP TABLE t1;
DROP TABLE t2;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (null);
INSERT INTO t1 VALUES (null);
ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
SELECT * FROM t1;
d1
1
2
SELECT * FROM t1;
d1
1
2
INSERT INTO t1 VALUES(null);
Got one of the listed errors
ALTER TABLE t1 AUTO_INCREMENT = 3;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`d1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`d1`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES(null);
SELECT * FROM t1;
d1
1
2
3
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value
auto_increment_increment 1
......@@ -1111,18 +1082,165 @@ c1 c2
3 innodb
4 NULL
DROP TABLE t1;
CREATE TABLE T1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
CREATE INDEX i1 on T1(c2);
SHOW CREATE TABLE T1;
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
CREATE INDEX i1 on t1(c2);
SHOW CREATE TABLE t1;
Table Create Table
T1 CREATE TABLE `T1` (
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `i1` (`c2`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
INSERT INTO T1 (c2) values (0);
SELECT * FROM T1;
INSERT INTO t1 (c2) values (0);
SELECT * FROM t1;
c1 c2
10 0
DROP TABLE T1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 't1'
CREATE TABLE t1(C1 DOUBLE AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
INSERT INTO t1(C2) VALUES ('innodb');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`C1` double NOT NULL AUTO_INCREMENT,
`C2` char(10) DEFAULT NULL,
PRIMARY KEY (`C1`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1(C1 FLOAT AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
INSERT INTO t1(C2) VALUES ('innodb');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`C1` float NOT NULL AUTO_INCREMENT,
`C2` char(10) DEFAULT NULL,
PRIMARY KEY (`C1`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 't1'
CREATE TABLE t1 (c1 INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 SET c1 = 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
INSERT INTO t1 SET c1 = 2;
INSERT INTO t1 SET c1 = -1;
SELECT * FROM t1;
c1
-1
1
2
INSERT INTO t1 SET c1 = -1;
Got one of the listed errors
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
REPLACE INTO t1 VALUES (-1);
SELECT * FROM t1;
c1
-1
1
2
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 't1'
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL);
SELECT * FROM t1;
c1
-685113344
1
2
3
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL);
SELECT * FROM t1;
c1
-685113344
2
3
4
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL);
INSERT INTO t1 VALUES (4), (5), (6), (NULL);
SELECT * FROM t1;
c1
-685113344
1
2
3
4
5
6
7
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5);
SELECT * FROM t1;
c1
-685113344
1
2
5
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL);
SELECT * FROM t1;
c1
-685113344
1
2
3
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
DROP TABLE t1;
......@@ -46,13 +46,6 @@ t1 CREATE TABLE `t1` (
KEY `d2` (`d`),
KEY `b` (`b`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
CREATE TABLE `t1#1`(a INT PRIMARY KEY) ENGINE=InnoDB;
alter table t1 add unique index (c), add index (d);
ERROR HY000: Table 'test.t1#1' already exists
rename table `t1#1` to `t1#2`;
alter table t1 add unique index (c), add index (d);
ERROR HY000: Table 'test.t1#2' already exists
drop table `t1#2`;
alter table t1 add unique index (c), add index (d);
show create table t1;
Table Create Table
......@@ -441,6 +434,7 @@ t3 CREATE TABLE `t3` (
KEY `c` (`c`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
alter table t2 drop index b, add index (b);
ERROR 42000: Incorrect index name 'b'
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
......@@ -451,8 +445,8 @@ t2 CREATE TABLE `t2` (
`e` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `dc` (`d`,`c`),
KEY `c` (`c`),
KEY `b` (`b`),
KEY `c` (`c`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`b`) ON DELETE CASCADE,
CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`c`) REFERENCES `t3` (`c`),
CONSTRAINT `t2_ibfk_3` FOREIGN KEY (`d`) REFERENCES `t4` (`d`)
......@@ -841,48 +835,6 @@ test.t1 check status OK
explain select * from t1 where b like 'adfd%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL b NULL NULL NULL 15 Using where
create table t2(a int, b varchar(255), primary key(a,b)) engine=innodb;
insert into t2 select a,left(b,255) from t1;
drop table t1;
rename table t2 to t1;
set innodb_lock_wait_timeout=1;
begin;
select a from t1 limit 1 for update;
a
22
set innodb_lock_wait_timeout=1;
create index t1ba on t1 (b,a);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
commit;
begin;
select a from t1 limit 1 lock in share mode;
a
22
create index t1ba on t1 (b,a);
drop index t1ba on t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
commit;
explain select a from t1 order by b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL t1ba 261 NULL 15 Using index
select a,sleep(2+a/100) from t1 order by b limit 3;
select sleep(1);
sleep(1)
0
drop index t1ba on t1;
a sleep(2+a/100)
22 0
44 0
66 0
explain select a from t1 order by b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 261 NULL 15 Using index; Using filesort
select a from t1 order by b limit 3;
a
22
66
44
commit;
drop table t1;
set global innodb_file_per_table=on;
set global innodb_file_format='Barracuda';
......@@ -1133,39 +1085,3 @@ t2 CREATE TABLE `t2` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t2;
DROP TABLE t1;
CREATE TABLE t1 (a INT, b CHAR(1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (3,'a'),(3,'b'),(1,'c'),(0,'d'),(1,'e');
BEGIN;
SELECT * FROM t1;
a b
3 a
3 b
1 c
0 d
1 e
CREATE INDEX t1a ON t1(a);
SELECT * FROM t1;
a b
3 a
3 b
1 c
0 d
1 e
SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
ERROR HY000: Table definition has changed, please retry transaction
SELECT * FROM t1;
a b
3 a
3 b
1 c
0 d
1 e
COMMIT;
SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
a b
0 d
1 c
1 e
3 a
3 b
DROP TABLE t1;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES;
TABLE_ID NAME FLAG N_COLS SPACE
11 SYS_FOREIGN 0 7 0
12 SYS_FOREIGN_COLS 0 7 0
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES;
INDEX_ID NAME TABLE_ID TYPE N_FIELDS PAGE_NO SPACE
11 ID_IND 11 3 1 302 0
12 FOR_IND 11 0 1 303 0
13 REF_IND 11 0 1 304 0
14 ID_IND 12 3 2 305 0
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS;
TABLE_ID NAME POS MTYPE PRTYPE LEN
11 ID 0 1 524292 0
11 FOR_NAME 1 1 524292 0
11 REF_NAME 2 1 524292 0
11 N_COLS 3 6 0 4
12 ID 0 1 524292 0
12 POS 1 6 0 4
12 FOR_COL_NAME 2 1 524292 0
12 REF_COL_NAME 3 1 524292 0
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS;
INDEX_ID NAME POS
11 ID 0
12 FOR_NAME 0
13 REF_NAME 0
14 ID 0
14 POS 1
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
ID FOR_NAME REF_NAME N_COLS TYPE
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
ID FOR_COL_NAME REF_COL_NAME POS
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS;
TABLE_ID NAME STATS_INITIALIZED NUM_ROWS CLUST_INDEX_SIZE OTHER_INDEX_SIZE MODIFIED_COUNTER AUTOINC MYSQL_HANDLES_OPENED
11 SYS_FOREIGN Uninitialized 0 0 0 0 0 0
12 SYS_FOREIGN_COLS Uninitialized 0 0 0 0 0 0
CREATE TABLE parent (id INT NOT NULL,
PRIMARY KEY (id)) ENGINE=INNODB;
CREATE TABLE child (id INT, parent_id INT,
INDEX par_ind (parent_id),
CONSTRAINT constraint_test
FOREIGN KEY (parent_id) REFERENCES parent(id)
ON DELETE CASCADE) ENGINE=INNODB;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
ID FOR_NAME REF_NAME N_COLS TYPE
test/constraint_test test/child test/parent 1 1
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
ID FOR_COL_NAME REF_COL_NAME POS
test/constraint_test parent_id id 0
INSERT INTO parent VALUES(1);
SELECT name, num_rows, mysql_handles_opened
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name LIKE "%parent";
name num_rows mysql_handles_opened
test/parent 1 1
SELECT NAME, FLAG, N_COLS, SPACE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES;
NAME FLAG N_COLS SPACE
SYS_FOREIGN 0 7 0
SYS_FOREIGN_COLS 0 7 0
test/child 1 5 0
test/parent 1 4 0
SELECT name, n_fields
from INFORMATION_SCHEMA.INNODB_SYS_INDEXES
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%parent%");
name n_fields
PRIMARY 1
SELECT name, n_fields
from INFORMATION_SCHEMA.INNODB_SYS_INDEXES
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%child%");
name n_fields
GEN_CLUST_INDEX 0
par_ind 1
SELECT name, pos, mtype, len
from INFORMATION_SCHEMA.INNODB_SYS_COLUMNS
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%child%");
name pos mtype len
id 0 6 4
parent_id 1 6 4
DROP TABLE child;
DROP TABLE parent;
CREATE TABLE parent (id INT NOT NULL, newid INT NOT NULL,
PRIMARY KEY (id, newid)) ENGINE=INNODB;
CREATE TABLE child (id INT, parent_id INT,
INDEX par_ind (parent_id),
CONSTRAINT constraint_test
FOREIGN KEY (id, parent_id) REFERENCES parent(id, newid)
ON DELETE CASCADE) ENGINE=INNODB;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
ID FOR_NAME REF_NAME N_COLS TYPE
test/constraint_test test/child test/parent 2 1
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
ID FOR_COL_NAME REF_COL_NAME POS
test/constraint_test id id 0
test/constraint_test parent_id newid 1
INSERT INTO parent VALUES(1, 9);
SELECT * FROM parent WHERE id IN (SELECT id FROM parent);
id newid
1 9
SELECT name, num_rows, mysql_handles_opened
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name LIKE "%parent";
name num_rows mysql_handles_opened
test/parent 1 2
DROP TABLE child;
DROP TABLE parent;
......@@ -169,10 +169,10 @@ Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize status OK
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 id A # NULL NULL BTREE
t1 1 parent_id 1 parent_id A # NULL NULL BTREE
t1 1 level 1 level A # NULL NULL BTREE
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 id A # NULL NULL BTREE
t1 1 parent_id 1 parent_id A # NULL NULL BTREE
t1 1 level 1 level A # NULL NULL BTREE
drop table t1;
CREATE TABLE t1 (
gesuchnr int(11) DEFAULT '0' NOT NULL,
......@@ -213,8 +213,8 @@ analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 skr 1 a A # NULL NULL YES BTREE
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 skr 1 a A # NULL NULL YES BTREE
drop table t1;
create table t1 (a int,b varchar(20),key(a)) engine=innodb;
insert into t1 values (1,""), (2,"testing");
......@@ -401,13 +401,13 @@ drop table t1;
CREATE TABLE t1 (a int not null, b int not null,c int not null,
key(a),primary key(a,b), unique(c),key(a),unique(b));
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 a A # NULL NULL BTREE
t1 0 PRIMARY 2 b A # NULL NULL BTREE
t1 0 c 1 c A # NULL NULL BTREE
t1 0 b 1 b A # NULL NULL BTREE
t1 1 a 1 a A # NULL NULL BTREE
t1 1 a_2 1 a A # NULL NULL BTREE
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 a A # NULL NULL BTREE
t1 0 PRIMARY 2 b A # NULL NULL BTREE
t1 0 c 1 c A # NULL NULL BTREE
t1 0 b 1 b A # NULL NULL BTREE
t1 1 a 1 a A # NULL NULL BTREE
t1 1 a_2 1 a A # NULL NULL BTREE
drop table t1;
create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
alter table t1 engine=innodb;
......@@ -692,6 +692,8 @@ select count(*) from t1 where sca_pic is null;
count(*)
2
alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
alter table t1 drop index sca_pic;
alter table t1 add index sca_pic (cat_code, sca_pic);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
count(*)
1
......@@ -699,6 +701,9 @@ select count(*) from t1 where cat_code='E';
count(*)
0
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
ERROR 42000: Incorrect index name 'sca_pic'
alter table t1 drop index sca_pic;
alter table t1 add index (sca_pic, cat_code);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
count(*)
1
......@@ -743,8 +748,8 @@ Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize status OK
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 a A # NULL NULL BTREE
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 a A # NULL NULL BTREE
drop table t1;
create table t1 (i int, j int ) ENGINE=innodb;
insert into t1 values (1,2);
......@@ -1179,82 +1184,6 @@ a b
8 8
9 9
drop table t1;
CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb;
CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb;
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
update t1,t2 set t1.a=t1.a+100;
select * from t1;
a b
101 1
102 2
103 3
104 4
105 5
106 6
107 7
108 8
109 9
110 10
111 11
112 12
update t1,t2 set t1.a=t1.a+100 where t1.a=101;
select * from t1;
a b
201 1
102 2
103 3
104 4
105 5
106 6
107 7
108 8
109 9
110 10
111 11
112 12
update t1,t2 set t1.b=t1.b+10 where t1.b=2;
select * from t1;
a b
201 1
103 3
104 4
105 5
106 6
107 7
108 8
109 9
110 10
111 11
102 12
112 12
update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100;
select * from t1;
a b
201 1
103 5
104 6
106 6
105 7
107 7
108 8
109 9
110 10
111 11
102 12
112 12
select * from t2;
a b
1 1
2 2
6 6
7 7
8 8
9 9
3 13
4 14
5 15
drop table t1,t2;
CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM;
CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
SET AUTOCOMMIT=0;
......@@ -1643,12 +1572,6 @@ ERROR 42S21: Duplicate column name 'c1'
alter table t1 add key (c1,c1,c2);
ERROR 42S21: Duplicate column name 'c1'
drop table t1;
create table t1(a int(1) , b int(1)) engine=innodb;
insert into t1 values ('1111', '3333');
select distinct concat(a, b) from t1;
concat(a, b)
11113333
drop table t1;
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
ERROR HY000: The used table type doesn't support FULLTEXT indexes
......@@ -1738,7 +1661,7 @@ count(*)
drop table t1;
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
variable_value
512
511
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size';
variable_value
16384
......@@ -1747,10 +1670,10 @@ variable_value - @innodb_rows_deleted_orig
71
SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
variable_value - @innodb_rows_inserted_orig
1084
1065
SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
variable_value - @innodb_rows_updated_orig
885
865
SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits';
variable_value - @innodb_row_lock_waits_orig
0
......@@ -1833,6 +1756,7 @@ show variables like "innodb_thread_sleep_delay";
Variable_name Value
innodb_thread_sleep_delay 10000
set storage_engine=INNODB;
set session old_alter_table=1;
drop table if exists t1,t2,t3;
--- Testing varchar ---
--- Testing varchar ---
......@@ -1970,7 +1894,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a '
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const # Using where; Using index
alter table t1 add unique(v);
ERROR 23000: Duplicate entry 'v' for key 'v_2'
ERROR 23000: Duplicate entry '{ ' for key 'v_2'
alter table t1 add key(v);
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
qq
......@@ -2406,6 +2330,7 @@ select * from t1 where a=20 and b is null;
a b
20 NULL
drop table t1;
set session old_alter_table=0;
create table t1 (v varchar(65530), key(v));
Warnings:
Warning 1071 Specified key was too long; max key length is 767 bytes
......@@ -2832,65 +2757,6 @@ t2 CREATE TABLE `t2` (
KEY `t2_ibfk_0` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t2,t1;
create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
insert into t1(a) values (1),(2),(3);
create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |
commit;
set autocommit = 0;
update t1 set b = 5 where a = 2;
set autocommit = 0;
insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100),
(11),(21),(31),(41),(51),(61),(71),(81),(91),(101),
(12),(22),(32),(42),(52),(62),(72),(82),(92),(102),
(13),(23),(33),(43),(53),(63),(73),(83),(93),(103),
(14),(24),(34),(44),(54),(64),(74),(84),(94),(104);
commit;
commit;
drop trigger t1t;
drop table t1;
create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
create table t2(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
create table t3(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
create table t4(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
create table t5(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
insert into t1(a) values (1),(2),(3);
insert into t2(a) values (1),(2),(3);
insert into t3(a) values (1),(2),(3);
insert into t4(a) values (1),(2),(3);
insert into t3(a) values (5),(7),(8);
insert into t4(a) values (5),(7),(8);
insert into t5(a) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12);
create trigger t1t before insert on t1 for each row begin
INSERT INTO t2 SET a = NEW.a;
end |
create trigger t2t before insert on t2 for each row begin
DELETE FROM t3 WHERE a = NEW.a;
end |
create trigger t3t before delete on t3 for each row begin
UPDATE t4 SET b = b + 1 WHERE a = OLD.a;
end |
create trigger t4t before update on t4 for each row begin
UPDATE t5 SET b = b + 1 where a = NEW.a;
end |
commit;
set autocommit = 0;
update t1 set b = b + 5 where a = 1;
update t2 set b = b + 5 where a = 1;
update t3 set b = b + 5 where a = 1;
update t4 set b = b + 5 where a = 1;
insert into t5(a) values(20);
set autocommit = 0;
insert into t1(a) values(7);
insert into t2(a) values(8);
delete from t2 where a = 3;
update t4 set b = b + 1 where a = 3;
commit;
commit;
drop trigger t1t;
drop trigger t2t;
drop trigger t3t;
drop trigger t4t;
drop table t1, t2, t3, t4, t5;
CREATE TABLE t1 (
field1 varchar(8) NOT NULL DEFAULT '',
field2 varchar(8) NOT NULL DEFAULT '',
......
......@@ -25,8 +25,8 @@ ALTER TABLE t1 CHANGE a c INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150)
# Ensure that online column rename works.
ALTER TABLE t1 CHANGE b c INT;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0
# Test renaming the column in the referencing table
......@@ -34,8 +34,8 @@ ALTER TABLE t2 CHANGE a c INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
# Ensure that online column rename works.
ALTER TABLE t2 CHANGE b c INT;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0
# Test with self-referential constraints
......@@ -45,8 +45,8 @@ ALTER TABLE t3 CHANGE b d INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150)
# Ensure that online column rename works.
ALTER TABLE t3 CHANGE c d INT;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0
# Cleanup.
......
SET storage_engine=InnoDB;
INSERT INTO bug38231 VALUES (1), (10), (300);
INSERT INTO bug38231_2 VALUES (1), (10), (300);
SET autocommit=0;
SELECT * FROM bug38231 FOR UPDATE;
SELECT * FROM bug38231_2 FOR UPDATE;
a
1
10
300
TRUNCATE TABLE bug38231;
TRUNCATE TABLE bug38231_2;
COMMIT;
DROP TABLE bug38231;
DROP TABLE bug38231_2;
......@@ -2,8 +2,7 @@ CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB;
ALTER TABLE bug44571 CHANGE foo bar INT;
ALTER TABLE bug44571 ADD INDEX bug44571b (foo);
ERROR 42000: Key column 'foo' doesn't exist in table
ALTER TABLE bug44571 ADD INDEX bug44571b (bar);
ERROR HY000: Incorrect key file for table 'bug44571'; try to repair it
CREATE INDEX bug44571b ON bug44571 (bar);
ERROR HY000: Incorrect key file for table 'bug44571'; try to repair it
ALTER TABLE bug44571 ADD INDEX bug44571c (bar);
DROP INDEX bug44571c ON bug44571;
CREATE INDEX bug44571c ON bug44571 (bar);
DROP TABLE bug44571;
CREATE TABLE bug47621 (salesperson INT) ENGINE=InnoDB;
ALTER TABLE bug47621 CHANGE salesperson sales_acct_id INT;
create index orgs on bug47621(sales_acct_id);
ALTER TABLE bug47621 CHANGE sales_acct_id salesperson INT;
drop table bug47621;
CREATE TABLE bug47621_sale (
salesperson INT,
PRIMARY KEY(salesperson)) engine = innodb;
CREATE TABLE bug47621_shirt(
id SMALLINT,
owner INT,
FOREIGN KEY(owner)
references bug47621_sale(salesperson) ON DELETE RESTRICT)
engine = innodb;
insert into bug47621_sale values(9);
insert into bug47621_shirt values(1, 9);
ALTER TABLE bug47621_shirt CHANGE id new_id INT;
drop table bug47621_shirt;
ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT;
ALTER TABLE bug47621_sale ADD INDEX idx (sales_acct_id);
drop table bug47621_sale;
CREATE TABLE bug47622(
`rule_key` int(11) NOT NULL DEFAULT '0',
`seq` smallint(6) NOT NULL DEFAULT '0',
`action` smallint(6) NOT NULL DEFAULT '0',
`arg_id` smallint(6) DEFAULT NULL,
`else_ind` TINYINT NOT NULL,
KEY IDX_A (`arg_id`)
) ENGINE=InnoDB;
ALTER TABLE bug47622 ADD UNIQUE IDX_B (rule_key,else_ind,seq,action,arg_id);
drop index IDX_B on bug47622;
create index idx on bug47622(seq, arg_id);
ALTER TABLE bug47622 ADD UNIQUE IDX_X (rule_key,else_ind,seq,action);
drop table bug47622;
CREATE TABLE bug47622 (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
`d` varchar(20) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `b` (`b`)
) ENGINE=InnoDB;
alter table bug47622 add unique index (c), add index (d);
drop table bug47622;
CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b);
DROP TABLE bug48024,bug48024_b;
CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b)|
DROP TABLE bug48024,bug48024_b;
SET tx_isolation = 'READ-COMMITTED';
CREATE TABLE bug49164 (a INT, b BIGINT, c TINYINT, PRIMARY KEY (a, b))
ENGINE=InnoDB;
insert into bug49164 values (1,1,1), (2,2,2), (3,3,3);
begin;
update bug49164 set c=7;
select * from bug49164;
a b c
1 1 7
2 2 7
3 3 7
rollback;
select * from bug49164;
a b c
1 1 1
2 2 2
3 3 3
begin;
update bug49164 set c=7;
SET tx_isolation = 'READ-COMMITTED';
begin;
select * from bug49164;
a b c
1 1 1
2 2 2
3 3 3
commit;
begin;
update bug49164 set c=6 where a=1 and b=1;
rollback;
select * from bug49164;
a b c
1 1 1
2 2 2
3 3 3
commit;
select * from bug49164;
a b c
1 1 6
2 2 2
3 3 3
drop table bug49164;
create table bug51378 (
col1 int not null,
col2 blob not null,
col3 time not null) engine = innodb;
create unique index idx on bug51378(col1, col2(31));
alter table bug51378 add unique index idx2(col1, col2(31));
create unique index idx3 on bug51378(col1, col3);
SHOW CREATE TABLE bug51378;
Table Create Table
bug51378 CREATE TABLE `bug51378` (
`col1` int(11) NOT NULL,
`col2` blob NOT NULL,
`col3` time NOT NULL,
UNIQUE KEY `idx3` (`col1`,`col3`),
UNIQUE KEY `idx` (`col1`,`col2`(31)),
UNIQUE KEY `idx2` (`col1`,`col2`(31))
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop index idx3 on bug51378;
SHOW CREATE TABLE bug51378;
Table Create Table
bug51378 CREATE TABLE `bug51378` (
`col1` int(11) NOT NULL,
`col2` blob NOT NULL,
`col3` time NOT NULL,
UNIQUE KEY `idx` (`col1`,`col2`(31)),
UNIQUE KEY `idx2` (`col1`,`col2`(31))
) ENGINE=InnoDB DEFAULT CHARSET=latin1
alter table bug51378 add primary key idx3(col1, col2(31));
SHOW CREATE TABLE bug51378;
Table Create Table
bug51378 CREATE TABLE `bug51378` (
`col1` int(11) NOT NULL,
`col2` blob NOT NULL,
`col3` time NOT NULL,
PRIMARY KEY (`col1`,`col2`(31)),
UNIQUE KEY `idx` (`col1`,`col2`(31)),
UNIQUE KEY `idx2` (`col1`,`col2`(31))
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table bug51378;
create table bug51378 (
col1 int not null,
col2 blob not null,
col3 time not null, primary key(col1, col2(31))) engine = innodb;
create unique index idx on bug51378(col1, col2(31));
SHOW CREATE TABLE bug51378;
Table Create Table
bug51378 CREATE TABLE `bug51378` (
`col1` int(11) NOT NULL,
`col2` blob NOT NULL,
`col3` time NOT NULL,
PRIMARY KEY (`col1`,`col2`(31)),
UNIQUE KEY `idx` (`col1`,`col2`(31))
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table bug51378;
create table bug51378 (
col1 int not null,
col2 int ) engine = innodb;
create unique index idx on bug51378(col1, col2);
SHOW CREATE TABLE bug51378;
Table Create Table
bug51378 CREATE TABLE `bug51378` (
`col1` int(11) NOT NULL,
`col2` int(11) DEFAULT NULL,
UNIQUE KEY `idx` (`col1`,`col2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table bug51378;
CREATE TABLE bug51920 (i INT) ENGINE=InnoDB;
INSERT INTO bug51920 VALUES (1);
BEGIN;
SELECT * FROM bug51920 FOR UPDATE;
i
1
UPDATE bug51920 SET i=2;
SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE INFO="UPDATE bug51920 SET i=2"
INTO @thread_id;
KILL @thread_id;
Got one of the listed errors
DROP TABLE bug51920;
set session transaction isolation level read committed;
create table innodb_bug52663 (what varchar(5), id integer, count integer, primary key
(what, id)) engine=innodb;
insert into innodb_bug52663 values ('total', 0, 0);
begin;
set session transaction isolation level read committed;
begin;
update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
select * from innodb_bug52663;
what id count
total 0 1
update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from innodb_bug52663;
what id count
total 0 0
commit;
update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
commit;
select * from innodb_bug52663;
what id count
total 0 2
select * from innodb_bug52663;
what id count
total 0 2
drop table innodb_bug52663;
SET GLOBAL innodb_file_format='Barracuda';
SET GLOBAL innodb_file_per_table=on;
CREATE TABLE bug52745 (
a2 int(10) unsigned DEFAULT NULL,
col37 time DEFAULT NULL,
col38 char(229) CHARACTER SET utf8 DEFAULT NULL,
col39 text,
col40 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
col41 int(10) unsigned DEFAULT NULL,
col42 varchar(248) CHARACTER SET utf8 DEFAULT NULL,
col43 smallint(5) unsigned zerofill DEFAULT NULL,
col44 varchar(150) CHARACTER SET utf8 DEFAULT NULL,
col45 float unsigned zerofill DEFAULT NULL,
col46 binary(1) DEFAULT NULL,
col47 tinyint(4) DEFAULT NULL,
col48 tinyint(1) DEFAULT NULL,
col49 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
col50 binary(1) DEFAULT NULL,
col51 double unsigned zerofill DEFAULT NULL,
col52 int(10) unsigned DEFAULT NULL,
col53 time DEFAULT NULL,
col54 double unsigned DEFAULT NULL,
col55 time DEFAULT NULL,
col56 mediumtext CHARACTER SET latin2,
col57 blob,
col58 decimal(52,16) unsigned zerofill NOT NULL DEFAULT '000000000000000000000000000000000000.0000000000000000',
col59 binary(1) DEFAULT NULL,
col60 longblob,
col61 time DEFAULT NULL,
col62 longtext CHARACTER SET utf8 COLLATE utf8_persian_ci,
col63 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
col64 int(10) unsigned DEFAULT NULL,
col65 date DEFAULT NULL,
col66 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
col67 binary(1) DEFAULT NULL,
col68 tinyblob,
col69 date DEFAULT NULL,
col70 tinyint(3) unsigned zerofill DEFAULT NULL,
col71 varchar(44) CHARACTER SET utf8 DEFAULT NULL,
col72 datetime DEFAULT NULL,
col73 smallint(5) unsigned zerofill DEFAULT NULL,
col74 longblob,
col75 bit(34) DEFAULT NULL,
col76 float unsigned zerofill DEFAULT NULL,
col77 year(2) DEFAULT NULL,
col78 tinyint(3) unsigned DEFAULT NULL,
col79 set('msfheowh','tbpxbgf','by','wahnrjw','myqfasxz','rsokyumrt') CHARACTER SET latin2 DEFAULT NULL,
col80 datetime DEFAULT NULL,
col81 smallint(6) DEFAULT NULL,
col82 enum('xtaurnqfqz','rifrse','kuzwpbvb','niisabk','zxavro','rbvasv','','uulrfaove','','') DEFAULT NULL,
col83 bigint(20) unsigned zerofill DEFAULT NULL,
col84 float unsigned zerofill DEFAULT NULL,
col85 double DEFAULT NULL,
col86 enum('ylannv','','vlkhycqc','snke','cxifustp','xiaxaswzp','oxl') CHARACTER SET latin1 COLLATE latin1_german2_ci DEFAULT NULL,
col87 varbinary(221) DEFAULT NULL,
col88 double unsigned DEFAULT NULL,
col89 float unsigned zerofill DEFAULT NULL,
col90 tinyblob
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
Warnings:
Note 1291 Column 'col82' has duplicated value '' in ENUM
Note 1291 Column 'col82' has duplicated value '' in ENUM
INSERT INTO bug52745 SET
col40='0000-00-00 00:00:00',
col51=16547,
col53='7711484',
col54=-28604,
col55='7112612',
col56='wakefulness\'',
col57=repeat('absorbefacient\'',106),
col58=11027,
col59='AM09gW7',
col60=repeat('Noelani\'',16),
col61='2520576',
col62='substitutiv',
col63='19950106155112',
col64=-12038,
col65='86238806',
col66='19600719080256',
col68=repeat('Sagittarius\'',54),
col69='38943902',
col70=1232,
col71='Elora\'',
col74=repeat('zipp',11),
col75='0',
col76=23254,
col78=13247,
col79='56219',
col80='20500609035724',
col81=11632,
col82=7,
col84=-23863,
col85=6341,
col87='HZdkf.4 s7t,5Rmq 8so fmr,ruGLUG25TrtI.yQ 2SuHq0ML7rw7.4 b2yf2E5TJxOtBBZImezDnzpj,uPYfznnEUDN1e9aQoO 2DsplB7TFWy oQJ br HLF :F,eQ p4i1oWsr lL3PG,hjCz6hYqN h1QTjLCjrv:QCdSzpYBibJAtZCxLOk3l6Blsh.W',
col88=16894,
col89=6161,
col90=repeat('gale',48);
Warnings:
Warning 1265 Data truncated for column 'col53' at row 1
Warning 1264 Out of range value for column 'col54' at row 1
Warning 1265 Data truncated for column 'col59' at row 1
Warning 1265 Data truncated for column 'col61' at row 1
Warning 1264 Out of range value for column 'col64' at row 1
Warning 1265 Data truncated for column 'col65' at row 1
Warning 1264 Out of range value for column 'col66' at row 1
Warning 1265 Data truncated for column 'col68' at row 1
Warning 1265 Data truncated for column 'col69' at row 1
Warning 1264 Out of range value for column 'col70' at row 1
Warning 1264 Out of range value for column 'col78' at row 1
Warning 1265 Data truncated for column 'col79' at row 1
Warning 1264 Out of range value for column 'col84' at row 1
SHOW WARNINGS;
Level Code Message
Warning 1265 Data truncated for column 'col53' at row 1
Warning 1264 Out of range value for column 'col54' at row 1
Warning 1265 Data truncated for column 'col59' at row 1
Warning 1265 Data truncated for column 'col61' at row 1
Warning 1264 Out of range value for column 'col64' at row 1
Warning 1265 Data truncated for column 'col65' at row 1
Warning 1264 Out of range value for column 'col66' at row 1
Warning 1265 Data truncated for column 'col68' at row 1
Warning 1265 Data truncated for column 'col69' at row 1
Warning 1264 Out of range value for column 'col70' at row 1
Warning 1264 Out of range value for column 'col78' at row 1
Warning 1265 Data truncated for column 'col79' at row 1
Warning 1264 Out of range value for column 'col84' at row 1
DROP TABLE bug52745;
SET GLOBAL innodb_file_format=Antelope;
SET GLOBAL innodb_file_format_check=Antelope;
SET GLOBAL innodb_file_per_table=0;
create table bug53290 (x bigint) engine=innodb;
insert into bug53290 () values (),(),(),(),(),(),(),(),(),(),(),();
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
alter table bug53290 add unique index `idx` (x);
drop table bug53290;
SET GLOBAL innodb_file_format='Barracuda';
SET GLOBAL innodb_file_per_table=on;
set old_alter_table=0;
CREATE TABLE bug53591(a text charset utf8 not null)
ENGINE=InnoDB KEY_BLOCK_SIZE=1;
ALTER TABLE bug53591 ADD PRIMARY KEY(a(220));
ERROR HY000: Too big row
SHOW WARNINGS;
Level Code Message
Error 139 Too big row
Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
Error 1030 Got error 139 from storage engine
DROP TABLE bug53591;
SET GLOBAL innodb_file_format=Antelope;
SET GLOBAL innodb_file_format_check=Antelope;
SET GLOBAL innodb_file_per_table=0;
call mtr.add_suppression("InnoDB: invalid innodb_file_format_check value");
select @@innodb_file_format;
@@innodb_file_format
Antelope
......@@ -41,3 +40,4 @@ ERROR 42000: Variable 'innodb_file_format' can't be set to the value of 'off'
select @@innodb_file_format_check;
@@innodb_file_format_check
Barracuda
set global innodb_file_format_check=antelope;
......@@ -21,3 +21,46 @@ lock_table COUNT(*)
"test"."t_max" 2
"test"."t_min" 2
"test"."`t'\""_str" 10
Field Type Null Key Default Extra
trx_id varchar(18) NO
trx_state varchar(13) NO
trx_started datetime NO 0000-00-00 00:00:00
trx_requested_lock_id varchar(81) YES NULL
trx_wait_started datetime YES NULL
trx_weight bigint(21) unsigned NO 0
trx_mysql_thread_id bigint(21) unsigned NO 0
trx_query varchar(1024) YES NULL
trx_operation_state varchar(64) YES NULL
trx_tables_in_use bigint(21) unsigned NO 0
trx_tables_locked bigint(21) unsigned NO 0
trx_lock_structs bigint(21) unsigned NO 0
trx_lock_memory_bytes bigint(21) unsigned NO 0
trx_rows_locked bigint(21) unsigned NO 0
trx_rows_modified bigint(21) unsigned NO 0
trx_concurrency_tickets bigint(21) unsigned NO 0
trx_isolation_level varchar(16) NO
trx_unique_checks int(1) NO 0
trx_foreign_key_checks int(1) NO 0
trx_last_foreign_key_error varchar(256) YES NULL
trx_apative_hash_latched int(1) NO 0
trx_adaptive_hash_timeout bigint(21) unsigned NO 0
trx_operation_state varchar(64) YES NULL
trx_tables_in_use bigint(21) unsigned NO 0
trx_tables_locked bigint(21) unsigned NO 0
trx_lock_structs bigint(21) unsigned NO 0
trx_lock_memory_bytes bigint(21) unsigned NO 0
trx_rows_locked bigint(21) unsigned NO 0
trx_rows_modified bigint(21) unsigned NO 0
trx_concurrency_tickets bigint(21) unsigned NO 0
trx_isolation_level varchar(16) NO
trx_unique_checks int(1) NO 0
trx_foreign_key_checks int(1) NO 0
trx_last_foreign_key_error varchar(256) YES NULL
trx_apative_hash_latched int(1) NO 0
trx_adaptive_hash_timeout bigint(21) unsigned NO 0
trx_state trx_weight trx_tables_in_use trx_tables_locked trx_rows_locked trx_rows_modified trx_concurrency_tickets trx_isolation_level trx_unique_checks trx_foreign_key_checks
RUNNING 4 0 0 7 1 0 REPEATABLE READ 1 1
trx_isolation_level trx_unique_checks trx_foreign_key_checks
SERIALIZABLE 0 0
trx_state trx_isolation_level trx_last_foreign_key_error
RUNNING SERIALIZABLE `test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c02`) REFERENCES `t1` (`c01`)
CREATE TABLE bug38999_1 (a int not null primary key, b int not null, key (b)) engine=innodb;
CREATE TABLE bug38999_2 (a int not null primary key, b int not null, key (b)) engine=innodb;
INSERT INTO bug38999_1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
INSERT INTO bug38999_2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100;
select * from bug38999_1;
a b
101 1
102 2
103 3
104 4
105 5
106 6
107 7
108 8
109 9
110 10
111 11
112 12
update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100 where bug38999_1.a=101;
select * from bug38999_1;
a b
201 1
102 2
103 3
104 4
105 5
106 6
107 7
108 8
109 9
110 10
111 11
112 12
update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+10 where bug38999_1.b=2;
select * from bug38999_1;
a b
201 1
103 3
104 4
105 5
106 6
107 7
108 8
109 9
110 10
111 11
102 12
112 12
update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+2,bug38999_2.b=bug38999_1.b+10 where bug38999_1.b between 3 and 5 and bug38999_1.a=bug38999_2.a+100;
select * from bug38999_1;
a b
201 1
103 5
104 6
106 6
105 7
107 7
108 8
109 9
110 10
111 11
102 12
112 12
select * from bug38999_2;
a b
1 1
2 2
6 6
7 7
8 8
9 9
3 13
4 14
5 15
drop table bug38999_1,bug38999_2;
innodb-index : Bug#49396 2009-12-03 test fails in embedded mode
##############################################################################
#
# List the test cases that are to be disabled temporarily.
#
# Separate the test case name and the comment with ':'.
#
# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
#
# Do not use any TAB characters for whitespace.
#
##############################################################################
innodb_multi_update: Bug #38999 2010-05-05 mmakela Valgrind warnings
-- source include/have_innodb.inc
# embedded server ignores 'delayed', so skip this
-- source include/not_embedded.inc
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
--disable_warnings
drop table if exists t1;
--enable_warnings
#
# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from
# the index (PRIMARY)
# This test requires a restart of the server
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (null);
INSERT INTO t1 VALUES (null);
ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
SELECT * FROM t1;
# Restart the server
-- source include/restart_mysqld.inc
# The MySQL and InnoDB data dictionaries should now be out of sync.
# The select should print message to the error log
SELECT * FROM t1;
# MySQL have made a change (http://lists.mysql.com/commits/75268) that no
# longer results in the two data dictionaries being out of sync. If they
# revert their changes then this check for ER_AUTOINC_READ_FAILED will need
# to be enabled. Also, see http://bugs.mysql.com/bug.php?id=47621.
#-- error ER_AUTOINC_READ_FAILED,1467
INSERT INTO t1 VALUES(null);
ALTER TABLE t1 AUTO_INCREMENT = 3;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES(null);
SELECT * FROM t1;
DROP TABLE t1;
#
# restore environment to the state it was before this test execution
#
-- disable_query_log
eval SET GLOBAL innodb_file_format_check=$innodb_file_format_check_orig;
......@@ -2,6 +2,8 @@
# embedded server ignores 'delayed', so skip this
-- source include/not_embedded.inc
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
--disable_warnings
drop table if exists t1;
--enable_warnings
......@@ -478,28 +480,6 @@ INSERT INTO t2 SELECT c1 FROM t1;
INSERT INTO t2 SELECT NULL FROM t1;
DROP TABLE t1;
DROP TABLE t2;
#
# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from
# the index (PRIMARY)
# This test requires a restart of the server
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (null);
INSERT INTO t1 VALUES (null);
ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
SELECT * FROM t1;
# Restart the server
-- source include/restart_mysqld.inc
# The MySQL and InnoDB data dictionaries should now be out of sync.
# The select should print message to the error log
SELECT * FROM t1;
-- error ER_AUTOINC_READ_FAILED,1467
INSERT INTO t1 VALUES(null);
ALTER TABLE t1 AUTO_INCREMENT = 3;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES(null);
SELECT * FROM t1;
DROP TABLE t1;
# If the user has specified negative values for an AUTOINC column then
# InnoDB should ignore those values when setting the table's max value.
......@@ -610,9 +590,85 @@ DROP TABLE t1;
# 47125: auto_increment start value is ignored if an index is created
# and engine=innodb
#
CREATE TABLE T1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
CREATE INDEX i1 on T1(c2);
SHOW CREATE TABLE T1;
INSERT INTO T1 (c2) values (0);
SELECT * FROM T1;
DROP TABLE T1;
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
CREATE INDEX i1 on t1(c2);
SHOW CREATE TABLE t1;
INSERT INTO t1 (c2) values (0);
SELECT * FROM t1;
DROP TABLE t1;
##
# 49032: Use the correct function to read the AUTOINC column value
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(C1 DOUBLE AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
# Restart the server
-- source include/restart_mysqld.inc
INSERT INTO t1(C2) VALUES ('innodb');
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1(C1 FLOAT AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
# Restart the server
-- source include/restart_mysqld.inc
INSERT INTO t1(C2) VALUES ('innodb');
SHOW CREATE TABLE t1;
DROP TABLE t1;
##
# 47720: REPLACE INTO Autoincrement column with negative values
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 SET c1 = 1;
SHOW CREATE TABLE t1;
INSERT INTO t1 SET c1 = 2;
INSERT INTO t1 SET c1 = -1;
SELECT * FROM t1;
-- error ER_DUP_ENTRY,1062
INSERT INTO t1 SET c1 = -1;
SHOW CREATE TABLE t1;
REPLACE INTO t1 VALUES (-1);
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
##
# 49497: Error 1467 (ER_AUTOINC_READ_FAILED) on inserting a negative value
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL);
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL);
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL);
INSERT INTO t1 VALUES (4), (5), (6), (NULL);
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5);
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL);
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
#
# restore environment to the state it was before this test execution
#
-- disable_query_log
eval SET GLOBAL innodb_file_format_check=$innodb_file_format_check_orig;
-- source include/not_embedded.inc
-- source include/have_innodb.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
# REPLACE INTO ... SELECT and INSERT INTO ... SELECT should do
# a consistent read of the source table.
connect (a,localhost,root,,);
connect (b,localhost,root,,);
connection a;
set session transaction isolation level read committed;
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
create table t2 like t1;
insert into t2 values (1),(2),(3),(4),(5),(6),(7);
set autocommit=0;
# REPLACE INTO ... SELECT case
begin;
# this should not result in any locks on t2.
replace into t1 select * from t2;
connection b;
set session transaction isolation level read committed;
set autocommit=0;
# should not cuase a lock wait.
delete from t2 where a=5;
commit;
delete from t2;
commit;
connection a;
commit;
# INSERT INTO ... SELECT case
begin;
# this should not result in any locks on t2.
insert into t1 select * from t2;
connection b;
set session transaction isolation level read committed;
set autocommit=0;
# should not cuase a lock wait.
delete from t2 where a=5;
commit;
delete from t2;
commit;
connection a;
commit;
select * from t1;
drop table t1;
drop table t2;
connection default;
disconnect a;
disconnect b;
-- source include/not_embedded.inc
-- source include/have_innodb.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
# REPLACE INTO ... SELECT and INSERT INTO ... SELECT should do
# a consistent read of the source table.
connect (a,localhost,root,,);
connect (b,localhost,root,,);
connection a;
set session transaction isolation level read committed;
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
create table t2 like t1;
insert into t2 values (1),(2),(3),(4),(5),(6),(7);
set autocommit=0;
# REPLACE INTO ... SELECT case
begin;
# this should not result in any locks on t2.
replace into t1 select * from t2;
connection b;
set session transaction isolation level read committed;
set autocommit=0;
# should not cause a lock wait.
delete from t2 where a=5;
commit;
delete from t2;
commit;
connection a;
commit;
# INSERT INTO ... SELECT case
begin;
# this should not result in any locks on t2.
insert into t1 select * from t2;
connection b;
set session transaction isolation level read committed;
set autocommit=0;
# should not cause a lock wait.
delete from t2 where a=5;
commit;
delete from t2;
commit;
connection a;
commit;
select * from t1;
drop table t1;
drop table t2;
connection default;
disconnect a;
disconnect b;
-- source include/have_innodb.inc
let $MYSQLD_DATADIR= `select @@datadir`;
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
create table t1(a int not null, b int, c char(10) not null, d varchar(20)) engine = innodb;
......@@ -19,16 +21,6 @@ show create table t1;
alter table t1 add index (b);
show create table t1;
# Check how existing tables interfere with temporary tables.
CREATE TABLE `t1#1`(a INT PRIMARY KEY) ENGINE=InnoDB;
--error 156
alter table t1 add unique index (c), add index (d);
rename table `t1#1` to `t1#2`;
--error 156
alter table t1 add unique index (c), add index (d);
drop table `t1#2`;
alter table t1 add unique index (c), add index (d);
show create table t1;
explain select * from t1 force index(c) order by c;
......@@ -139,6 +131,8 @@ show create table t4;
--error ER_CANT_CREATE_TABLE
alter table t3 add constraint dc foreign key (a) references t1(a);
show create table t3;
# this should be fixed by MySQL (see Bug #51451)
--error ER_WRONG_NAME_FOR_INDEX
alter table t2 drop index b, add index (b);
show create table t2;
--error ER_ROW_IS_REFERENCED_2
......@@ -146,7 +140,9 @@ delete from t1;
--error ER_CANT_DROP_FIELD_OR_KEY
drop index dc on t4;
# there is no foreign key dc on t3
--replace_regex /'\.\/test\/#sql2-[0-9a-f-]*'/'#sql2-temporary'/
--replace_regex /'[^']*test\/#sql2-[0-9a-f-]*'/'#sql2-temporary'/
# Embedded server doesn't chdir to data directory
--replace_result $MYSQLD_DATADIR ./ master-data/ ''
--error ER_ERROR_ON_RENAME
alter table t3 drop foreign key dc;
alter table t4 drop foreign key dc;
......@@ -157,7 +153,7 @@ select * from t2;
drop table t2,t4,t3,t1;
-- let charset = utf8
-- source suite/innodb/include/innodb-index.inc
-- source include/innodb-index.inc
create table t1(a int not null, b int) engine = innodb;
insert into t1 values (1,1),(1,1),(1,1),(1,1);
......@@ -292,66 +288,73 @@ show create table t1;
check table t1;
explain select * from t1 where b like 'adfd%';
# The following tests are disabled because of the introduced timeouts for
# metadata locks at the MySQL level as part of the fix for
# Bug#45225 Locking: hang if drop table with no timeout
# The following commands now play with MySQL metadata locks instead of
# InnoDB locks
# start disabled45225_1
##
## Test locking
##
#
# Test locking
#create table t2(a int, b varchar(255), primary key(a,b)) engine=innodb;
#insert into t2 select a,left(b,255) from t1;
#drop table t1;
#rename table t2 to t1;
#
create table t2(a int, b varchar(255), primary key(a,b)) engine=innodb;
insert into t2 select a,left(b,255) from t1;
drop table t1;
rename table t2 to t1;
connect (a,localhost,root,,);
connect (b,localhost,root,,);
connection a;
set innodb_lock_wait_timeout=1;
begin;
# Obtain an IX lock on the table
select a from t1 limit 1 for update;
connection b;
set innodb_lock_wait_timeout=1;
# This would require an S lock on the table, conflicting with the IX lock.
--error ER_LOCK_WAIT_TIMEOUT
create index t1ba on t1 (b,a);
connection a;
commit;
begin;
# Obtain an IS lock on the table
select a from t1 limit 1 lock in share mode;
connection b;
# This will require an S lock on the table. No conflict with the IS lock.
create index t1ba on t1 (b,a);
# This would require an X lock on the table, conflicting with the IS lock.
--error ER_LOCK_WAIT_TIMEOUT
drop index t1ba on t1;
connection a;
commit;
explain select a from t1 order by b;
--send
select a,sleep(2+a/100) from t1 order by b limit 3;
# The following DROP INDEX will succeed, altough the SELECT above has
# opened a read view. However, during the execution of the SELECT,
# MySQL should hold a table lock that should block the execution
# of the DROP INDEX below.
connection b;
select sleep(1);
drop index t1ba on t1;
# After the index was dropped, subsequent SELECTs will use the same
# read view, but they should not be accessing the dropped index any more.
connection a;
reap;
explain select a from t1 order by b;
select a from t1 order by b limit 3;
commit;
connection default;
disconnect a;
disconnect b;
#connect (a,localhost,root,,);
#connect (b,localhost,root,,);
#connection a;
#set innodb_lock_wait_timeout=1;
#begin;
## Obtain an IX lock on the table
#select a from t1 limit 1 for update;
#connection b;
#set innodb_lock_wait_timeout=1;
## This would require an S lock on the table, conflicting with the IX lock.
#--error ER_LOCK_WAIT_TIMEOUT
#create index t1ba on t1 (b,a);
#connection a;
#commit;
#begin;
## Obtain an IS lock on the table
#select a from t1 limit 1 lock in share mode;
#connection b;
## This will require an S lock on the table. No conflict with the IS lock.
#create index t1ba on t1 (b,a);
## This would require an X lock on the table, conflicting with the IS lock.
#--error ER_LOCK_WAIT_TIMEOUT
#drop index t1ba on t1;
#connection a;
#commit;
#explain select a from t1 order by b;
#--send
#select a,sleep(2+a/100) from t1 order by b limit 3;
#
## The following DROP INDEX will succeed, altough the SELECT above has
## opened a read view. However, during the execution of the SELECT,
## MySQL should hold a table lock that should block the execution
## of the DROP INDEX below.
#
#connection b;
#select sleep(1);
#drop index t1ba on t1;
#
## After the index was dropped, subsequent SELECTs will use the same
## read view, but they should not be accessing the dropped index any more.
#
#connection a;
#reap;
#explain select a from t1 order by b;
#select a from t1 order by b limit 3;
#commit;
#
#connection default;
#disconnect a;
#disconnect b;
#
# end disabled45225_1
drop table t1;
let $per_table=`select @@innodb_file_per_table`;
......@@ -513,28 +516,34 @@ SHOW CREATE TABLE t2;
DROP TABLE t2;
DROP TABLE t1;
connect (a,localhost,root,,);
connect (b,localhost,root,,);
connection a;
CREATE TABLE t1 (a INT, b CHAR(1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (3,'a'),(3,'b'),(1,'c'),(0,'d'),(1,'e');
connection b;
BEGIN;
SELECT * FROM t1;
connection a;
CREATE INDEX t1a ON t1(a);
connection b;
SELECT * FROM t1;
--error ER_TABLE_DEF_CHANGED
SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
SELECT * FROM t1;
COMMIT;
SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
connection default;
disconnect a;
disconnect b;
DROP TABLE t1;
# The following tests are disabled because of the introduced timeouts for
# metadata locks at the MySQL level as part of the fix for
# Bug#45225 Locking: hang if drop table with no timeout
# The following CREATE INDEX t1a ON t1(a); causes a lock wait timeout
# start disabled45225_2
#connect (a,localhost,root,,);
#connect (b,localhost,root,,);
#connection a;
#CREATE TABLE t1 (a INT, b CHAR(1)) ENGINE=InnoDB;
#INSERT INTO t1 VALUES (3,'a'),(3,'b'),(1,'c'),(0,'d'),(1,'e');
#connection b;
#BEGIN;
#SELECT * FROM t1;
#connection a;
#CREATE INDEX t1a ON t1(a);
#connection b;
#SELECT * FROM t1;
#--error ER_TABLE_DEF_CHANGED
#SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
#SELECT * FROM t1;
#COMMIT;
#SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
#connection default;
#disconnect a;
#disconnect b;
#
#DROP TABLE t1;
# end disabled45225_2
#
# restore environment to the state it was before this test execution
......
......@@ -2,4 +2,4 @@
-- source include/have_ucs2.inc
-- let charset = ucs2
-- source suite/innodb/include/innodb-index.inc
-- source include/innodb-index.inc
# This is the test for Information Schema System Table View
# that displays the InnoDB system table content through
# information schema tables.
--source include/have_innodb.inc
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS;
# Create a foreign key constraint, and verify the information
# in INFORMATION_SCHEMA.INNODB_SYS_FOREIGN and
# INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS
CREATE TABLE parent (id INT NOT NULL,
PRIMARY KEY (id)) ENGINE=INNODB;
CREATE TABLE child (id INT, parent_id INT,
INDEX par_ind (parent_id),
CONSTRAINT constraint_test
FOREIGN KEY (parent_id) REFERENCES parent(id)
ON DELETE CASCADE) ENGINE=INNODB;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
# Insert a row in the table "parent", and see whether that reflected in
# INNODB_SYS_TABLESTATS
INSERT INTO parent VALUES(1);
SELECT name, num_rows, mysql_handles_opened
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name LIKE "%parent";
SELECT NAME, FLAG, N_COLS, SPACE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES;
SELECT name, n_fields
from INFORMATION_SCHEMA.INNODB_SYS_INDEXES
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%parent%");
SELECT name, n_fields
from INFORMATION_SCHEMA.INNODB_SYS_INDEXES
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%child%");
SELECT name, pos, mtype, len
from INFORMATION_SCHEMA.INNODB_SYS_COLUMNS
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%child%");
DROP TABLE child;
DROP TABLE parent;
# Create table with 2 columns in the foreign key constraint
CREATE TABLE parent (id INT NOT NULL, newid INT NOT NULL,
PRIMARY KEY (id, newid)) ENGINE=INNODB;
CREATE TABLE child (id INT, parent_id INT,
INDEX par_ind (parent_id),
CONSTRAINT constraint_test
FOREIGN KEY (id, parent_id) REFERENCES parent(id, newid)
ON DELETE CASCADE) ENGINE=INNODB;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
INSERT INTO parent VALUES(1, 9);
# Nested query will open the table handle twice
SELECT * FROM parent WHERE id IN (SELECT id FROM parent);
SELECT name, num_rows, mysql_handles_opened
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name LIKE "%parent";
DROP TABLE child;
DROP TABLE parent;
--loose-innodb-use-sys-malloc=true
--loose-innodb-use-sys-malloc=true
--innodb-use-sys-malloc=true
......@@ -85,7 +85,8 @@ SELECT table_schema, table_name, row_format
FROM information_schema.tables WHERE engine='innodb';
drop table t1,t2;
# The following should fail even in non-strict mode.
# The following should fail in non-strict mode too.
# (The fix of Bug #50945 only affects REDUNDANT and COMPACT tables.)
SET SESSION innodb_strict_mode = off;
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1(
......
......@@ -24,6 +24,7 @@ SET GLOBAL innodb_file_per_table=ON;
# Generating 10 tables
# Creating a table with 94 columns and 24 indexes
DROP TABLE IF EXISTS `table0`;
set innodb_strict_mode=on;
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE IF NOT EXISTS `table0`
(`col0` BOOL,
......
......@@ -5,65 +5,90 @@
-- source include/have_innodb.inc
# skip this test in embedded mode because "TRUNCATE TABLE bug38231_1"
# hangs in that mode waiting for "lock_wait_timeout" although it is
# preceded by --send
-- source include/not_embedded.inc
SET storage_engine=InnoDB;
# we care only that the following SQL commands do not crash the server
-- disable_query_log
-- disable_result_log
DROP TABLE IF EXISTS bug38231;
CREATE TABLE bug38231 (a INT);
DROP TABLE IF EXISTS bug38231_1;
CREATE TABLE bug38231_1 (a INT);
-- connect (con1,localhost,root,,)
-- connect (con2,localhost,root,,)
-- connect (lock_gain,localhost,root,,)
-- connect (lock_wait1,localhost,root,,)
-- connect (lock_wait2,localhost,root,,)
-- connect (truncate_wait,localhost,root,,)
-- connection con1
-- connection lock_gain
SET autocommit=0;
LOCK TABLE bug38231 WRITE;
LOCK TABLE bug38231_1 WRITE;
-- connection con2
-- connection lock_wait1
SET autocommit=0;
-- send
LOCK TABLE bug38231 WRITE;
LOCK TABLE bug38231_1 WRITE;
-- connection default
-- connection lock_wait2
SET autocommit=0;
-- send
TRUNCATE TABLE bug38231;
LOCK TABLE bug38231_1 WRITE;
-- connection con1
# give time to TRUNCATE and others to be executed; without sleep, sometimes
# UNLOCK executes before TRUNCATE
# TODO: Replace with wait_condition once possible under embedded server.
-- sleep 0.2
-- connection truncate_wait
-- send
TRUNCATE TABLE bug38231_1;
-- connection lock_gain
# this crashes the server if the bug is present
UNLOCK TABLES;
# clean up
-- connection con2
-- reap
UNLOCK TABLES;
# do not clean up - we do not know which of the three has been released
# so the --reap command may hang because the command that is being executed
# in that connection is still running/waiting
#-- connection lock_wait1
#-- reap
#UNLOCK TABLES;
#
#-- connection lock_wait2
#-- reap
#UNLOCK TABLES;
#
#-- connection truncate_wait
#-- reap
-- connection default
-- reap
-- disconnect con1
-- disconnect con2
# test that TRUNCATE works with with row-level locks
-- disconnect lock_gain
-- disconnect lock_wait1
-- disconnect lock_wait2
-- disconnect truncate_wait
DROP TABLE bug38231_1;
# test that TRUNCATE works with row-level locks
DROP TABLE IF EXISTS bug38231_2;
CREATE TABLE bug38231_2 (a INT);
-- enable_query_log
-- enable_result_log
INSERT INTO bug38231 VALUES (1), (10), (300);
INSERT INTO bug38231_2 VALUES (1), (10), (300);
-- connect (con4,localhost,root,,)
-- connection con4
SET autocommit=0;
SELECT * FROM bug38231 FOR UPDATE;
SELECT * FROM bug38231_2 FOR UPDATE;
-- connection default
TRUNCATE TABLE bug38231;
TRUNCATE TABLE bug38231_2;
-- connection con4
COMMIT;
......@@ -72,4 +97,4 @@ COMMIT;
-- disconnect con4
DROP TABLE bug38231;
DROP TABLE bug38231_2;
#
# Bug#39438 Testcase for Bug#39436 crashes on 5.1 in fil_space_get_latch
# http://bugs.mysql.com/39438
#
# This test must be run with innodb_file_per_table=1 because the crash
# only occurs if that option is turned on and DISCARD TABLESPACE only
# works with innodb_file_per_table.
#
-- source include/have_innodb.inc
SET storage_engine=InnoDB;
# we care only that the following SQL commands do not crash the server
-- disable_query_log
-- disable_result_log
DROP TABLE IF EXISTS bug39438;
CREATE TABLE bug39438 (id INT) ENGINE=INNODB;
# remove: XXX Uncomment the following ALTER and remove those lines after
# remove: applying the patch.
# remove: Obviously this test is useless without this ALTER command,
# remove: but it causes warnings to be printed by mysqld and the whole
# remove: mysql-test suite fails at the end (returns non-zero). Please
# remove: apply this patch to the mysql source tree, remove those lines
# remove: and uncomment the following ALTER. We do not care about the
# remove: warnings, this test is to ensure mysqld does not crash.
# remove: === modified file 'mysql-test/lib/mtr_report.pl'
# remove: --- mysql-test/lib/mtr_report.pl 2008-08-12 10:26:23 +0000
# remove: +++ mysql-test/lib/mtr_report.pl 2008-10-01 11:57:41 +0000
# remove: @@ -412,7 +412,10 @@
# remove:
# remove: # When trying to set lower_case_table_names = 2
# remove: # on a case sensitive file system. Bug#37402.
# remove: - /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./
# remove: + /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./ or
# remove: +
# remove: + # this test is expected to print warnings
# remove: + ($testname eq 'main.innodb_bug39438')
# remove: )
# remove: {
# remove: next; # Skip these lines
# remove:
#ALTER TABLE bug39438 DISCARD TABLESPACE;
# this crashes the server if the bug is present
SHOW TABLE STATUS;
DROP TABLE bug39438;
#
# Bug#44571 InnoDB Plugin crashes on ADD INDEX
# http://bugs.mysql.com/44571
# Please also refer to related fix in
# http://bugs.mysql.com/47621
#
-- source include/have_innodb.inc
CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB;
ALTER TABLE bug44571 CHANGE foo bar INT;
# Create index with the old column name will fail,
# because the CHANGE foo bar is successful. And
# the column name change would communicate to
# InnoDB with the fix from bug #47621
-- error ER_KEY_COLUMN_DOES_NOT_EXITS
ALTER TABLE bug44571 ADD INDEX bug44571b (foo);
# The following will fail, because the CHANGE foo bar was
# not communicated to InnoDB.
--error ER_NOT_KEYFILE
ALTER TABLE bug44571 ADD INDEX bug44571b (bar);
--error ER_NOT_KEYFILE
CREATE INDEX bug44571b ON bug44571 (bar);
# The following create indexes should succeed,
# indirectly confirm the CHANGE foo bar is successful.
ALTER TABLE bug44571 ADD INDEX bug44571c (bar);
DROP INDEX bug44571c ON bug44571;
CREATE INDEX bug44571c ON bug44571 (bar);
DROP TABLE bug44571;
# This is the test for bug #47621, column rename operation should
# not result in column definition inconsistency between MySQL and
# InnoDB
--source include/have_innodb.inc
CREATE TABLE bug47621 (salesperson INT) ENGINE=InnoDB;
# Change the column name
ALTER TABLE bug47621 CHANGE salesperson sales_acct_id INT;
# If there is inconsistency of column name definition
# in MySQL or InnoDB, following create index would fail
create index orgs on bug47621(sales_acct_id);
# Change the column name back with the index defined on it.
ALTER TABLE bug47621 CHANGE sales_acct_id salesperson INT;
drop table bug47621;
CREATE TABLE bug47621_sale (
salesperson INT,
PRIMARY KEY(salesperson)) engine = innodb;
CREATE TABLE bug47621_shirt(
id SMALLINT,
owner INT,
FOREIGN KEY(owner)
references bug47621_sale(salesperson) ON DELETE RESTRICT)
engine = innodb;
insert into bug47621_sale values(9);
insert into bug47621_shirt values(1, 9);
# Any rename operation on columns involved in a reference constraint will
# fail, as it will be rejected by InnoDB row_rename_table_for_mysql().
# In above example, any rename on column "salesperson" for table
# "bug47621_sale", or on column "owner" for table "bug47621_shirt will
# be blocked. We do not put such rename in the test since InnoDB error
# message will be printed in the error log, and result in test failure.
#
# ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT;
# Any rename on columns not involved in the foreign key constraint
# could still proceed
ALTER TABLE bug47621_shirt CHANGE id new_id INT;
# Referencing table dropped, the rename operation on related columns
# could proceed
drop table bug47621_shirt;
ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT;
ALTER TABLE bug47621_sale ADD INDEX idx (sales_acct_id);
drop table bug47621_sale;
# This is the test for bug 47622. There could be index
# metadata sequence mismatch between MySQL and Innodb
# after creating index through FIC interfaces.
# We resolve the problem by sync the index sequence
# up when opening the table.
--source include/have_innodb.inc
connect (a,localhost,root,,);
connect (b,localhost,root,,);
# Create a table with a non-unique index
CREATE TABLE bug47622(
`rule_key` int(11) NOT NULL DEFAULT '0',
`seq` smallint(6) NOT NULL DEFAULT '0',
`action` smallint(6) NOT NULL DEFAULT '0',
`arg_id` smallint(6) DEFAULT NULL,
`else_ind` TINYINT NOT NULL,
KEY IDX_A (`arg_id`)
) ENGINE=InnoDB;
connection a;
# A subsequent creating unique index should not trigger
# any error message. Unique index would be ranked ahead
# of regular index.
ALTER TABLE bug47622 ADD UNIQUE IDX_B (rule_key,else_ind,seq,action,arg_id);
drop index IDX_B on bug47622;
# In another connection, create additional set of normal
# index and unique index. Again, unique index would be ranked
# ahead of regular index.
connection b;
create index idx on bug47622(seq, arg_id);
ALTER TABLE bug47622 ADD UNIQUE IDX_X (rule_key,else_ind,seq,action);
drop table bug47622;
# Create a table with one Primary key and a non-unique key
CREATE TABLE bug47622 (
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` char(10) DEFAULT NULL,
`d` varchar(20) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `b` (`b`)
) ENGINE=InnoDB;
# Add two index with one unique and one non-unique.
# Index sequence is "PRIMARY", "c", "b" and "d"
alter table bug47622 add unique index (c), add index (d);
drop table bug47622;
# Bug #48024 Innodb doesn't work with multi-statements
--source include/have_innodb.inc
CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
# Bug #53644 InnoDB thinks that /*/ starts and ends a comment
ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b);
DROP TABLE bug48024,bug48024_b;
# Work around Bug #53750 (failure in mysql-test-run --ps-protocol)
-- disable_ps_protocol
delimiter |;
CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b)|
delimiter ;|
DROP TABLE bug48024,bug48024_b;
-- source include/have_innodb.inc
# Bug #49164 READ-COMMITTED reports "matched: 0" on compound PK
# a duplicate of
# Bug #52663 Lost update incrementing column value under READ COMMITTED
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
SET tx_isolation = 'READ-COMMITTED';
CREATE TABLE bug49164 (a INT, b BIGINT, c TINYINT, PRIMARY KEY (a, b))
ENGINE=InnoDB;
insert into bug49164 values (1,1,1), (2,2,2), (3,3,3);
begin;
update bug49164 set c=7;
select * from bug49164;
rollback;
select * from bug49164;
begin;
update bug49164 set c=7;
connection con2;
SET tx_isolation = 'READ-COMMITTED';
begin;
select * from bug49164;
commit;
begin;
--send
update bug49164 set c=6 where a=1 and b=1;
connection con1;
rollback;
select * from bug49164;
connection con2;
reap;
commit;
connection con1;
select * from bug49164;
connection default;
disconnect con1;
disconnect con2;
drop table bug49164;
# This is the test for bug 51378. Unique index created
# through "create index" and "alter table add unique index"
# interfaces should not be treated as primary index if indexed
# columns contain one or more column prefix(es) (only prefix/part of
# the column is indexed)
# On the other hand, if there is a unique index covers all
# columns of a table, and they are non-null columns, and
# full length of the column are indexed, then this index
# will be created as primary index
# Following queries test various scenario, no mismatch
# error message should be printed.
--source include/have_innodb.inc
# Create a table contains a BLOB column
create table bug51378 (
col1 int not null,
col2 blob not null,
col3 time not null) engine = innodb;
# Create following unique indexes on 'col1' and 'col2(31)'
# of the table, the index should not be treated as primary
# key because it indexes only first 31 bytes of col2.
# Thus it contains "column prefix", and will not be
# upgraded to primary index.
# There should not be mismatch message printed in the
# errorlog
create unique index idx on bug51378(col1, col2(31));
alter table bug51378 add unique index idx2(col1, col2(31));
# Unique index on 'col1' and 'col3' will be created as primary index,
# since the index does not contain column prefix
create unique index idx3 on bug51378(col1, col3);
# Show create table would show idx3 created as unique index, internally,
# idx3 is treated as primary index both by MySQL and Innodb
SHOW CREATE TABLE bug51378;
# "GEN_CLUST_INDEX" will be re-created as default primary index
# after idx3 is dropped
drop index idx3 on bug51378;
SHOW CREATE TABLE bug51378;
# Or we can add the primary key through alter table interfaces
alter table bug51378 add primary key idx3(col1, col2(31));
SHOW CREATE TABLE bug51378;
drop table bug51378;
# Or we can create such primary key through create table interfaces
create table bug51378 (
col1 int not null,
col2 blob not null,
col3 time not null, primary key(col1, col2(31))) engine = innodb;
# Unique index on one or more column prefix(es) will be created
# as non-cluster index
create unique index idx on bug51378(col1, col2(31));
SHOW CREATE TABLE bug51378;
drop table bug51378;
# If a table has a NULLABLE column, unique index on it will not
# be treated as primary index.
create table bug51378 (
col1 int not null,
col2 int ) engine = innodb;
# This will be created as non-cluster index since col2 is nullable
create unique index idx on bug51378(col1, col2);
SHOW CREATE TABLE bug51378;
drop table bug51378;
#
# Bug #51920: InnoDB connections in lock wait ignore KILL until timeout
#
-- source include/not_embedded.inc
-- source include/have_innodb.inc
CREATE TABLE bug51920 (i INT) ENGINE=InnoDB;
INSERT INTO bug51920 VALUES (1);
BEGIN;
SELECT * FROM bug51920 FOR UPDATE;
connect (con1,localhost,root,,);
connection con1;
--send
UPDATE bug51920 SET i=2;
connection default;
let $wait_condition =
SELECT COUNT(*)=1 FROM information_schema.processlist
WHERE INFO="UPDATE bug51920 SET i=2";
-- source include/wait_condition.inc
SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE INFO="UPDATE bug51920 SET i=2"
INTO @thread_id;
KILL @thread_id;
let $wait_condition =
SELECT COUNT(*)=0 FROM information_schema.processlist WHERE ID=@thread_id;
-- source include/wait_condition.inc
#
# Bug#19723: kill of active connection yields different error code
# depending on platform.
#
connection con1;
-- error 1317, 2006, 2013
reap;
connection default;
DROP TABLE bug51920;
-- disconnect con1
--source include/have_innodb.inc
set session transaction isolation level read committed;
create table innodb_bug52663 (what varchar(5), id integer, count integer, primary key
(what, id)) engine=innodb;
insert into innodb_bug52663 values ('total', 0, 0);
begin;
connect (addconroot, localhost, root,,);
connection addconroot;
set session transaction isolation level read committed;
begin;
connection default;
update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
select * from innodb_bug52663;
connection addconroot;
--error ER_LOCK_WAIT_TIMEOUT
update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
select * from innodb_bug52663;
connection default;
commit;
connection addconroot;
update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
commit;
select * from innodb_bug52663;
connection default;
select * from innodb_bug52663;
drop table innodb_bug52663;
-- source include/have_innodb.inc
let $file_format=`select @@innodb_file_format`;
let $file_format_check=`select @@innodb_file_format_check`;
let $file_per_table=`select @@innodb_file_per_table`;
SET GLOBAL innodb_file_format='Barracuda';
SET GLOBAL innodb_file_per_table=on;
CREATE TABLE bug52745 (
a2 int(10) unsigned DEFAULT NULL,
col37 time DEFAULT NULL,
col38 char(229) CHARACTER SET utf8 DEFAULT NULL,
col39 text,
col40 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
col41 int(10) unsigned DEFAULT NULL,
col42 varchar(248) CHARACTER SET utf8 DEFAULT NULL,
col43 smallint(5) unsigned zerofill DEFAULT NULL,
col44 varchar(150) CHARACTER SET utf8 DEFAULT NULL,
col45 float unsigned zerofill DEFAULT NULL,
col46 binary(1) DEFAULT NULL,
col47 tinyint(4) DEFAULT NULL,
col48 tinyint(1) DEFAULT NULL,
col49 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
col50 binary(1) DEFAULT NULL,
col51 double unsigned zerofill DEFAULT NULL,
col52 int(10) unsigned DEFAULT NULL,
col53 time DEFAULT NULL,
col54 double unsigned DEFAULT NULL,
col55 time DEFAULT NULL,
col56 mediumtext CHARACTER SET latin2,
col57 blob,
col58 decimal(52,16) unsigned zerofill NOT NULL DEFAULT '000000000000000000000000000000000000.0000000000000000',
col59 binary(1) DEFAULT NULL,
col60 longblob,
col61 time DEFAULT NULL,
col62 longtext CHARACTER SET utf8 COLLATE utf8_persian_ci,
col63 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
col64 int(10) unsigned DEFAULT NULL,
col65 date DEFAULT NULL,
col66 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
col67 binary(1) DEFAULT NULL,
col68 tinyblob,
col69 date DEFAULT NULL,
col70 tinyint(3) unsigned zerofill DEFAULT NULL,
col71 varchar(44) CHARACTER SET utf8 DEFAULT NULL,
col72 datetime DEFAULT NULL,
col73 smallint(5) unsigned zerofill DEFAULT NULL,
col74 longblob,
col75 bit(34) DEFAULT NULL,
col76 float unsigned zerofill DEFAULT NULL,
col77 year(2) DEFAULT NULL,
col78 tinyint(3) unsigned DEFAULT NULL,
col79 set('msfheowh','tbpxbgf','by','wahnrjw','myqfasxz','rsokyumrt') CHARACTER SET latin2 DEFAULT NULL,
col80 datetime DEFAULT NULL,
col81 smallint(6) DEFAULT NULL,
col82 enum('xtaurnqfqz','rifrse','kuzwpbvb','niisabk','zxavro','rbvasv','','uulrfaove','','') DEFAULT NULL,
col83 bigint(20) unsigned zerofill DEFAULT NULL,
col84 float unsigned zerofill DEFAULT NULL,
col85 double DEFAULT NULL,
col86 enum('ylannv','','vlkhycqc','snke','cxifustp','xiaxaswzp','oxl') CHARACTER SET latin1 COLLATE latin1_german2_ci DEFAULT NULL,
col87 varbinary(221) DEFAULT NULL,
col88 double unsigned DEFAULT NULL,
col89 float unsigned zerofill DEFAULT NULL,
col90 tinyblob
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
INSERT INTO bug52745 SET
col40='0000-00-00 00:00:00',
col51=16547,
col53='7711484',
col54=-28604,
col55='7112612',
col56='wakefulness\'',
col57=repeat('absorbefacient\'',106),
col58=11027,
col59='AM09gW7',
col60=repeat('Noelani\'',16),
col61='2520576',
col62='substitutiv',
col63='19950106155112',
col64=-12038,
col65='86238806',
col66='19600719080256',
col68=repeat('Sagittarius\'',54),
col69='38943902',
col70=1232,
col71='Elora\'',
col74=repeat('zipp',11),
col75='0',
col76=23254,
col78=13247,
col79='56219',
col80='20500609035724',
col81=11632,
col82=7,
col84=-23863,
col85=6341,
col87='HZdkf.4 s7t,5Rmq 8so fmr,ruGLUG25TrtI.yQ 2SuHq0ML7rw7.4 b2yf2E5TJxOtBBZImezDnzpj,uPYfznnEUDN1e9aQoO 2DsplB7TFWy oQJ br HLF :F,eQ p4i1oWsr lL3PG,hjCz6hYqN h1QTjLCjrv:QCdSzpYBibJAtZCxLOk3l6Blsh.W',
col88=16894,
col89=6161,
col90=repeat('gale',48);
SHOW WARNINGS;
DROP TABLE bug52745;
EVAL SET GLOBAL innodb_file_format=$file_format;
EVAL SET GLOBAL innodb_file_format_check=$file_format_check;
EVAL SET GLOBAL innodb_file_per_table=$file_per_table;
-- source include/have_innodb.inc
create table bug53290 (x bigint) engine=innodb;
insert into bug53290 () values (),(),(),(),(),(),(),(),(),(),(),();
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
insert into bug53290 select * from bug53290;
alter table bug53290 add unique index `idx` (x);
drop table bug53290;
-- source include/have_innodb.inc
let $file_format=`select @@innodb_file_format`;
let $file_format_check=`select @@innodb_file_format_check`;
let $file_per_table=`select @@innodb_file_per_table`;
SET GLOBAL innodb_file_format='Barracuda';
SET GLOBAL innodb_file_per_table=on;
set old_alter_table=0;
CREATE TABLE bug53591(a text charset utf8 not null)
ENGINE=InnoDB KEY_BLOCK_SIZE=1;
-- error 139
ALTER TABLE bug53591 ADD PRIMARY KEY(a(220));
SHOW WARNINGS;
DROP TABLE bug53591;
EVAL SET GLOBAL innodb_file_format=$file_format;
EVAL SET GLOBAL innodb_file_format_check=$file_format_check;
EVAL SET GLOBAL innodb_file_per_table=$file_per_table;
-- source include/have_innodb.inc
call mtr.add_suppression("InnoDB: invalid innodb_file_format_check value");
let $format=`select @@innodb_file_format`;
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
select @@innodb_file_format;
select @@innodb_file_format_check;
set global innodb_file_format=antelope;
......@@ -31,12 +26,4 @@ set global innodb_file_format=on;
--error ER_WRONG_VALUE_FOR_VAR
set global innodb_file_format=off;
select @@innodb_file_format_check;
#
# restore environment to the state it was before this test execution
#
-- disable_query_log
eval set global innodb_file_format=$format;
eval set global innodb_file_format_check=$innodb_file_format_check_orig;
-- enable_query_log
set global innodb_file_format_check=antelope;
......@@ -64,6 +64,8 @@ INSERT INTO ```t'\"_str` VALUES
INSERT INTO ```t'\"_str` VALUES
('4', 'abc', 0x00616263, 0x61626300, 0x61006263, 0x6100626300, 0x610062630000);
--source include/count_sessions.inc
-- connect (con_lock,localhost,root,,)
-- connect (con_min_trylock,localhost,root,,)
-- connect (con_max_trylock,localhost,root,,)
......@@ -147,3 +149,104 @@ SET @@sql_mode=@save_sql_mode;
-- disconnect con_verify_innodb_locks
DROP TABLE t_min, t_max, ```t'\"_str`;
--source include/wait_until_count_sessions.inc
#
# Test that transaction data is correctly "visualized" in
# INFORMATION_SCHEMA.INNODB_TRX
#
-- enable_result_log
DESCRIBE INFORMATION_SCHEMA.INNODB_TRX;
-- disable_result_log
-- disable_warnings
DROP TABLE IF EXISTS t1;
-- enable_warnings
CREATE TABLE t1 (
c01 INT,
c02 INT,
PRIMARY KEY (c01)
) ENGINE = InnoDB;
INSERT INTO t1 VALUES
(1,2),(2,4),(3,6),(4,8);
CREATE TABLE t2 (
c01 INT,
c02 INT,
PRIMARY KEY (c01),
FOREIGN KEY fk1 (c02) REFERENCES t1 (c01)
) ENGINE = InnoDB;
INSERT INTO t2 VALUES
(1,1),(2,2),(3,3);
-- connect (con_trx,localhost,root,,)
-- connect (con_verify_innodb_trx,localhost,root,,)
-- connection con_trx
SET autocommit=0;
INSERT INTO t1 VALUES (5,10);
SELECT * FROM t1 FOR UPDATE;
let $wait_condition=
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_TRX;
--source include/wait_condition.inc
-- disable_query_log
-- connection con_verify_innodb_trx
-- enable_result_log
SELECT trx_state, trx_weight, trx_tables_in_use, trx_tables_locked,
trx_rows_locked, trx_rows_modified, trx_concurrency_tickets,
trx_isolation_level, trx_unique_checks, trx_foreign_key_checks
FROM INFORMATION_SCHEMA.INNODB_TRX;
-- connection con_trx
-- disable_result_log
ROLLBACK;
SET FOREIGN_KEY_CHECKS = 0;
SET UNIQUE_CHECKS = 0;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
BEGIN;
INSERT INTO t1 VALUES (6,12);
let $wait_condition=
SELECT trx_unique_checks = 0 FROM INFORMATION_SCHEMA.INNODB_TRX;
--source include/wait_condition.inc
-- disable_query_log
-- connection con_verify_innodb_trx
-- enable_result_log
SELECT trx_isolation_level, trx_unique_checks, trx_foreign_key_checks
FROM INFORMATION_SCHEMA.INNODB_TRX;
-- disable_result_log
-- connection con_trx
ROLLBACK;
SET FOREIGN_KEY_CHECKS = 1;
SET UNIQUE_CHECKS = 1;
BEGIN;
-- error 1452
INSERT INTO t2 VALUES (4,10);
let $wait_condition=
SELECT trx_unique_checks = 1 FROM INFORMATION_SCHEMA.INNODB_TRX;
--source include/wait_condition.inc
-- disable_query_log
-- enable_result_log
-- connection con_verify_innodb_trx
SELECT trx_state, trx_isolation_level, trx_last_foreign_key_error
FROM INFORMATION_SCHEMA.INNODB_TRX;
-- disable_result_log
-- connection default
-- disconnect con_trx
-- disconnect con_verify_innodb_trx
DROP TABLE t2;
DROP TABLE t1;
-- source include/have_innodb.inc
#
# Test multi update with different join methods
#
CREATE TABLE bug38999_1 (a int not null primary key, b int not null, key (b)) engine=innodb;
CREATE TABLE bug38999_2 (a int not null primary key, b int not null, key (b)) engine=innodb;
INSERT INTO bug38999_1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
INSERT INTO bug38999_2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
# Full join, without key
update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100;
select * from bug38999_1;
# unique key
update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100 where bug38999_1.a=101;
select * from bug38999_1;
# ref key
update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+10 where bug38999_1.b=2;
select * from bug38999_1;
# Range key (in bug38999_1)
update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+2,bug38999_2.b=bug38999_1.b+10 where bug38999_1.b between 3 and 5 and bug38999_1.a=bug38999_2.a+100;
select * from bug38999_1;
select * from bug38999_2;
drop table bug38999_1,bug38999_2;
'#---------------------BS_STVARS_035_01----------------------#'
SELECT COUNT(@@GLOBAL.innodb_buffer_pool_instances);
COUNT(@@GLOBAL.innodb_buffer_pool_instances)
1
1 Expected
'#---------------------BS_STVARS_035_02----------------------#'
SET @@GLOBAL.innodb_buffer_pool_instances=1;
ERROR HY000: Variable 'innodb_buffer_pool_instances' is a read only variable
Expected error 'Read only variable'
SELECT COUNT(@@GLOBAL.innodb_buffer_pool_instances);
COUNT(@@GLOBAL.innodb_buffer_pool_instances)
1
1 Expected
'#---------------------BS_STVARS_035_03----------------------#'
SELECT @@GLOBAL.innodb_buffer_pool_instances = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_buffer_pool_instances';
@@GLOBAL.innodb_buffer_pool_instances = VARIABLE_VALUE
1
1 Expected
SELECT COUNT(@@GLOBAL.innodb_buffer_pool_instances);
COUNT(@@GLOBAL.innodb_buffer_pool_instances)
1
1 Expected
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_buffer_pool_instances';
COUNT(VARIABLE_VALUE)
1
1 Expected
'#---------------------BS_STVARS_035_04----------------------#'
SELECT @@innodb_buffer_pool_instances = @@GLOBAL.innodb_buffer_pool_instances;
@@innodb_buffer_pool_instances = @@GLOBAL.innodb_buffer_pool_instances
1
1 Expected
'#---------------------BS_STVARS_035_05----------------------#'
SELECT COUNT(@@innodb_buffer_pool_instances);
COUNT(@@innodb_buffer_pool_instances)
1
1 Expected
SELECT COUNT(@@local.innodb_buffer_pool_instances);
ERROR HY000: Variable 'innodb_buffer_pool_instances' is a GLOBAL variable
Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@SESSION.innodb_buffer_pool_instances);
ERROR HY000: Variable 'innodb_buffer_pool_instances' is a GLOBAL variable
Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@GLOBAL.innodb_buffer_pool_instances);
COUNT(@@GLOBAL.innodb_buffer_pool_instances)
1
1 Expected
SELECT innodb_buffer_pool_instances = @@SESSION.innodb_buffer_pool_instances;
ERROR 42S22: Unknown column 'innodb_buffer_pool_instances' in 'field list'
Expected error 'Readonly variable'
SET @start_global_value = @@global.innodb_change_buffering;
SELECT @start_global_value;
@start_global_value
inserts
Valid values are 'inserts' and 'none'
select @@global.innodb_change_buffering in ('inserts', 'none');
@@global.innodb_change_buffering in ('inserts', 'none')
all
Valid values are 'all', 'deletes', 'changes', 'inserts', 'none', 'purges'
select @@global.innodb_change_buffering in ('all', 'deletes', 'changes', 'inserts', 'none', 'purges');
@@global.innodb_change_buffering in ('all', 'deletes', 'changes', 'inserts', 'none', 'purges')
1
select @@global.innodb_change_buffering;
@@global.innodb_change_buffering
inserts
all
select @@session.innodb_change_buffering;
ERROR HY000: Variable 'innodb_change_buffering' is a GLOBAL variable
show global variables like 'innodb_change_buffering';
Variable_name Value
innodb_change_buffering inserts
innodb_change_buffering all
show session variables like 'innodb_change_buffering';
Variable_name Value
innodb_change_buffering inserts
innodb_change_buffering all
select * from information_schema.global_variables where variable_name='innodb_change_buffering';
VARIABLE_NAME VARIABLE_VALUE
INNODB_CHANGE_BUFFERING inserts
INNODB_CHANGE_BUFFERING all
select * from information_schema.session_variables where variable_name='innodb_change_buffering';
VARIABLE_NAME VARIABLE_VALUE
INNODB_CHANGE_BUFFERING inserts
INNODB_CHANGE_BUFFERING all
set global innodb_change_buffering='none';
select @@global.innodb_change_buffering;
@@global.innodb_change_buffering
......@@ -60,4 +60,4 @@ ERROR 42000: Variable 'innodb_change_buffering' can't be set to the value of 'so
SET @@global.innodb_change_buffering = @start_global_value;
SELECT @@global.innodb_change_buffering;
@@global.innodb_change_buffering
inserts
all
SET @global_start_value = @@global.innodb_purge_batch_size;
SELECT @global_start_value;
@global_start_value
20
'#--------------------FN_DYNVARS_046_01------------------------#'
SET @@global.innodb_purge_batch_size = 1;
SET @@global.innodb_purge_batch_size = DEFAULT;
SELECT @@global.innodb_purge_batch_size;
@@global.innodb_purge_batch_size
20
'#---------------------FN_DYNVARS_046_02-------------------------#'
SET innodb_purge_batch_size = 1;
ERROR HY000: Variable 'innodb_purge_batch_size' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@innodb_purge_batch_size;
@@innodb_purge_batch_size
20
SELECT local.innodb_purge_batch_size;
ERROR 42S02: Unknown table 'local' in field list
SET global innodb_purge_batch_size = 1;
SELECT @@global.innodb_purge_batch_size;
@@global.innodb_purge_batch_size
1
'#--------------------FN_DYNVARS_046_03------------------------#'
SET @@global.innodb_purge_batch_size = 1;
SELECT @@global.innodb_purge_batch_size;
@@global.innodb_purge_batch_size
1
SET @@global.innodb_purge_batch_size = 5000;
SELECT @@global.innodb_purge_batch_size;
@@global.innodb_purge_batch_size
5000
SET @@global.innodb_purge_batch_size = 1000;
SELECT @@global.innodb_purge_batch_size;
@@global.innodb_purge_batch_size
1000
'#--------------------FN_DYNVARS_046_04-------------------------#'
SET @@global.innodb_purge_batch_size = 0;
Warnings:
Warning 1292 Truncated incorrect innodb_purge_batch_size value: '0'
SELECT @@global.innodb_purge_batch_size;
@@global.innodb_purge_batch_size
1
SET @@global.innodb_purge_batch_size = "T";
ERROR 42000: Incorrect argument type to variable 'innodb_purge_batch_size'
SELECT @@global.innodb_purge_batch_size;
@@global.innodb_purge_batch_size
1
SET @@global.innodb_purge_batch_size = "Y";
ERROR 42000: Incorrect argument type to variable 'innodb_purge_batch_size'
SELECT @@global.innodb_purge_batch_size;
@@global.innodb_purge_batch_size
1
SET @@global.innodb_purge_batch_size = 5001;
Warnings:
Warning 1292 Truncated incorrect innodb_purge_batch_size value: '5001'
SELECT @@global.innodb_purge_batch_size;
@@global.innodb_purge_batch_size
5000
'#----------------------FN_DYNVARS_046_05------------------------#'
SELECT @@global.innodb_purge_batch_size =
VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_purge_batch_size';
@@global.innodb_purge_batch_size =
VARIABLE_VALUE
1
SELECT @@global.innodb_purge_batch_size;
@@global.innodb_purge_batch_size
5000
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_purge_batch_size';
VARIABLE_VALUE
5000
'#---------------------FN_DYNVARS_046_06-------------------------#'
SET @@global.innodb_purge_batch_size = OFF;
ERROR 42000: Incorrect argument type to variable 'innodb_purge_batch_size'
SELECT @@global.innodb_purge_batch_size;
@@global.innodb_purge_batch_size
5000
SET @@global.innodb_purge_batch_size = ON;
ERROR 42000: Incorrect argument type to variable 'innodb_purge_batch_size'
SELECT @@global.innodb_purge_batch_size;
@@global.innodb_purge_batch_size
5000
'#---------------------FN_DYNVARS_046_07----------------------#'
SET @@global.innodb_purge_batch_size = TRUE;
SELECT @@global.innodb_purge_batch_size;
@@global.innodb_purge_batch_size
1
SET @@global.innodb_purge_batch_size = FALSE;
Warnings:
Warning 1292 Truncated incorrect innodb_purge_batch_size value: '0'
SELECT @@global.innodb_purge_batch_size;
@@global.innodb_purge_batch_size
1
SET @@global.innodb_purge_batch_size = @global_start_value;
SELECT @@global.innodb_purge_batch_size;
@@global.innodb_purge_batch_size
20
'#---------------------BS_STVARS_035_01----------------------#'
SELECT COUNT(@@GLOBAL.innodb_purge_threads);
COUNT(@@GLOBAL.innodb_purge_threads)
1
1 Expected
'#---------------------BS_STVARS_035_02----------------------#'
SET @@GLOBAL.innodb_purge_threads=1;
ERROR HY000: Variable 'innodb_purge_threads' is a read only variable
Expected error 'Read only variable'
SELECT COUNT(@@GLOBAL.innodb_purge_threads);
COUNT(@@GLOBAL.innodb_purge_threads)
1
1 Expected
'#---------------------BS_STVARS_035_03----------------------#'
SELECT @@GLOBAL.innodb_purge_threads = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_purge_threads';
@@GLOBAL.innodb_purge_threads = VARIABLE_VALUE
1
1 Expected
SELECT COUNT(@@GLOBAL.innodb_purge_threads);
COUNT(@@GLOBAL.innodb_purge_threads)
1
1 Expected
SELECT COUNT(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_purge_threads';
COUNT(VARIABLE_VALUE)
1
1 Expected
'#---------------------BS_STVARS_035_04----------------------#'
SELECT @@innodb_purge_threads = @@GLOBAL.innodb_purge_threads;
@@innodb_purge_threads = @@GLOBAL.innodb_purge_threads
1
1 Expected
'#---------------------BS_STVARS_035_05----------------------#'
SELECT COUNT(@@innodb_purge_threads);
COUNT(@@innodb_purge_threads)
1
1 Expected
SELECT COUNT(@@local.innodb_purge_threads);
ERROR HY000: Variable 'innodb_purge_threads' is a GLOBAL variable
Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@SESSION.innodb_purge_threads);
ERROR HY000: Variable 'innodb_purge_threads' is a GLOBAL variable
Expected error 'Variable is a GLOBAL variable'
SELECT COUNT(@@GLOBAL.innodb_purge_threads);
COUNT(@@GLOBAL.innodb_purge_threads)
1
1 Expected
SELECT innodb_purge_threads = @@SESSION.innodb_purge_threads;
ERROR 42S22: Unknown column 'innodb_purge_threads' in 'field list'
Expected error 'Readonly variable'
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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