summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzr-mysql/default.conf2
-rw-r--r--mysql-test/include/check_key_reads.inc6
-rw-r--r--mysql-test/include/check_key_req.inc9
-rw-r--r--mysql-test/r/exampledb.result8
-rw-r--r--mysql-test/r/partition_column.result16
-rw-r--r--mysql-test/r/partition_key_cache.result417
-rw-r--r--mysql-test/r/partition_range.result37
-rw-r--r--mysql-test/r/partition_utf8.result6
-rw-r--r--mysql-test/r/query_cache.result107
-rw-r--r--mysql-test/r/show_check.result15
-rw-r--r--mysql-test/t/exampledb.test22
-rw-r--r--mysql-test/t/partition_key_cache.test251
-rw-r--r--mysql-test/t/partition_range.test13
-rw-r--r--mysql-test/t/query_cache.test112
-rw-r--r--mysql-test/t/show_check.test10
-rw-r--r--plugin/semisync/CMakeLists.txt3
-rw-r--r--sql/item.h9
-rw-r--r--sql/item_timefunc.h9
-rw-r--r--sql/partition_info.cc36
-rw-r--r--sql/partition_info.h1
-rw-r--r--sql/sql_show.cc2
-rw-r--r--sql/sql_yacc.yy118
-rw-r--r--storage/innobase/CMakeLists.txt7
-rw-r--r--support-files/mysql.server.sh2
24 files changed, 1026 insertions, 192 deletions
diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf
index e9ae26ca793..278fc8fdb7f 100644
--- a/.bzr-mysql/default.conf
+++ b/.bzr-mysql/default.conf
@@ -1,4 +1,4 @@
[MYSQL]
post_commit_to = "commits@lists.mysql.com"
post_push_to = "commits@lists.mysql.com"
-tree_name = "mysql-5.5-next-mr"
+tree_name = "mysql-5.5-next-mr-bugfixing"
diff --git a/mysql-test/include/check_key_reads.inc b/mysql-test/include/check_key_reads.inc
new file mode 100644
index 00000000000..cfb754bccd4
--- /dev/null
+++ b/mysql-test/include/check_key_reads.inc
@@ -0,0 +1,6 @@
+# include file for checking if variable key_reads is zero
+let $key_reads= query_get_value(SHOW STATUS LIKE 'key_reads',Value,1);
+--disable_query_log
+eval SELECT IF($key_reads = 0, "Yes!", "No!") as 'Zero key reads?';
+FLUSH STATUS;
+--enable_query_log
diff --git a/mysql-test/include/check_key_req.inc b/mysql-test/include/check_key_req.inc
new file mode 100644
index 00000000000..92a81f09d91
--- /dev/null
+++ b/mysql-test/include/check_key_req.inc
@@ -0,0 +1,9 @@
+# include file for checking if variable key_reads = key_read_requests
+let $key_reads= query_get_value(SHOW STATUS LIKE 'key_reads',Value,1);
+let $key_r_req= query_get_value(SHOW STATUS LIKE 'key_read_requests',Value,1);
+let $key_writes= query_get_value(SHOW STATUS LIKE 'key_writes',Value,1);
+let $key_w_req= query_get_value(SHOW STATUS LIKE 'key_write_requests',Value,1);
+--disable_query_log
+eval SELECT IF($key_reads = $key_r_req, "reads == requests", "reads != requests") as 'reads vs requests';
+eval SELECT IF($key_writes = $key_w_req, "writes == requests", "writes != requests") as 'writes vs requests';
+--enable_query_log
diff --git a/mysql-test/r/exampledb.result b/mysql-test/r/exampledb.result
deleted file mode 100644
index 6eea24e2e1f..00000000000
--- a/mysql-test/r/exampledb.result
+++ /dev/null
@@ -1,8 +0,0 @@
-drop database if exists events_test;
-drop database if exists events_test2;
-drop table if exists t1;
-CREATE TABLE t1 (
-Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
-Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
-) ENGINE=example;
-drop table t1;
diff --git a/mysql-test/r/partition_column.result b/mysql-test/r/partition_column.result
index 784df3045f0..a64ca8e405d 100644
--- a/mysql-test/r/partition_column.result
+++ b/mysql-test/r/partition_column.result
@@ -69,7 +69,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY LIST COLUMNS(a)
+/*!50500 PARTITION BY LIST COLUMNS(a)
(PARTITION p0 VALUES IN ('''') ENGINE = MyISAM,
PARTITION p1 VALUES IN ('\\') ENGINE = MyISAM,
PARTITION p2 VALUES IN ('\0') ENGINE = MyISAM) */
@@ -128,7 +128,7 @@ t1 CREATE TABLE `t1` (
`c` varchar(25) DEFAULT NULL,
`d` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE COLUMNS(a,b,c,d)
+/*!50500 PARTITION BY RANGE COLUMNS(a,b,c,d)
SUBPARTITION BY HASH (to_seconds(d))
SUBPARTITIONS 4
(PARTITION p0 VALUES LESS THAN (1,'0',MAXVALUE,'1900-01-01') ENGINE = MyISAM,
@@ -211,7 +211,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY LIST COLUMNS(a,b)
+/*!50500 PARTITION BY LIST COLUMNS(a,b)
(PARTITION p0 VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM,
PARTITION p1 VALUES IN ((1,1),(2,2)) ENGINE = MyISAM,
PARTITION p2 VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM) */
@@ -245,7 +245,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY LIST COLUMNS(a,b)
+/*!50500 PARTITION BY LIST COLUMNS(a,b)
(PARTITION p0 VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM,
PARTITION p1 VALUES IN ((1,1),(2,2)) ENGINE = MyISAM,
PARTITION p2 VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM) */
@@ -299,7 +299,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY LIST COLUMNS(a)
+/*!50500 PARTITION BY LIST COLUMNS(a)
(PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM,
PARTITION p1 VALUES IN (4,NULL,3) ENGINE = MyISAM) */
insert into t1 values (1);
@@ -314,7 +314,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY LIST COLUMNS(a)
+/*!50500 PARTITION BY LIST COLUMNS(a)
(PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM,
PARTITION p1 VALUES IN (4,NULL,3) ENGINE = MyISAM) */
drop table t1;
@@ -349,7 +349,7 @@ t1 CREATE TABLE `t1` (
`c` varchar(5) DEFAULT NULL,
`d` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE COLUMNS(a,b,c)
+/*!50500 PARTITION BY RANGE COLUMNS(a,b,c)
SUBPARTITION BY KEY (c,d)
SUBPARTITIONS 3
(PARTITION p0 VALUES LESS THAN (1,'abc','abc') ENGINE = MyISAM,
@@ -382,7 +382,7 @@ t1 CREATE TABLE `t1` (
`b` varchar(2) DEFAULT NULL,
`c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE COLUMNS(a,b,c)
+/*!50500 PARTITION BY RANGE COLUMNS(a,b,c)
(PARTITION p0 VALUES LESS THAN (1,'A',1) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (1,'B',1) ENGINE = MyISAM) */
insert into t1 values (1, 'A', 1);
diff --git a/mysql-test/r/partition_key_cache.result b/mysql-test/r/partition_key_cache.result
new file mode 100644
index 00000000000..7fbab34fa41
--- /dev/null
+++ b/mysql-test/r/partition_key_cache.result
@@ -0,0 +1,417 @@
+DROP TABLE IF EXISTS t1, t2, v, x;
+# Actual test of key caches
+# Verifing that reads/writes use the key cache correctly
+SELECT @org_key_cache_buffer_size:= @@global.default.key_buffer_size;
+@org_key_cache_buffer_size:= @@global.default.key_buffer_size
+1048576
+# Minimize default key cache (almost disabled).
+SET @@global.default.key_buffer_size = 1;
+Warnings:
+Warning 1292 Truncated incorrect key_buffer_size value: '1'
+CREATE TABLE t1 (
+a INT,
+b INT,
+c INT NOT NULL,
+PRIMARY KEY (a),
+KEY `inx_b` (b))
+PARTITION BY RANGE (a)
+SUBPARTITION BY HASH (a)
+(PARTITION p0 VALUES LESS THAN (1167602410)
+(SUBPARTITION sp0,
+SUBPARTITION sp1),
+PARTITION p1 VALUES LESS THAN MAXVALUE
+(SUBPARTITION sp2,
+SUBPARTITION sp3));
+CREATE TABLE t2 (
+a INT,
+b INT,
+c INT NOT NULL,
+PRIMARY KEY (a),
+KEY `inx_b` (b));
+FLUSH TABLES;
+FLUSH STATUS;
+SET @a:=1167602400;
+CREATE VIEW v AS SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4;
+CREATE VIEW x AS SELECT 1 FROM v,v a,v b;
+FLUSH STATUS;
+INSERT t1 SELECT @a, @a * (1 - ((@a % 2) * 2)) , 1167612400 - (@a:=@a+1) FROM x, x y;
+reads vs requests
+reads == requests
+writes vs requests
+writes == requests
+# row distribution:
+SELECT PARTITION_NAME, SUBPARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA='test' and TABLE_NAME='t1';
+PARTITION_NAME SUBPARTITION_NAME TABLE_ROWS
+p0 sp0 5
+p0 sp1 5
+p1 sp2 2043
+p1 sp3 2043
+DROP VIEW x;
+DROP VIEW v;
+FLUSH TABLES;
+FLUSH STATUS;
+SELECT COUNT(b) FROM t1 WHERE b >= 0;
+COUNT(b)
+2048
+Zero key reads?
+No!
+INSERT t2 SELECT a,b,c FROM t1;
+reads vs requests
+reads == requests
+writes vs requests
+writes == requests
+FLUSH STATUS;
+SELECT COUNT(b) FROM t2 WHERE b >= 0;
+COUNT(b)
+2048
+Zero key reads?
+No!
+FLUSH TABLES;
+# Setting the default key cache to 1M
+SET GLOBAL key_buffer_size = 1024*1024;
+FLUSH STATUS;
+# All these have to read the indexes
+LOAD INDEX INTO CACHE t1 PARTITION (p1);
+Table Op Msg_type Msg_text
+test.t1 preload_keys status OK
+Zero key reads?
+No!
+SELECT COUNT(b) FROM t1 WHERE b >= 0;
+COUNT(b)
+2048
+Zero key reads?
+No!
+SELECT COUNT(b) FROM t2 WHERE b >= 0;
+COUNT(b)
+2048
+Zero key reads?
+No!
+# All these should be able to use the key cache
+SELECT COUNT(b) FROM t1 WHERE b >= 0;
+COUNT(b)
+2048
+Zero key reads?
+Yes!
+SELECT COUNT(b) FROM t2 WHERE b >= 0;
+COUNT(b)
+2048
+Zero key reads?
+Yes!
+FLUSH TABLES;
+LOAD INDEX INTO CACHE t1 PARTITION (p1,p0);
+Table Op Msg_type Msg_text
+test.t1 preload_keys status OK
+Zero key reads?
+No!
+# should not be zero
+SELECT COUNT(b) FROM t1 WHERE b >= 0;
+COUNT(b)
+2048
+Zero key reads?
+Yes!
+LOAD INDEX INTO CACHE t2;
+Table Op Msg_type Msg_text
+test.t2 preload_keys status OK
+Zero key reads?
+No!
+# should not be zero
+SELECT COUNT(b) FROM t2 WHERE b >= 0;
+COUNT(b)
+2048
+Zero key reads?
+Yes!
+FLUSH TABLES;
+LOAD INDEX INTO CACHE t1 PARTITION (p1,p0) IGNORE LEAVES;
+Table Op Msg_type Msg_text
+test.t1 preload_keys status OK
+Zero key reads?
+No!
+# should not be zero
+SELECT COUNT(b) FROM t1 WHERE b >= 0;
+COUNT(b)
+2048
+Zero key reads?
+No!
+LOAD INDEX INTO CACHE t2 IGNORE LEAVES;
+Table Op Msg_type Msg_text
+test.t2 preload_keys status OK
+Zero key reads?
+No!
+# should not be zero
+SELECT COUNT(b) FROM t2 WHERE b >= 0;
+COUNT(b)
+2048
+Zero key reads?
+No!
+TRUNCATE TABLE t2;
+INSERT t2 SELECT a,b,c FROM t1;
+reads vs requests
+reads != requests
+writes vs requests
+writes != requests
+DROP TABLE t1,t2;
+SET GLOBAL hot_cache.key_buffer_size = 1024*1024;
+SET GLOBAL warm_cache.key_buffer_size = 1024*1024;
+SET @@global.cold_cache.key_buffer_size = 1024*1024;
+SELECT @@global.default.key_buffer_size a, @@global.default.key_cache_block_size b, @@global.default.key_cache_age_threshold c, @@global.default.key_cache_division_limit d;
+a b c d
+1048576 1024 300 100
+SELECT @@global.hot_cache.key_buffer_size a, @@global.hot_cache.key_cache_block_size b, @@global.hot_cache.key_cache_age_threshold c, @@global.hot_cache.key_cache_division_limit d;
+a b c d
+1048576 1024 300 100
+SELECT @@global.warm_cache.key_buffer_size a, @@global.warm_cache.key_cache_block_size b, @@global.warm_cache.key_cache_age_threshold c, @@global.warm_cache.key_cache_division_limit d;
+a b c d
+1048576 1024 300 100
+SELECT @@global.cold_cache.key_buffer_size a, @@global.cold_cache.key_cache_block_size b, @@global.cold_cache.key_cache_age_threshold c, @@global.cold_cache.key_cache_division_limit d;
+a b c d
+1048576 1024 300 100
+CREATE TABLE t1 (
+a INT,
+b VARCHAR(257),
+c INT NOT NULL,
+PRIMARY KEY (a),
+KEY `inx_b` (b),
+KEY `inx_c`(c))
+PARTITION BY RANGE (a)
+SUBPARTITION BY HASH (a)
+(PARTITION p0 VALUES LESS THAN (10)
+(SUBPARTITION sp0,
+SUBPARTITION sp1),
+PARTITION p1 VALUES LESS THAN MAXVALUE
+(SUBPARTITION sp2,
+SUBPARTITION sp3));
+CREATE TABLE t2 (
+a INT,
+b VARCHAR(257),
+c INT NOT NULL,
+PRIMARY KEY (a),
+KEY `inx_b` (b),
+KEY `inx_c`(c));
+SET @a:=1167602400;
+CREATE VIEW v AS SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4;
+CREATE VIEW x AS SELECT 1 FROM v,v a,v b;
+INSERT t1 SELECT @a, CONCAT('X_', @a, ' MySQL'), 1167612400 - (@a:=@a+1) FROM x, x a;
+DROP VIEW x;
+DROP VIEW v;
+INSERT t2 SELECT a, b, c FROM t1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4096
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4096
+FLUSH TABLES;
+# Restrict partitioned commands to partitioned tables only
+CACHE INDEX t2 PARTITION (p0) KEY (`inx_b`) IN hot_cache;
+ERROR HY000: Partition management on a not partitioned table is not possible
+CACHE INDEX t2 PARTITION (p0,`p1`) INDEX (`PRIMARY`) IN hot_cache;
+ERROR HY000: Partition management on a not partitioned table is not possible
+CACHE INDEX t2 PARTITION (`p1`) INDEX (`PRIMARY`,`inx_b`) IN hot_cache;
+ERROR HY000: Partition management on a not partitioned table is not possible
+CACHE INDEX t2 PARTITION (ALL) KEY (`inx_b`,`PRIMARY`) IN hot_cache;
+ERROR HY000: Partition management on a not partitioned table is not possible
+# Basic key cache testing
+# The manual correctly says: "The syntax of CACHE INDEX enables you to
+# specify that only particular indexes from a table should be assigned
+# to the cache. The current implementation assigns all the table's
+# indexes to the cache, so there is no reason to specify anything
+# other than the table name."
+# So the most of the test only tests the syntax
+CACHE INDEX t2 INDEX (`inx_b`) IN hot_cache;
+Table Op Msg_type Msg_text
+test.t2 assign_to_keycache status OK
+CACHE INDEX t2 KEY (`PRIMARY`) IN warm_cache;
+Table Op Msg_type Msg_text
+test.t2 assign_to_keycache status OK
+CACHE INDEX t2 KEY (`PRIMARY`,`inx_b`) IN cold_cache;
+Table Op Msg_type Msg_text
+test.t2 assign_to_keycache status OK
+CACHE INDEX t2 INDEX (inx_b,`PRIMARY`) IN default;
+Table Op Msg_type Msg_text
+test.t2 assign_to_keycache status OK
+CACHE INDEX t1 PARTITION (p0) KEY (`inx_b`) IN cold_cache;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+CACHE INDEX t1 PARTITIONS (p0) KEY (`inx_b`) IN cold_cache;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PARTITIONS (p0) KEY (`inx_b`) IN cold_cache' at line 1
+# only one table at a time if specifying partitions
+CACHE INDEX t1,t2 PARTITION (p0) KEY (`inx_b`) IN cold_cache;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PARTITION (p0) KEY (`inx_b`) IN cold_cache' at line 1
+CACHE INDEX t1 PARTITION (`p0`,p1) INDEX (`PRIMARY`) IN warm_cache;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+CACHE INDEX t1 PARTITION (`p1`) INDEX (`PRIMARY`,inx_b) IN hot_cache;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+CACHE INDEX t1 PARTITION (ALL) KEY (`inx_b`,`PRIMARY`) IN default;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+CACHE INDEX t1 PARTITION (ALL) IN hot_cache;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+CACHE INDEX t1 INDEX (`inx_b`) IN default;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+CACHE INDEX t1 KEY (`PRIMARY`) IN hot_cache;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+CACHE INDEX t1 KEY (`PRIMARY`,`inx_b`) IN warm_cache;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+CACHE INDEX t1 INDEX (`inx_b`,`PRIMARY`) IN cold_cache;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+CACHE INDEX t1 IN hot_cache;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+# Test of non existent key cache:
+CACHE INDEX t1 IN non_existent_key_cache;
+ERROR HY000: Unknown key cache 'non_existent_key_cache'
+# Basic testing of LOAD INDEX
+LOAD INDEX INTO CACHE t2;
+Table Op Msg_type Msg_text
+test.t2 preload_keys status OK
+# PRIMARY and secondary keys have different block sizes
+LOAD INDEX INTO CACHE t2 ignore leaves;
+Table Op Msg_type Msg_text
+test.t2 preload_keys error Indexes use different block sizes
+test.t2 preload_keys status Operation failed
+# Must have INDEX or KEY before the index list
+LOAD INDEX INTO CACHE t2 (`PRIMARY`);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(`PRIMARY`)' at line 1
+# Test of IGNORE LEAVES
+LOAD INDEX INTO CACHE t2 INDEX (`PRIMARY`);
+Table Op Msg_type Msg_text
+test.t2 preload_keys status OK
+LOAD INDEX INTO CACHE t2 KEY (`PRIMARY`,`inx_b`) IGNORE LEAVES;
+Table Op Msg_type Msg_text
+test.t2 preload_keys error Indexes use different block sizes
+test.t2 preload_keys status Operation failed
+CACHE INDEX t2 IN warm_cache;
+Table Op Msg_type Msg_text
+test.t2 assign_to_keycache status OK
+CACHE INDEX t1 IN cold_cache;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+LOAD INDEX INTO CACHE t2 KEY (`PRIMARY`) IGNORE LEAVES;
+Table Op Msg_type Msg_text
+test.t2 preload_keys error Indexes use different block sizes
+test.t2 preload_keys status Operation failed
+CACHE INDEX t2 INDEX (`inx_b`, `inx_c`) IN hot_cache;
+Table Op Msg_type Msg_text
+test.t2 assign_to_keycache status OK
+LOAD INDEX INTO CACHE t2 KEY (`inx_b`, `inx_c`) IGNORE LEAVES;
+Table Op Msg_type Msg_text
+test.t2 preload_keys error Indexes use different block sizes
+test.t2 preload_keys status Operation failed
+CACHE INDEX t2 IN warm_cache;
+Table Op Msg_type Msg_text
+test.t2 assign_to_keycache status OK
+CACHE INDEX t2 INDEX (`PRIMARY`, `inx_c`) IN hot_cache;
+Table Op Msg_type Msg_text
+test.t2 assign_to_keycache status OK
+LOAD INDEX INTO CACHE t2 KEY (`PRIMARY`,`inx_c`) IGNORE LEAVES;
+Table Op Msg_type Msg_text
+test.t2 preload_keys error Indexes use different block sizes
+test.t2 preload_keys status Operation failed
+CACHE INDEX t2 INDEX (`inx_b`,`PRIMARY`) IN default;
+Table Op Msg_type Msg_text
+test.t2 assign_to_keycache status OK
+LOAD INDEX INTO CACHE t2 KEY (`PRIMARY`,`inx_b`);
+Table Op Msg_type Msg_text
+test.t2 preload_keys status OK
+CACHE INDEX t2 IN default;
+Table Op Msg_type Msg_text
+test.t2 assign_to_keycache status OK
+LOAD INDEX INTO CACHE t2 IGNORE LEAVES;
+Table Op Msg_type Msg_text
+test.t2 preload_keys error Indexes use different block sizes
+test.t2 preload_keys status Operation failed
+LOAD INDEX INTO CACHE t2 PARTITION (p1) INDEX (`PRIMARY`);
+ERROR HY000: Partition management on a not partitioned table is not possible
+LOAD INDEX INTO CACHE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 preload_keys status OK
+test.t2 preload_keys status OK
+# only one table at a time if specifying partitions
+LOAD INDEX INTO CACHE t1 PARTITION (p0), t2;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' t2' at line 1
+LOAD INDEX INTO CACHE t1 IGNORE LEAVES;
+Table Op Msg_type Msg_text
+test.t1 preload_keys error Indexes use different block sizes
+test.t1 preload_keys error Subpartition sp2 returned error
+test.t1 preload_keys status Operation failed
+LOAD INDEX INTO CACHE t1 INDEX (`PRIMARY`);
+Table Op Msg_type Msg_text
+test.t1 preload_keys status OK
+LOAD INDEX INTO CACHE t1 INDEX (`PRIMARY`,`inx_b`) IGNORE LEAVES;
+Table Op Msg_type Msg_text
+test.t1 preload_keys error Indexes use different block sizes
+test.t1 preload_keys error Subpartition sp2 returned error
+test.t1 preload_keys status Operation failed
+LOAD INDEX INTO CACHE t1 INDEX (`inx_b`) IGNORE LEAVES;
+Table Op Msg_type Msg_text
+test.t1 preload_keys error Indexes use different block sizes
+test.t1 preload_keys error Subpartition sp2 returned error
+test.t1 preload_keys status Operation failed
+LOAD INDEX INTO CACHE t1 INDEX (`PRIMARY`) IGNORE LEAVES;
+Table Op Msg_type Msg_text
+test.t1 preload_keys error Indexes use different block sizes
+test.t1 preload_keys error Subpartition sp2 returned error
+test.t1 preload_keys status Operation failed
+LOAD INDEX INTO CACHE t1 INDEX (`PRIMARY`,`inx_b`);
+Table Op Msg_type Msg_text
+test.t1 preload_keys status OK
+LOAD INDEX INTO CACHE t1 PARTITION (p1) INDEX (`PRIMARY`);
+Table Op Msg_type Msg_text
+test.t1 preload_keys status OK
+LOAD INDEX INTO CACHE t1 PARTITION (`p1`,p0) KEY (`PRIMARY`) IGNORE LEAVES;
+Table Op Msg_type Msg_text
+test.t1 preload_keys error Indexes use different block sizes
+test.t1 preload_keys error Subpartition sp2 returned error
+test.t1 preload_keys status Operation failed
+LOAD INDEX INTO CACHE t1 PARTITION (ALL);
+Table Op Msg_type Msg_text
+test.t1 preload_keys status OK
+LOAD INDEX INTO CACHE t1 PARTITIONS ALL;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PARTITIONS ALL' at line 1
+LOAD INDEX INTO CACHE t1 PARTITION (p1,`p0`) IGNORE LEAVES;
+Table Op Msg_type Msg_text
+test.t1 preload_keys error Indexes use different block sizes
+test.t1 preload_keys error Subpartition sp2 returned error
+test.t1 preload_keys status Operation failed
+DROP INDEX `inx_b` on t1;
+DROP INDEX `inx_b` on t2;
+CACHE INDEX t2 PARTITION (p0) KEY (`inx_b`) IN hot_cache;
+ERROR HY000: Partition management on a not partitioned table is not possible
+CACHE INDEX t2 INDEX (`inx_b`) IN hot_cache;
+Table Op Msg_type Msg_text
+test.t2 assign_to_keycache Error Key 'inx_b' doesn't exist in table 't2'
+test.t2 assign_to_keycache status Operation failed
+CACHE INDEX t1 PARTITION (p0) KEY (`inx_b`) IN hot_cache;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache error Subpartition sp0 returned error
+test.t1 assign_to_keycache Error Key 'inx_b' doesn't exist in table 't1'
+test.t1 assign_to_keycache status Operation failed
+CACHE INDEX t1 INDEX (`inx_b`) IN hot_cache;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache error Subpartition sp0 returned error
+test.t1 assign_to_keycache Error Key 'inx_b' doesn't exist in table 't1'
+test.t1 assign_to_keycache status Operation failed
+DROP TABLE t1,t2;
+SET GLOBAL hot_cache.key_buffer_size = 0;
+SET GLOBAL warm_cache.key_buffer_size = 0;
+SET @@global.cold_cache.key_buffer_size = 0;
+SELECT @@global.default.key_buffer_size a, @@global.default.key_cache_block_size b, @@global.default.key_cache_age_threshold c, @@global.default.key_cache_division_limit d;
+a b c d
+1048576 1024 300 100
+SELECT @@global.hot_cache.key_buffer_size a, @@global.hot_cache.key_cache_block_size b, @@global.hot_cache.key_cache_age_threshold c, @@global.hot_cache.key_cache_division_limit d;
+a b c d
+0 1024 300 100
+SELECT @@global.warm_cache.key_buffer_size a, @@global.warm_cache.key_cache_block_size b, @@global.warm_cache.key_cache_age_threshold c, @@global.warm_cache.key_cache_division_limit d;
+a b c d
+0 1024 300 100
+SELECT @@global.cold_cache.key_buffer_size a, @@global.cold_cache.key_cache_block_size b, @@global.cold_cache.key_cache_age_threshold c, @@global.cold_cache.key_cache_division_limit d;
+a b c d
+0 1024 300 100
+SET @@global.default.key_buffer_size = @org_key_cache_buffer_size;
diff --git a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result
index 87cb4fba306..0bd7605a5c8 100644
--- a/mysql-test/r/partition_range.result
+++ b/mysql-test/r/partition_range.result
@@ -1,6 +1,19 @@
drop table if exists t1, t2;
create table t1 (a int)
partition by range (a)
+subpartition by hash(to_seconds(a))
+(partition p0 values less than (1));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50500 PARTITION BY RANGE (a)
+SUBPARTITION BY HASH (to_seconds(a))
+(PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM) */
+drop table t1;
+create table t1 (a int)
+partition by range (a)
( partition p0 values less than (NULL),
partition p1 values less than (MAXVALUE));
ERROR HY000: Not allowed to use NULL value in VALUES LESS THAN
@@ -30,6 +43,14 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
explain partitions select * from t1 where a < '2007-03-07 23:59:59';
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 4 Using where
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` datetime NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50500 PARTITION BY RANGE (TO_SECONDS(a))
+(PARTITION p0 VALUES LESS THAN (63340531200) ENGINE = MyISAM,
+ PARTITION p1 VALUES LESS THAN (63342604800) ENGINE = MyISAM) */
drop table t1;
create table t1 (a date)
partition by range(to_seconds(a))
@@ -53,6 +74,14 @@ select * from t1 where a <= '2005-01-01';
a
2003-12-30
2004-12-31
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50500 PARTITION BY RANGE (to_seconds(a))
+(PARTITION p0 VALUES LESS THAN (63240134400) ENGINE = MyISAM,
+ PARTITION p1 VALUES LESS THAN (63271756800) ENGINE = MyISAM) */
drop table t1;
create table t1 (a datetime)
partition by range(to_seconds(a))
@@ -75,6 +104,14 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
select * from t1 where a <= '2005-01-01';
a
2004-01-01 11:59:29
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` datetime DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50500 PARTITION BY RANGE (to_seconds(a))
+(PARTITION p0 VALUES LESS THAN (63240177600) ENGINE = MyISAM,
+ PARTITION p1 VALUES LESS THAN (63271800000) ENGINE = MyISAM) */
drop table t1;
create table t1 (a int, b char(20))
partition by range columns(a,b)
diff --git a/mysql-test/r/partition_utf8.result b/mysql-test/r/partition_utf8.result
index 0fae7bb16b6..339871f1f4a 100644
--- a/mysql-test/r/partition_utf8.result
+++ b/mysql-test/r/partition_utf8.result
@@ -7,7 +7,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(2) CHARACTER SET cp1250 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY LIST COLUMNS(a)
+/*!50500 PARTITION BY LIST COLUMNS(a)
(PARTITION p0 VALUES IN (_cp1250 0x81) ENGINE = MyISAM) */
drop table t1;
create table t1 (a varchar(2) character set cp1250)
@@ -18,7 +18,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(2) CHARACTER SET cp1250 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY LIST COLUMNS(a)
+/*!50500 PARTITION BY LIST COLUMNS(a)
(PARTITION p0 VALUES IN ('€') ENGINE = MyISAM) */
drop table t1;
create table t1 (a varchar(1500), b varchar(1570))
@@ -45,7 +45,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY LIST COLUMNS(a)
+/*!50500 PARTITION BY LIST COLUMNS(a)
(PARTITION p0 VALUES IN ('†') ENGINE = MyISAM,
PARTITION p1 VALUES IN ('') ENGINE = MyISAM) */
insert into t1 values ('');
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index b67fa9322ee..9cde630e4ed 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -176,21 +176,6 @@ a
1
2
3
-select * from t1 union select sql_cache * from t1;
-a
-1
-2
-3
-select * from t1 where a IN (select sql_cache a from t1);
-a
-1
-2
-3
-select * from t1 where a IN (select a from t1 union select sql_cache a from t1);
-a
-1
-2
-3
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 4
@@ -207,41 +192,6 @@ a
1
2
3
-select * from t1 union select sql_no_cache * from t1;
-a
-1
-2
-3
-select * from t1 where a IN (select sql_no_cache a from t1);
-a
-1
-2
-3
-select * from t1 where a IN (select a from t1 union select sql_no_cache a from t1);
-a
-1
-2
-3
-select sql_cache sql_no_cache * from t1;
-a
-1
-2
-3
-select sql_cache * from t1 union select sql_no_cache * from t1;
-a
-1
-2
-3
-select sql_cache * from t1 where a IN (select sql_no_cache a from t1);
-a
-1
-2
-3
-select sql_cache * from t1 where a IN (select a from t1 union select sql_no_cache a from t1);
-a
-1
-2
-3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
@@ -1490,12 +1440,6 @@ insert into t1 values ('c');
a
drop table t1;
set GLOBAL query_cache_size= default;
-set GLOBAL query_cache_size=1000000;
-create table t1 (a char);
-insert into t1 values ('c');
-a
-drop table t1;
-set GLOBAL query_cache_size= default;
SET GLOBAL query_cache_size=64*1024*1024;
CREATE TABLE t1 (id INT);
CREATE PROCEDURE proc29856(IN theUPC TEXT)
@@ -1723,4 +1667,55 @@ SELECT 1 FROM t1 GROUP BY
1
DROP TABLE t1;
SET GLOBAL query_cache_size= default;
+CREATE TABLE t1( a INT );
+SET @v = ( SELECT SQL_CACHE 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1 )' at line 1
+SET @v = ( SELECT SQL_NO_CACHE 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1 )' at line 1
+SELECT a FROM t1 WHERE a IN ( SELECT SQL_CACHE a FROM t1 );
+ERROR 42S22: Unknown column 'SQL_CACHE' in 'field list'
+SELECT a FROM t1 WHERE a IN ( SELECT SQL_NO_CACHE a FROM t1 );
+ERROR 42S22: Unknown column 'SQL_NO_CACHE' in 'field list'
+SELECT ( SELECT SQL_CACHE a FROM t1 );
+ERROR 42S22: Unknown column 'SQL_CACHE' in 'field list'
+SELECT ( SELECT SQL_NO_CACHE a FROM t1 );
+ERROR 42S22: Unknown column 'SQL_NO_CACHE' in 'field list'
+SELECT SQL_CACHE * FROM t1;
+a
+SELECT SQL_NO_CACHE * FROM t1;
+a
+SELECT * FROM t1 UNION SELECT SQL_CACHE * FROM t1;
+ERROR 42000: Incorrect usage/placement of 'SQL_CACHE'
+SELECT * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
+ERROR 42000: Incorrect usage/placement of 'SQL_NO_CACHE'
+SELECT * FROM t1 WHERE a IN (SELECT SQL_CACHE a FROM t1);
+ERROR 42S22: Unknown column 'SQL_CACHE' in 'field list'
+SELECT * FROM t1 WHERE a IN (SELECT a FROM t1 UNION SELECT SQL_CACHE a FROM t1);
+ERROR 42S22: Unknown column 'SQL_CACHE' in 'field list'
+SELECT * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
+ERROR 42000: Incorrect usage/placement of 'SQL_NO_CACHE'
+SELECT * FROM t1 WHERE a IN (SELECT SQL_NO_CACHE a FROM t1);
+ERROR 42S22: Unknown column 'SQL_NO_CACHE' in 'field list'
+SELECT * FROM t1 WHERE a IN
+(SELECT a FROM t1 UNION SELECT SQL_NO_CACHE a FROM t1);
+ERROR 42S22: Unknown column 'SQL_NO_CACHE' in 'field list'
+SELECT SQL_CACHE SQL_NO_CACHE * FROM t1;
+ERROR HY000: Incorrect usage of SQL_CACHE and SQL_NO_CACHE
+SELECT SQL_NO_CACHE SQL_CACHE * FROM t1;
+ERROR HY000: Incorrect usage of SQL_NO_CACHE and SQL_CACHE
+SELECT SQL_CACHE * FROM t1 UNION SELECT SQL_CACHE * FROM t1;
+ERROR 42000: Incorrect usage/placement of 'SQL_CACHE'
+SELECT SQL_CACHE * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
+ERROR 42000: Incorrect usage/placement of 'SQL_NO_CACHE'
+SELECT SQL_NO_CACHE * FROM t1 UNION SELECT SQL_CACHE * FROM t1;
+ERROR 42000: Incorrect usage/placement of 'SQL_CACHE'
+SELECT SQL_NO_CACHE * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
+ERROR 42000: Incorrect usage/placement of 'SQL_NO_CACHE'
+SELECT SQL_CACHE * FROM t1 WHERE a IN
+(SELECT SQL_NO_CACHE a FROM t1);
+ERROR 42S22: Unknown column 'SQL_NO_CACHE' in 'field list'
+SELECT SQL_CACHE * FROM t1 WHERE a IN
+(SELECT a FROM t1 UNION SELECT SQL_NO_CACHE a FROM t1);
+ERROR 42S22: Unknown column 'SQL_NO_CACHE' in 'field list'
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 4e40c48305d..c6276f319a1 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -737,20 +737,11 @@ View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache now() AS `NOW()` binary binary
DROP VIEW v1;
CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE NOW();
-SHOW CREATE VIEW v1;
-View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache now() AS `NOW()` binary binary
-DROP VIEW v1;
+ERROR HY000: Incorrect usage of SQL_CACHE and SQL_NO_CACHE
CREATE VIEW v1 AS SELECT SQL_NO_CACHE SQL_CACHE NOW();
-SHOW CREATE VIEW v1;
-View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache now() AS `NOW()` binary binary
-DROP VIEW v1;
+ERROR HY000: Incorrect usage of SQL_NO_CACHE and SQL_CACHE
CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE SQL_CACHE NOW();
-SHOW CREATE VIEW v1;
-View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache now() AS `NOW()` binary binary
-DROP VIEW v1;
+ERROR HY000: Incorrect usage of SQL_CACHE and SQL_NO_CACHE
CREATE PROCEDURE p1()
BEGIN
SET @s= 'CREATE VIEW v1 AS SELECT SQL_CACHE 1';
diff --git a/mysql-test/t/exampledb.test b/mysql-test/t/exampledb.test
deleted file mode 100644
index fbb2a18f344..00000000000
--- a/mysql-test/t/exampledb.test
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Simple test for the example storage engine
-# Taken fromm the select test
-#
--- source include/have_exampledb.inc
-
---disable_warnings
-# Clean up if event's test fails
-drop database if exists events_test;
-drop database if exists events_test2;
-
-drop table if exists t1;
---enable_warnings
-
-CREATE TABLE t1 (
- Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
- Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
-) ENGINE=example;
-
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/partition_key_cache.test b/mysql-test/t/partition_key_cache.test
new file mode 100644
index 00000000000..f6ea974ba96
--- /dev/null
+++ b/mysql-test/t/partition_key_cache.test
@@ -0,0 +1,251 @@
+# Test of key cache with partitions
+--source include/have_partition.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2, v, x;
+--enable_warnings
+
+--echo # Actual test of key caches
+--echo # Verifing that reads/writes use the key cache correctly
+SELECT @org_key_cache_buffer_size:= @@global.default.key_buffer_size;
+--echo # Minimize default key cache (almost disabled).
+SET @@global.default.key_buffer_size = 1;
+CREATE TABLE t1 (
+ a INT,
+ b INT,
+ c INT NOT NULL,
+ PRIMARY KEY (a),
+ KEY `inx_b` (b))
+PARTITION BY RANGE (a)
+SUBPARTITION BY HASH (a)
+(PARTITION p0 VALUES LESS THAN (1167602410)
+ (SUBPARTITION sp0,
+ SUBPARTITION sp1),
+ PARTITION p1 VALUES LESS THAN MAXVALUE
+ (SUBPARTITION sp2,
+ SUBPARTITION sp3));
+CREATE TABLE t2 (
+ a INT,
+ b INT,
+ c INT NOT NULL,
+ PRIMARY KEY (a),
+ KEY `inx_b` (b));
+FLUSH TABLES;
+FLUSH STATUS;
+
+# Genereate 4096 rows. Idea from:
+# http://datacharmer.blogspot.com/2007/12/data-from-nothing-solution-to-pop-quiz.html
+SET @a:=1167602400;
+CREATE VIEW v AS SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4;
+CREATE VIEW x AS SELECT 1 FROM v,v a,v b;
+# due to I_S performance, this was substituted with include files which
+# uses SHOW STATUS
+#DELIMITER |;
+#CREATE PROCEDURE was_zero_reads()
+#BEGIN
+# SELECT IF(VARIABLE_VALUE = 0,"Yes!","No!") as 'Was zero reads?'
+# FROM INFORMATION_SCHEMA.SESSION_STATUS
+# WHERE VARIABLE_NAME = 'KEY_READS';
+# FLUSH STATUS;
+#END|
+#DELIMITER ;|
+
+FLUSH STATUS;
+INSERT t1 SELECT @a, @a * (1 - ((@a % 2) * 2)) , 1167612400 - (@a:=@a+1) FROM x, x y;
+--source include/check_key_req.inc
+--echo # row distribution:
+SELECT PARTITION_NAME, SUBPARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA='test' and TABLE_NAME='t1';
+DROP VIEW x;
+DROP VIEW v;
+FLUSH TABLES;
+FLUSH STATUS;
+SELECT COUNT(b) FROM t1 WHERE b >= 0;
+--source include/check_key_reads.inc
+INSERT t2 SELECT a,b,c FROM t1;
+--source include/check_key_req.inc
+FLUSH STATUS;
+SELECT COUNT(b) FROM t2 WHERE b >= 0;
+--source include/check_key_reads.inc
+FLUSH TABLES;
+--echo # Setting the default key cache to 1M
+SET GLOBAL key_buffer_size = 1024*1024;
+FLUSH STATUS;
+--echo # All these have to read the indexes
+LOAD INDEX INTO CACHE t1 PARTITION (p1);
+--source include/check_key_reads.inc
+SELECT COUNT(b) FROM t1 WHERE b >= 0;
+--source include/check_key_reads.inc
+SELECT COUNT(b) FROM t2 WHERE b >= 0;
+--source include/check_key_reads.inc
+--echo # All these should be able to use the key cache
+SELECT COUNT(b) FROM t1 WHERE b >= 0;
+--source include/check_key_reads.inc
+SELECT COUNT(b) FROM t2 WHERE b >= 0;
+--source include/check_key_reads.inc
+FLUSH TABLES;
+LOAD INDEX INTO CACHE t1 PARTITION (p1,p0);
+--source include/check_key_reads.inc
+--echo # should not be zero
+SELECT COUNT(b) FROM t1 WHERE b >= 0;
+--source include/check_key_reads.inc
+LOAD INDEX INTO CACHE t2;
+--source include/check_key_reads.inc
+--echo # should not be zero
+SELECT COUNT(b) FROM t2 WHERE b >= 0;
+--source include/check_key_reads.inc
+FLUSH TABLES;
+LOAD INDEX INTO CACHE t1 PARTITION (p1,p0) IGNORE LEAVES;
+--source include/check_key_reads.inc
+--echo # should not be zero
+SELECT COUNT(b) FROM t1 WHERE b >= 0;
+--source include/check_key_reads.inc
+LOAD INDEX INTO CACHE t2 IGNORE LEAVES;
+--source include/check_key_reads.inc
+--echo # should not be zero
+SELECT COUNT(b) FROM t2 WHERE b >= 0;
+--source include/check_key_reads.inc
+TRUNCATE TABLE t2;
+INSERT t2 SELECT a,b,c FROM t1;
+--source include/check_key_req.inc
+DROP TABLE t1,t2;
+
+SET GLOBAL hot_cache.key_buffer_size = 1024*1024;
+SET GLOBAL warm_cache.key_buffer_size = 1024*1024;
+SET @@global.cold_cache.key_buffer_size = 1024*1024;
+SELECT @@global.default.key_buffer_size a, @@global.default.key_cache_block_size b, @@global.default.key_cache_age_threshold c, @@global.default.key_cache_division_limit d;
+SELECT @@global.hot_cache.key_buffer_size a, @@global.hot_cache.key_cache_block_size b, @@global.hot_cache.key_cache_age_threshold c, @@global.hot_cache.key_cache_division_limit d;
+SELECT @@global.warm_cache.key_buffer_size a, @@global.warm_cache.key_cache_block_size b, @@global.warm_cache.key_cache_age_threshold c, @@global.warm_cache.key_cache_division_limit d;
+SELECT @@global.cold_cache.key_buffer_size a, @@global.cold_cache.key_cache_block_size b, @@global.cold_cache.key_cache_age_threshold c, @@global.cold_cache.key_cache_division_limit d;
+CREATE TABLE t1 (
+ a INT,
+ b VARCHAR(257),
+ c INT NOT NULL,
+ PRIMARY KEY (a),
+ KEY `inx_b` (b),
+ KEY `inx_c`(c))
+PARTITION BY RANGE (a)
+SUBPARTITION BY HASH (a)
+(PARTITION p0 VALUES LESS THAN (10)
+ (SUBPARTITION sp0,
+ SUBPARTITION sp1),
+ PARTITION p1 VALUES LESS THAN MAXVALUE
+ (SUBPARTITION sp2,
+ SUBPARTITION sp3));
+CREATE TABLE t2 (
+ a INT,
+ b VARCHAR(257),
+ c INT NOT NULL,
+ PRIMARY KEY (a),
+ KEY `inx_b` (b),
+ KEY `inx_c`(c));
+SET @a:=1167602400;
+# Genereate 4096 rows. Idea from:
+# http://datacharmer.blogspot.com/2007/12/data-from-nothing-solution-to-pop-quiz.html
+CREATE VIEW v AS SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4;
+CREATE VIEW x AS SELECT 1 FROM v,v a,v b;
+INSERT t1 SELECT @a, CONCAT('X_', @a, ' MySQL'), 1167612400 - (@a:=@a+1) FROM x, x a;
+DROP VIEW x;
+DROP VIEW v;
+INSERT t2 SELECT a, b, c FROM t1;
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM t2;
+FLUSH TABLES;
+
+--echo # Restrict partitioned commands to partitioned tables only
+--error ER_PARTITION_MGMT_ON_NONPARTITIONED
+CACHE INDEX t2 PARTITION (p0) KEY (`inx_b`) IN hot_cache;
+--error ER_PARTITION_MGMT_ON_NONPARTITIONED
+CACHE INDEX t2 PARTITION (p0,`p1`) INDEX (`PRIMARY`) IN hot_cache;
+--error ER_PARTITION_MGMT_ON_NONPARTITIONED
+CACHE INDEX t2 PARTITION (`p1`) INDEX (`PRIMARY`,`inx_b`) IN hot_cache;
+--error ER_PARTITION_MGMT_ON_NONPARTITIONED
+CACHE INDEX t2 PARTITION (ALL) KEY (`inx_b`,`PRIMARY`) IN hot_cache;
+--echo # Basic key cache testing
+--echo # The manual correctly says: "The syntax of CACHE INDEX enables you to
+--echo # specify that only particular indexes from a table should be assigned
+--echo # to the cache. The current implementation assigns all the table's
+--echo # indexes to the cache, so there is no reason to specify anything
+--echo # other than the table name."
+--echo # So the most of the test only tests the syntax
+CACHE INDEX t2 INDEX (`inx_b`) IN hot_cache;
+CACHE INDEX t2 KEY (`PRIMARY`) IN warm_cache;
+CACHE INDEX t2 KEY (`PRIMARY`,`inx_b`) IN cold_cache;
+CACHE INDEX t2 INDEX (inx_b,`PRIMARY`) IN default;
+CACHE INDEX t1 PARTITION (p0) KEY (`inx_b`) IN cold_cache;
+--error ER_PARSE_ERROR
+CACHE INDEX t1 PARTITIONS (p0) KEY (`inx_b`) IN cold_cache;
+--echo # only one table at a time if specifying partitions
+--error ER_PARSE_ERROR
+CACHE INDEX t1,t2 PARTITION (p0) KEY (`inx_b`) IN cold_cache;
+CACHE INDEX t1 PARTITION (`p0`,p1) INDEX (`PRIMARY`) IN warm_cache;
+CACHE INDEX t1 PARTITION (`p1`) INDEX (`PRIMARY`,inx_b) IN hot_cache;
+CACHE INDEX t1 PARTITION (ALL) KEY (`inx_b`,`PRIMARY`) IN default;
+CACHE INDEX t1 PARTITION (ALL) IN hot_cache;
+CACHE INDEX t1 INDEX (`inx_b`) IN default;
+CACHE INDEX t1 KEY (`PRIMARY`) IN hot_cache;
+CACHE INDEX t1 KEY (`PRIMARY`,`inx_b`) IN warm_cache;
+CACHE INDEX t1 INDEX (`inx_b`,`PRIMARY`) IN cold_cache;
+CACHE INDEX t1 IN hot_cache;
+--echo # Test of non existent key cache:
+--error ER_UNKNOWN_KEY_CACHE
+CACHE INDEX t1 IN non_existent_key_cache;
+--echo # Basic testing of LOAD INDEX
+LOAD INDEX INTO CACHE t2;
+--echo # PRIMARY and secondary keys have different block sizes
+LOAD INDEX INTO CACHE t2 ignore leaves;
+--echo # Must have INDEX or KEY before the index list
+--error ER_PARSE_ERROR
+LOAD INDEX INTO CACHE t2 (`PRIMARY`);
+
+--echo # Test of IGNORE LEAVES
+LOAD INDEX INTO CACHE t2 INDEX (`PRIMARY`);
+LOAD INDEX INTO CACHE t2 KEY (`PRIMARY`,`inx_b`) IGNORE LEAVES;
+CACHE INDEX t2 IN warm_cache;
+CACHE INDEX t1 IN cold_cache;
+LOAD INDEX INTO CACHE t2 KEY (`PRIMARY`) IGNORE LEAVES;
+CACHE INDEX t2 INDEX (`inx_b`, `inx_c`) IN hot_cache;
+LOAD INDEX INTO CACHE t2 KEY (`inx_b`, `inx_c`) IGNORE LEAVES;
+CACHE INDEX t2 IN warm_cache;
+CACHE INDEX t2 INDEX (`PRIMARY`, `inx_c`) IN hot_cache;
+LOAD INDEX INTO CACHE t2 KEY (`PRIMARY`,`inx_c`) IGNORE LEAVES;
+CACHE INDEX t2 INDEX (`inx_b`,`PRIMARY`) IN default;
+LOAD INDEX INTO CACHE t2 KEY (`PRIMARY`,`inx_b`);
+CACHE INDEX t2 IN default;
+LOAD INDEX INTO CACHE t2 IGNORE LEAVES;
+
+--error ER_PARTITION_MGMT_ON_NONPARTITIONED
+LOAD INDEX INTO CACHE t2 PARTITION (p1) INDEX (`PRIMARY`);
+LOAD INDEX INTO CACHE t1, t2;
+--echo # only one table at a time if specifying partitions
+--error ER_PARSE_ERROR
+LOAD INDEX INTO CACHE t1 PARTITION (p0), t2;
+LOAD INDEX INTO CACHE t1 IGNORE LEAVES;
+LOAD INDEX INTO CACHE t1 INDEX (`PRIMARY`);
+LOAD INDEX INTO CACHE t1 INDEX (`PRIMARY`,`inx_b`) IGNORE LEAVES;
+LOAD INDEX INTO CACHE t1 INDEX (`inx_b`) IGNORE LEAVES;
+LOAD INDEX INTO CACHE t1 INDEX (`PRIMARY`) IGNORE LEAVES;
+LOAD INDEX INTO CACHE t1 INDEX (`PRIMARY`,`inx_b`);
+LOAD INDEX INTO CACHE t1 PARTITION (p1) INDEX (`PRIMARY`);
+LOAD INDEX INTO CACHE t1 PARTITION (`p1`,p0) KEY (`PRIMARY`) IGNORE LEAVES;
+LOAD INDEX INTO CACHE t1 PARTITION (ALL);
+--error ER_PARSE_ERROR
+LOAD INDEX INTO CACHE t1 PARTITIONS ALL;
+LOAD INDEX INTO CACHE t1 PARTITION (p1,`p0`) IGNORE LEAVES;
+DROP INDEX `inx_b` on t1;
+DROP INDEX `inx_b` on t2;
+--error ER_PARTITION_MGMT_ON_NONPARTITIONED
+CACHE INDEX t2 PARTITION (p0) KEY (`inx_b`) IN hot_cache;
+CACHE INDEX t2 INDEX (`inx_b`) IN hot_cache;
+CACHE INDEX t1 PARTITION (p0) KEY (`inx_b`) IN hot_cache;
+CACHE INDEX t1 INDEX (`inx_b`) IN hot_cache;
+DROP TABLE t1,t2;
+SET GLOBAL hot_cache.key_buffer_size = 0;
+SET GLOBAL warm_cache.key_buffer_size = 0;
+SET @@global.cold_cache.key_buffer_size = 0;
+SELECT @@global.default.key_buffer_size a, @@global.default.key_cache_block_size b, @@global.default.key_cache_age_threshold c, @@global.default.key_cache_division_limit d;
+SELECT @@global.hot_cache.key_buffer_size a, @@global.hot_cache.key_cache_block_size b, @@global.hot_cache.key_cache_age_threshold c, @@global.hot_cache.key_cache_division_limit d;
+SELECT @@global.warm_cache.key_buffer_size a, @@global.warm_cache.key_cache_block_size b, @@global.warm_cache.key_cache_age_threshold c, @@global.warm_cache.key_cache_division_limit d;
+SELECT @@global.cold_cache.key_buffer_size a, @@global.cold_cache.key_cache_block_size b, @@global.cold_cache.key_cache_age_threshold c, @@global.cold_cache.key_cache_division_limit d;
+--disable_warnings
+SET @@global.default.key_buffer_size = @org_key_cache_buffer_size;
+--enable_warnings
diff --git a/mysql-test/t/partition_range.test b/mysql-test/t/partition_range.test
index 07c345faed5..6c0b5ca77d6 100644
--- a/mysql-test/t/partition_range.test
+++ b/mysql-test/t/partition_range.test
@@ -9,6 +9,16 @@
drop table if exists t1, t2;
--enable_warnings
+#
+#BUG#49591, Add proper version number to SHOW CREATE TABLE
+#
+create table t1 (a int)
+partition by range (a)
+subpartition by hash(to_seconds(a))
+(partition p0 values less than (1));
+show create table t1;
+drop table t1;
+
--error ER_NULL_IN_VALUES_LESS_THAN
create table t1 (a int)
partition by range (a)
@@ -30,6 +40,7 @@ explain partitions select * from t1 where a < '2007-03-08 00:00:01';
explain partitions select * from t1 where a <= '2007-03-08 00:00:00';
explain partitions select * from t1 where a <= '2007-03-07 23:59:59';
explain partitions select * from t1 where a < '2007-03-07 23:59:59';
+show create table t1;
drop table t1;
#
# New test cases for new function to_seconds
@@ -44,6 +55,7 @@ explain partitions select * from t1 where a <= '2003-12-31';
select * from t1 where a <= '2003-12-31';
explain partitions select * from t1 where a <= '2005-01-01';
select * from t1 where a <= '2005-01-01';
+show create table t1;
drop table t1;
create table t1 (a datetime)
@@ -56,6 +68,7 @@ explain partitions select * from t1 where a <= '2004-01-01 11:59.59';
select * from t1 where a <= '2004-01-01 11:59:59';
explain partitions select * from t1 where a <= '2005-01-01';
select * from t1 where a <= '2005-01-01';
+show create table t1;
drop table t1;
#
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index 0edc9cca385..d6e73cbc88d 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -94,10 +94,6 @@ select sql_cache * from t1 union select * from t1;
set query_cache_type=2;
select sql_cache * from t1 union select * from t1;
-# all sql_cache statements, except for the first select, are ignored.
-select * from t1 union select sql_cache * from t1;
-select * from t1 where a IN (select sql_cache a from t1);
-select * from t1 where a IN (select a from t1 union select sql_cache a from t1);
show status like "Qcache_hits";
show status like "Qcache_queries_in_cache";
set query_cache_type=on;
@@ -110,15 +106,6 @@ show status like "Qcache_queries_in_cache";
# SELECT SQL_NO_CACHE
#
select sql_no_cache * from t1;
-# sql_no_cache can occur in any nested select to turn on cacheing for the whole
-# expression and it will always override a sql_cache statement.
-select * from t1 union select sql_no_cache * from t1;
-select * from t1 where a IN (select sql_no_cache a from t1);
-select * from t1 where a IN (select a from t1 union select sql_no_cache a from t1);
-select sql_cache sql_no_cache * from t1;
-select sql_cache * from t1 union select sql_no_cache * from t1;
-select sql_cache * from t1 where a IN (select sql_no_cache a from t1);
-select sql_cache * from t1 where a IN (select a from t1 union select sql_no_cache a from t1);
show status like "Qcache_queries_in_cache";
drop table t1;
#
@@ -1044,22 +1031,25 @@ set GLOBAL query_cache_size= default;
# Bug #29053 SQL_CACHE in UNION causes non-deterministic functions to be cached
#
-set GLOBAL query_cache_size=1000000;
-
-create table t1 (a char);
-insert into t1 values ('c');
-
-let $q1= `select RAND() from t1 union select sql_cache 1 from t1;`;
-let $q2= `select RAND() from t1 union select sql_cache 1 from t1;`;
-
+# This syntax is no longer allowed, therefore the test case has been commented
+# out.
+# See test for Bug#35020 below.
+#set GLOBAL query_cache_size=1000000;
+#
+#create table t1 (a char);
+#insert into t1 values ('c');
+#
+#let $q1= `select RAND() from t1 union select sql_cache 1 from t1;`;
+#let $q2= `select RAND() from t1 union select sql_cache 1 from t1;`;
+#
# disabling the logging of the query because the times are different each run.
---disable_query_log
-eval select a from t1 where "$q1" = "$q2";
---enable_query_log
-
-drop table t1;
-
-set GLOBAL query_cache_size= default;
+#--disable_query_log
+#eval select a from t1 where "$q1" = "$q2";
+#--enable_query_log
+#
+#drop table t1;
+#
+#set GLOBAL query_cache_size= default;
#
# Bug#29856: Insufficient buffer space led to a server crash.
@@ -1307,5 +1297,69 @@ SELECT 1 FROM t1 GROUP BY
DROP TABLE t1;
SET GLOBAL query_cache_size= default;
---echo End of 5.1 tests
+#
+# Bug#35020: illegal sql_cache select syntax
+#
+CREATE TABLE t1( a INT );
+
+--error ER_PARSE_ERROR
+SET @v = ( SELECT SQL_CACHE 1 );
+--error ER_PARSE_ERROR
+SET @v = ( SELECT SQL_NO_CACHE 1 );
+
+#
+# Keywords 'SQL_CACHE' and 'SQL_NO_CACHE' are allowed as column names.
+# Hence the error messages are not intuitive.
+#
+--error ER_BAD_FIELD_ERROR
+SELECT a FROM t1 WHERE a IN ( SELECT SQL_CACHE a FROM t1 );
+--error ER_BAD_FIELD_ERROR
+SELECT a FROM t1 WHERE a IN ( SELECT SQL_NO_CACHE a FROM t1 );
+--error ER_BAD_FIELD_ERROR
+SELECT ( SELECT SQL_CACHE a FROM t1 );
+--error ER_BAD_FIELD_ERROR
+SELECT ( SELECT SQL_NO_CACHE a FROM t1 );
+
+SELECT SQL_CACHE * FROM t1;
+SELECT SQL_NO_CACHE * FROM t1;
+
+# SQL_CACHE is only allowed once in first top-level select.
+--error ER_CANT_USE_OPTION_HERE
+SELECT * FROM t1 UNION SELECT SQL_CACHE * FROM t1;
+--error ER_CANT_USE_OPTION_HERE
+SELECT * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
+--error ER_BAD_FIELD_ERROR
+SELECT * FROM t1 WHERE a IN (SELECT SQL_CACHE a FROM t1);
+--error ER_BAD_FIELD_ERROR
+SELECT * FROM t1 WHERE a IN (SELECT a FROM t1 UNION SELECT SQL_CACHE a FROM t1);
+
+--error ER_CANT_USE_OPTION_HERE
+SELECT * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
+--error ER_BAD_FIELD_ERROR
+SELECT * FROM t1 WHERE a IN (SELECT SQL_NO_CACHE a FROM t1);
+--error ER_BAD_FIELD_ERROR
+SELECT * FROM t1 WHERE a IN
+ (SELECT a FROM t1 UNION SELECT SQL_NO_CACHE a FROM t1);
+--error ER_WRONG_USAGE
+SELECT SQL_CACHE SQL_NO_CACHE * FROM t1;
+--error ER_WRONG_USAGE
+SELECT SQL_NO_CACHE SQL_CACHE * FROM t1;
+--error ER_CANT_USE_OPTION_HERE
+SELECT SQL_CACHE * FROM t1 UNION SELECT SQL_CACHE * FROM t1;
+--error ER_CANT_USE_OPTION_HERE
+SELECT SQL_CACHE * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
+--error ER_CANT_USE_OPTION_HERE
+SELECT SQL_NO_CACHE * FROM t1 UNION SELECT SQL_CACHE * FROM t1;
+--error ER_CANT_USE_OPTION_HERE
+SELECT SQL_NO_CACHE * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
+--error ER_BAD_FIELD_ERROR
+SELECT SQL_CACHE * FROM t1 WHERE a IN
+ (SELECT SQL_NO_CACHE a FROM t1);
+--error ER_BAD_FIELD_ERROR
+SELECT SQL_CACHE * FROM t1 WHERE a IN
+ (SELECT a FROM t1 UNION SELECT SQL_NO_CACHE a FROM t1);
+
+DROP TABLE t1;
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 3d4f5a654c2..9d80650da2f 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -550,18 +550,14 @@ CREATE VIEW v1 AS SELECT SQL_NO_CACHE NOW();
SHOW CREATE VIEW v1;
DROP VIEW v1;
-# Check that SQL_NO_CACHE always wins.
+--error ER_WRONG_USAGE
CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE NOW();
-SHOW CREATE VIEW v1;
-DROP VIEW v1;
+--error ER_WRONG_USAGE
CREATE VIEW v1 AS SELECT SQL_NO_CACHE SQL_CACHE NOW();
-SHOW CREATE VIEW v1;
-DROP VIEW v1;
+--error ER_WRONG_USAGE
CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE SQL_CACHE NOW();
-SHOW CREATE VIEW v1;
-DROP VIEW v1;
# Check CREATE VIEW in a prepared statement in a procedure.
delimiter |;
diff --git a/plugin/semisync/CMakeLists.txt b/plugin/semisync/CMakeLists.txt
index ad26298b0b7..cf8863e970f 100644
--- a/plugin/semisync/CMakeLists.txt
+++ b/plugin/semisync/CMakeLists.txt
@@ -15,9 +15,6 @@
# This is CMakeLists.txt for semi-sync replication plugins
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
-SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
-
# Add common include directories
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib
${CMAKE_SOURCE_DIR}/sql
diff --git a/sql/item.h b/sql/item.h
index 44892deb2c2..4dc65c52843 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -894,6 +894,15 @@ public:
(*traverser)(this, arg);
}
+ /*
+ This is used to get the most recent version of any function in
+ an item tree. The version is the version where a MySQL function
+ was introduced in. So any function which is added should use
+ this function and set the int_arg to maximum of the input data
+ and their own version info.
+ */
+ virtual bool intro_version(uchar *int_arg) { return 0; }
+
virtual bool remove_dependence_processor(uchar * arg) { return 0; }
virtual bool remove_fixed(uchar * arg) { fixed= 0; return 0; }
virtual bool cleanup_processor(uchar *arg);
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index b25812299f0..f6c316c15c6 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -91,6 +91,15 @@ public:
enum_monotonicity_info get_monotonicity_info() const;
longlong val_int_endpoint(bool left_endp, bool *incl_endp);
bool check_partition_func_processor(uchar *bool_arg) { return FALSE;}
+
+ bool intro_version(uchar *int_arg)
+ {
+ int *input_version= (int*)int_arg;
+ /* This function was introduced in 5.5 */
+ int output_version= (*input_version, 50500);
+ *input_version= output_version;
+ return 0;
+ }
};
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 56d79ac0d45..65029a817de 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -116,6 +116,42 @@ char *partition_info::create_default_partition_names(uint part_no,
/*
+ Generate a version string for partition expression
+ This function must be updated every time there is a possibility for
+ a new function of a higher version number than 5.5.0.
+
+ SYNOPSIS
+ set_show_version_string()
+ RETURN VALUES
+ None
+*/
+void partition_info::set_show_version_string(String *packet)
+{
+ int version= 0;
+ if (column_list)
+ packet->append(STRING_WITH_LEN("\n/*!50500"));
+ else
+ {
+ if (part_expr)
+ part_expr->walk(&Item::intro_version, 0, (uchar*)&version);
+ if (subpart_expr)
+ subpart_expr->walk(&Item::intro_version, 0, (uchar*)&version);
+ if (version == 0)
+ {
+ /* No new functions in partition function */
+ packet->append(STRING_WITH_LEN("\n/*!50100"));
+ }
+ else
+ {
+ char buf[65];
+ char *buf_ptr= longlong10_to_str((longlong)version, buf, 10);
+ packet->append(STRING_WITH_LEN("\n/*!"));
+ packet->append(buf, (size_t)(buf_ptr - buf));
+ }
+ }
+}
+
+/*
Create a unique name for the subpartition as part_name'sp''subpart_no'
SYNOPSIS
create_subpartition_name()
diff --git a/sql/partition_info.h b/sql/partition_info.h
index 0ac8dec4945..479714a3928 100644
--- a/sql/partition_info.h
+++ b/sql/partition_info.h
@@ -302,6 +302,7 @@ public:
bool check_partition_field_length();
bool init_column_part();
bool add_column_list_value(THD *thd, Item *item);
+ void set_show_version_string(String *packet);
private:
static int list_part_cmp(const void* a, const void* b);
bool set_up_default_partitions(handler *file, HA_CREATE_INFO *info,
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index bf92717e79d..cb77f2b2a1d 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1468,7 +1468,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
show_table_options,
NULL, NULL))))
{
- packet->append(STRING_WITH_LEN("\n/*!50100"));
+ table->part_info->set_show_version_string(packet);
packet->append(part_syntax, part_syntax_len);
packet->append(STRING_WITH_LEN(" */"));
my_free(part_syntax, MYF(0));
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 0b0c4913476..0d3610ccee1 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -763,10 +763,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%pure_parser /* We have threads */
/*
- Currently there are 173 shift/reduce conflicts.
+ Currently there are 172 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
-%expect 173
+%expect 172
/*
Comments for TOKENS.
@@ -7151,50 +7151,63 @@ select_option_list:
;
select_option:
- STRAIGHT_JOIN { Select->options|= SELECT_STRAIGHT_JOIN; }
- | HIGH_PRIORITY
+ query_expression_option
+ | SQL_NO_CACHE_SYM
{
- if (check_simple_select())
+ /*
+ Allow this flag only on the first top-level SELECT statement, if
+ SQL_CACHE wasn't specified, and only once per query.
+ */
+ if (Lex->current_select != &Lex->select_lex)
+ {
+ my_error(ER_CANT_USE_OPTION_HERE, MYF(0), "SQL_NO_CACHE");
MYSQL_YYABORT;
- Lex->lock_option= TL_READ_HIGH_PRIORITY;
- Lex->current_select->lock_option= TL_READ_HIGH_PRIORITY;
- }
- | DISTINCT { Select->options|= SELECT_DISTINCT; }
- | SQL_SMALL_RESULT { Select->options|= SELECT_SMALL_RESULT; }
- | SQL_BIG_RESULT { Select->options|= SELECT_BIG_RESULT; }
- | SQL_BUFFER_RESULT
- {
- if (check_simple_select())
+ }
+ else if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_CACHE)
+ {
+ my_error(ER_WRONG_USAGE, MYF(0), "SQL_CACHE", "SQL_NO_CACHE");
MYSQL_YYABORT;
- Select->options|= OPTION_BUFFER_RESULT;
- }
- | SQL_CALC_FOUND_ROWS
- {
- if (check_simple_select())
+ }
+ else if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_NO_CACHE)
+ {
+ my_error(ER_DUP_ARGUMENT, MYF(0), "SQL_NO_CACHE");
MYSQL_YYABORT;
- Select->options|= OPTION_FOUND_ROWS;
- }
- | SQL_NO_CACHE_SYM
- {
- Lex->safe_to_cache_query=0;
- Lex->select_lex.options&= ~OPTION_TO_QUERY_CACHE;
- Lex->select_lex.sql_cache= SELECT_LEX::SQL_NO_CACHE;
+ }
+ else
+ {
+ Lex->safe_to_cache_query=0;
+ Lex->select_lex.options&= ~OPTION_TO_QUERY_CACHE;
+ Lex->select_lex.sql_cache= SELECT_LEX::SQL_NO_CACHE;
+ }
}
| SQL_CACHE_SYM
{
- /*
- Honor this flag only if SQL_NO_CACHE wasn't specified AND
- we are parsing the outermost SELECT in the query.
- */
- if (Lex->select_lex.sql_cache != SELECT_LEX::SQL_NO_CACHE &&
- Lex->current_select == &Lex->select_lex)
+ /*
+ Allow this flag only on the first top-level SELECT statement, if
+ SQL_NO_CACHE wasn't specified, and only once per query.
+ */
+ if (Lex->current_select != &Lex->select_lex)
+ {
+ my_error(ER_CANT_USE_OPTION_HERE, MYF(0), "SQL_CACHE");
+ MYSQL_YYABORT;
+ }
+ else if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_NO_CACHE)
+ {
+ my_error(ER_WRONG_USAGE, MYF(0), "SQL_NO_CACHE", "SQL_CACHE");
+ MYSQL_YYABORT;
+ }
+ else if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_CACHE)
+ {
+ my_error(ER_DUP_ARGUMENT, MYF(0), "SQL_CACHE");
+ MYSQL_YYABORT;
+ }
+ else
{
Lex->safe_to_cache_query=1;
Lex->select_lex.options|= OPTION_TO_QUERY_CACHE;
Lex->select_lex.sql_cache= SELECT_LEX::SQL_CACHE;
}
}
- | ALL { Select->options|= SELECT_ALL; }
;
select_lock_type:
@@ -9266,7 +9279,7 @@ select_part2_derived:
mysql_init_select(lex);
lex->current_select->parsing_place= SELECT_LIST;
}
- select_options select_item_list
+ opt_query_expression_options select_item_list
{
Select->parsing_place= NO_MATTER;
}
@@ -13614,6 +13627,43 @@ subselect_end:
}
;
+opt_query_expression_options:
+ /* empty */
+ | query_expression_option_list
+ ;
+
+query_expression_option_list:
+ query_expression_option_list query_expression_option
+ | query_expression_option
+ ;
+
+query_expression_option:
+ STRAIGHT_JOIN { Select->options|= SELECT_STRAIGHT_JOIN; }
+ | HIGH_PRIORITY
+ {
+ if (check_simple_select())
+ MYSQL_YYABORT;
+ Lex->lock_option= TL_READ_HIGH_PRIORITY;
+ Lex->current_select->lock_option= TL_READ_HIGH_PRIORITY;
+ }
+ | DISTINCT { Select->options|= SELECT_DISTINCT; }
+ | SQL_SMALL_RESULT { Select->options|= SELECT_SMALL_RESULT; }
+ | SQL_BIG_RESULT { Select->options|= SELECT_BIG_RESULT; }
+ | SQL_BUFFER_RESULT
+ {
+ if (check_simple_select())
+ MYSQL_YYABORT;
+ Select->options|= OPTION_BUFFER_RESULT;
+ }
+ | SQL_CALC_FOUND_ROWS
+ {
+ if (check_simple_select())
+ MYSQL_YYABORT;
+ Select->options|= OPTION_FOUND_ROWS;
+ }
+ | ALL { Select->options|= SELECT_ALL; }
+ ;
+
/**************************************************************************
CREATE VIEW | TRIGGER | PROCEDURE statements.
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt
index 109531a1ace..3f9808a2022 100644
--- a/storage/innobase/CMakeLists.txt
+++ b/storage/innobase/CMakeLists.txt
@@ -15,13 +15,6 @@
# This is the CMakeLists for InnoDB Plugin
-
-# TODO: remove the two FLAGS_DEBUG settings when merging into
-# 6.0-based trees, like is already the case for other engines in
-# those trees.
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
-SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
-
# Starting at 5.1.38, MySQL CMake files are simplified. But the plugin
# CMakeLists.txt still needs to work with previous versions of MySQL.
IF (MYSQL_VERSION_ID GREATER "50137")
diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh
index ccf4d8ff51d..b5115a5c05e 100644
--- a/support-files/mysql.server.sh
+++ b/support-files/mysql.server.sh
@@ -303,7 +303,7 @@ case "$mode" in
then
mysqld_pid=`cat "$mysqld_pid_file_path"`
- if (kill -9 $mysqld_pid 2>/dev/null)
+ if (kill -0 $mysqld_pid 2>/dev/null)
then
echo $echo_n "Shutting down MySQL"
kill $mysqld_pid