summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-11-13 23:03:48 +0100
committerSergei Golubchik <sergii@pisem.net>2013-11-13 23:03:48 +0100
commit4157185f241f1583729020ba67064db0391aaa3d (patch)
treef0662e17995b49d92ed706a33c894485a67678fe
parentc155890af90ec75555fa485387a0cf11120175a6 (diff)
parentbdd883ed9a68ff1e82528cc6b33316d98894cfd2 (diff)
downloadmariadb-git-4157185f241f1583729020ba67064db0391aaa3d.tar.gz
10.0-base merge
-rw-r--r--CMakeLists.txt6
-rw-r--r--client/mysql_upgrade.c7
-rw-r--r--cmake/cpack_rpm.cmake2
-rwxr-xr-xdebian/autobake-deb.sh2
-rw-r--r--debian/dist/Debian/control15
-rw-r--r--debian/dist/Debian/mariadb-server-10.0.files.in1
-rw-r--r--debian/dist/Ubuntu/control15
-rw-r--r--debian/dist/Ubuntu/mariadb-server-10.0.files.in1
-rw-r--r--debian/mariadb-tokudb-engine-10.0.files5
-rwxr-xr-xmysql-test/mysql-test-run.pl2
-rw-r--r--mysql-test/r/func_group.result44
-rw-r--r--mysql-test/r/having.result12
-rw-r--r--mysql-test/r/plugin_maturity.result8
-rw-r--r--mysql-test/r/ps_max_subselect-5113.result16
-rw-r--r--mysql-test/r/subselect_debug.result7
-rw-r--r--mysql-test/r/subselect_mat.result21
-rw-r--r--mysql-test/r/subselect_sj_mat.result21
-rw-r--r--mysql-test/r/userstat-badlogin-4824.result16
-rw-r--r--mysql-test/suite/rpl/t/rpl_mysql_upgrade.test5
-rw-r--r--mysql-test/suite/sys_vars/r/character_sets_dir_basic.result10
-rw-r--r--mysql-test/suite/sys_vars/t/character_sets_dir_basic.test19
-rw-r--r--mysql-test/t/func_group.test53
-rw-r--r--mysql-test/t/having.test16
-rw-r--r--mysql-test/t/mysqld--help.test2
-rw-r--r--mysql-test/t/ps_max_subselect-5113.test20
-rw-r--r--mysql-test/t/subselect_debug.test10
-rw-r--r--mysql-test/t/subselect_sj_mat.test26
-rw-r--r--mysql-test/t/userstat-badlogin-4824.test33
-rw-r--r--scripts/mysqld_safe.sh68
-rw-r--r--sql/event_data_objects.cc2
-rw-r--r--sql/item_cmpfunc.h4
-rw-r--r--sql/log_event.cc6
-rw-r--r--sql/log_event_old.cc2
-rw-r--r--sql/mysqld.cc8
-rw-r--r--sql/opt_subselect.cc6
-rw-r--r--sql/opt_sum.cc24
-rw-r--r--sql/rpl_gtid.cc2
-rw-r--r--sql/rpl_rli.cc2
-rw-r--r--sql/share/errmsg-utf8.txt46
-rw-r--r--sql/sql_class.cc1
-rw-r--r--sql/sql_class.h2
-rw-r--r--sql/sql_parse.cc31
-rw-r--r--sql/sql_parse.h2
-rw-r--r--sql/sql_plugin.cc10
-rw-r--r--sql/sql_prepare.cc8
-rw-r--r--sql/sql_select.cc7
-rw-r--r--sql/sql_show.cc9
-rw-r--r--storage/myisam/ha_myisam.cc6
-rw-r--r--storage/tokudb/CMakeLists.txt18
-rw-r--r--storage/tokudb/ft-index/CMakeLists.txt2
-rw-r--r--storage/tokudb/ft-index/cmake_modules/TokuSetupCTest.cmake2
-rw-r--r--storage/tokudb/ft-index/ft/CMakeLists.txt2
-rw-r--r--support-files/rpm/server-postin.sh2
53 files changed, 515 insertions, 152 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index af92fc212de..cc526adaa04 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -362,12 +362,6 @@ IF(DEB)
CONFIGURE_FILE(
${CMAKE_SOURCE_DIR}/debian/mariadb-server-10.0.files.in
${CMAKE_SOURCE_DIR}/debian/mariadb-server-10.0.files)
- CONFIGURE_FILE(
- ${CMAKE_SOURCE_DIR}/debian/dist/Debian/mariadb-server-10.0.files.in
- ${CMAKE_SOURCE_DIR}/debian/dist/Debian/mariadb-server-10.0.files)
- CONFIGURE_FILE(
- ${CMAKE_SOURCE_DIR}/debian/dist/Ubuntu/mariadb-server-10.0.files.in
- ${CMAKE_SOURCE_DIR}/debian/dist/Ubuntu/mariadb-server-10.0.files)
ENDIF(DEB)
# Handle the "INFO_*" files.
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index 8b3f0fdec79..5f9a06dc07f 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -156,11 +156,10 @@ static struct my_option my_long_options[]=
"version\' of the program is the version of the MySQL server with which it "
"was built/distributed.", &opt_version_check, &opt_version_check, 0,
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
- {"write-binlog", OPT_WRITE_BINLOG,
- "All commands including mysqlcheck are binlogged. Enabled by default;"
- "use --skip-write-binlog when commands should not be sent to replication slaves.",
+ {"write-binlog", OPT_WRITE_BINLOG, "All commands including those, "
+ "issued by mysqlcheck, are written to the binary log.",
&opt_write_binlog, &opt_write_binlog, 0, GET_BOOL, NO_ARG,
- 1, 0, 0, 0, 0, 0},
+ 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake
index c21b863c71f..a8439fcab00 100644
--- a/cmake/cpack_rpm.cmake
+++ b/cmake/cpack_rpm.cmake
@@ -127,6 +127,8 @@ SET(CPACK_RPM_test_PACKAGE_PROVIDES "MySQL-test mysql-test")
MACRO(ALTERNATIVE_NAME real alt)
SET(p "CPACK_RPM_${real}_PACKAGE_PROVIDES")
SET(${p} "${${p}} ${alt} ${alt}(x86-32) ${alt}(x86-64) config(${alt})")
+ SET(o "CPACK_RPM_${real}_PACKAGE_OBSOLETES")
+ SET(${o} "${${o}} ${alt}")
ENDMACRO(ALTERNATIVE_NAME)
IF(RPM MATCHES "(rhel|centos)5")
diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh
index d1aefdb53d6..3ee877af482 100755
--- a/debian/autobake-deb.sh
+++ b/debian/autobake-deb.sh
@@ -15,7 +15,7 @@ set -e
# Buildbot, running the test suite from installed .debs on a clean VM.
export DEB_BUILD_OPTIONS="nocheck"
-export MARIADB_OPTIONAL_DEBS="tokudb-engine-10.0"
+#export MARIADB_OPTIONAL_DEBS="tokudb-engine"
# Find major.minor version.
#
diff --git a/debian/dist/Debian/control b/debian/dist/Debian/control
index e4c5352b40d..e9732ced10d 100644
--- a/debian/dist/Debian/control
+++ b/debian/dist/Debian/control
@@ -191,12 +191,13 @@ Depends: mariadb-client-10.0 (>= ${source:Version}), libdbi-perl, perl (>= 5.6),
Provides: mariadb-server, mysql-server, virtual-mysql-server
Conflicts: mariadb-server (<< ${source:Version}), mysql-server (<< ${source:Version}),
mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5,
- mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3
+ mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3,
+ mariadb-tokudb-engine-5.5, mariadb-tokudb-engine-10.0
Replaces: mariadb-server (<< ${source:Version}), mysql-server (<< ${source:Version}),
mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5,
mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3,
- libmariadbclient16 (<< 5.3.4),
- libmariadbclient-dev (<< 5.5.0)
+ libmariadbclient16 (<< 5.3.4), libmariadbclient-dev (<< 5.5.0),
+ mariadb-tokudb-engine-5.5, mariadb-tokudb-engine-10.0
Description: MariaDB database server binaries
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
@@ -249,11 +250,3 @@ Description: Connect storage engine for MariaDB
connections to ODBC tables and remote MySQL tables, as well as a number of
other interesting features.
-Package: mariadb-tokudb-engine-10.0
-Section: database
-Architecture: any
-Depends: mariadb-server-10.0
-Description: TokuDB storage engine for MariaDB
- TokuDB is a highly scalable, zero maintenance downtime, ACID and MVCC
- compliant MariaDB Storage Engine that offers powerful indexing-based query
- acceleration. http://www.tokutek.com/products/tokudb-for-mysql/
diff --git a/debian/dist/Debian/mariadb-server-10.0.files.in b/debian/dist/Debian/mariadb-server-10.0.files.in
index 506b9da3bc3..3bf53268728 100644
--- a/debian/dist/Debian/mariadb-server-10.0.files.in
+++ b/debian/dist/Debian/mariadb-server-10.0.files.in
@@ -73,3 +73,4 @@ usr/share/mysql/mysql_test_data_timezone.sql
@CASSANDRA_DEB_FILES@
@OQGRAPH_DEB_FILES@
@SPIDER_DEB_FILES@
+@TOKUDB_DEB_FILES@
diff --git a/debian/dist/Ubuntu/control b/debian/dist/Ubuntu/control
index 032bcc183df..7b91b0e85dc 100644
--- a/debian/dist/Ubuntu/control
+++ b/debian/dist/Ubuntu/control
@@ -185,12 +185,13 @@ Depends: mariadb-client-10.0 (>= ${source:Version}), libdbi-perl, perl (>= 5.6),
Provides: mariadb-server, mysql-server, virtual-mysql-server
Conflicts: mariadb-server (<< ${source:Version}), mysql-server (<< ${source:Version}),
mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5,
- mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3
+ mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3,
+ mariadb-tokudb-engine-5.5, mariadb-tokudb-engine-10.0
Replaces: mariadb-server (<< ${source:Version}), mysql-server (<< ${source:Version}),
mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, mysql-server-5.5,
mariadb-server-5.1, mariadb-server-5.2, mariadb-server-5.3,
- libmariadbclient16 (<< 5.3.4),
- libmariadbclient-dev (<< 5.5.0)
+ libmariadbclient16 (<< 5.3.4), libmariadbclient-dev (<< 5.5.0),
+ mariadb-tokudb-engine-5.5, mariadb-tokudb-engine-10.0
Description: MariaDB database server binaries
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
@@ -243,11 +244,3 @@ Description: Connect storage engine for MariaDB
connections to ODBC tables and remote MySQL tables, as well as a number of
other interesting features.
-Package: mariadb-tokudb-engine-10.0
-Section: database
-Architecture: any
-Depends: mariadb-server-10.0
-Description: TokuDB storage engine for MariaDB
- TokuDB is a highly scalable, zero maintenance downtime, ACID and MVCC
- compliant MariaDB Storage Engine that offers powerful indexing-based query
- acceleration. http://www.tokutek.com/products/tokudb-for-mysql/
diff --git a/debian/dist/Ubuntu/mariadb-server-10.0.files.in b/debian/dist/Ubuntu/mariadb-server-10.0.files.in
index 87c3eee67c2..b83fedce12a 100644
--- a/debian/dist/Ubuntu/mariadb-server-10.0.files.in
+++ b/debian/dist/Ubuntu/mariadb-server-10.0.files.in
@@ -75,3 +75,4 @@ usr/share/mysql/mysql_test_data_timezone.sql
@CASSANDRA_DEB_FILES@
@OQGRAPH_DEB_FILES@
@SPIDER_DEB_FILES@
+@TOKUDB_DEB_FILES@
diff --git a/debian/mariadb-tokudb-engine-10.0.files b/debian/mariadb-tokudb-engine-10.0.files
deleted file mode 100644
index a0690e6d1c2..00000000000
--- a/debian/mariadb-tokudb-engine-10.0.files
+++ /dev/null
@@ -1,5 +0,0 @@
-etc/mysql/conf.d/tokudb.cnf
-usr/bin/tokuftdump
-usr/lib/mysql/plugin/ha_tokudb.so
-usr/share/doc/mariadb-tokudb-engine-10.0/README-TOKUDB
-usr/share/doc/mariadb-tokudb-engine-10.0/README.md
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index bd3a7f8d81d..4f49cd2ab6a 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -1908,7 +1908,7 @@ sub collect_mysqld_features {
my @list= split '\n', $list;
mtr_error("Could not find version of MariaDB")
- unless shift(@list) =~ /^$exe_mysqld\s+Ver\s(\d+)\.(\d+)\.(\d+)(\S*)/;
+ unless shift(@list) =~ /^\Q$exe_mysqld\E\s+Ver\s(\d+)\.(\d+)\.(\d+)(\S*)/;
$mysql_version_id= $1*10000 + $2*100 + $3;
$mysql_version_extra= $4;
mtr_report("MariaDB Version $1.$2.$3$4");
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index 9049589b6db..8e50c045775 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -2186,3 +2186,47 @@ AVG(DISTINCT outr.col_int_nokey)
7.5000
DROP TABLE t1;
# End of the bug#57932
+#
+# MDEV-5257: MIN/MAX Optimization (Select tables optimized away) does not work for DateTime
+# MDEV-3855: MIN/MAX optimization doesnt work for int_col > INET_ATON
+# (correct the fix for Bug #884175)
+#
+CREATE TABLE `t1` (
+`a` int(11) NOT NULL AUTO_INCREMENT,
+`b` datetime DEFAULT NULL,
+PRIMARY KEY (`a`),
+KEY `idx_b` (`b`)
+);
+INSERT INTO `t1` (b) VALUES ('2013-01-06 23:59:59');
+INSERT INTO `t1` (b) VALUES ('2013-02-06 23:59:59');
+INSERT INTO `t1` (b) VALUES ('2013-03-06 23:59:59');
+INSERT INTO `t1` (b) VALUES ('2013-04-06 23:59:59');
+INSERT INTO `t1` (b) VALUES ('2013-05-06 23:59:59');
+INSERT INTO `t1` (b) VALUES ('2013-06-06 23:59:59');
+INSERT INTO `t1` (b) VALUES ('2013-07-06 23:59:59');
+# The following should produce "Select tables optimized away"
+EXPLAIN SELECT MIN(b) FROM t1 WHERE b <= '2013-11-06 23:59:59';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+set names utf8;
+# Should be the same as above:
+EXPLAIN SELECT MIN(b) FROM t1 WHERE b <= '2013-11-06 23:59:59';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+DROP TABLE t1;
+CREATE TABLE `t1` (
+`a` int(11) NOT NULL AUTO_INCREMENT,
+`b` bigint(20) DEFAULT NULL,
+PRIMARY KEY (`a`),
+KEY `idx_b` (`b`)
+);
+insert into t1 (b) values (INET_ATON('192.168.0.1'));
+insert into t1 (b) values (INET_ATON('192.168.0.2'));
+insert into t1 (b) values (INET_ATON('192.168.0.3'));
+insert into t1 (b) values (INET_ATON('192.168.0.4'));
+insert into t1 (b) values (INET_ATON('192.168.200.200'));
+# should show "Select tables optimized away"
+explain select MIN(b) from t1 where b >= inet_aton('192.168.119.32');
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+DROP TABLE t1;
diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result
index a0a4fc42e2d..1f09ba6cef5 100644
--- a/mysql-test/r/having.result
+++ b/mysql-test/r/having.result
@@ -637,3 +637,15 @@ Note 1003 select min(`test`.`t1`.`f10`) AS `field1` from `test`.`t1` where <expr
set optimizer_switch=@save_optimizer_switch;
drop table t1,t2,t3;
End of 5.2 tests
+#
+# Bug mdev-5160: two-way join with HAVING over the second table
+#
+CREATE TABLE t1 (c1 varchar(6)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('s'), ('t'), ('a'), ('x');
+CREATE TABLE t2 (c2 varchar(6)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('a'), ('x');
+SELECT * FROM t1 JOIN t2 ON c1 = c2 HAVING c2 > 'a' ORDER BY c2 LIMIT 1;
+c1 c2
+x x
+DROP TABLE t1,t2;
+End of 10.0 tests
diff --git a/mysql-test/r/plugin_maturity.result b/mysql-test/r/plugin_maturity.result
index 3249ea9b3c1..cd47830cbd3 100644
--- a/mysql-test/r/plugin_maturity.result
+++ b/mysql-test/r/plugin_maturity.result
@@ -1,8 +1,8 @@
INSTALL PLUGIN example SONAME 'ha_example.so';
-ERROR HY000: Can't open shared library 'ha_example.so' (errno: 0 Loading of experimental plugin EXAMPLE is prohibited by --plugin-maturity=stable)
+ERROR HY000: Can't open shared library 'ha_example.so' (errno: 1, Loading of experimental plugin EXAMPLE is prohibited by --plugin-maturity=stable)
INSTALL SONAME 'ha_example.so';
-ERROR HY000: Can't open shared library 'ha_example.so' (errno: 0 Loading of experimental plugin EXAMPLE is prohibited by --plugin-maturity=stable)
+ERROR HY000: Can't open shared library 'ha_example.so' (errno: 1, Loading of experimental plugin EXAMPLE is prohibited by --plugin-maturity=stable)
show warnings;
Level Code Message
-Error 1126 Can't open shared library 'ha_example.so' (errno: 0 Loading of experimental plugin EXAMPLE is prohibited by --plugin-maturity=stable)
-Error 1126 Can't open shared library 'ha_example.so' (errno: 0 Loading of experimental plugin UNUSABLE is prohibited by --plugin-maturity=stable)
+Error 1126 Can't open shared library 'ha_example.so' (errno: 1, Loading of experimental plugin EXAMPLE is prohibited by --plugin-maturity=stable)
+Error 1126 Can't open shared library 'ha_example.so' (errno: 1, Loading of experimental plugin UNUSABLE is prohibited by --plugin-maturity=stable)
diff --git a/mysql-test/r/ps_max_subselect-5113.result b/mysql-test/r/ps_max_subselect-5113.result
new file mode 100644
index 00000000000..427ef628ead
--- /dev/null
+++ b/mysql-test/r/ps_max_subselect-5113.result
@@ -0,0 +1,16 @@
+CREATE TABLE t1 (b INT NOT NULL);
+INSERT INTO t1 VALUES (0),(8);
+PREPARE stmt FROM '
+ SELECT 1 FROM t1 AS o
+ WHERE o.b >= ALL (
+ SELECT a2.b FROM t1 AS a1 LEFT JOIN t1 AS a2 ON ( a2.b = a1.b )
+ WHERE a1.b <= a2.b
+ )
+';
+EXECUTE stmt;
+1
+1
+EXECUTE stmt;
+1
+1
+DROP TABLE t1;
diff --git a/mysql-test/r/subselect_debug.result b/mysql-test/r/subselect_debug.result
index 1d54369530b..9be53ae0473 100644
--- a/mysql-test/r/subselect_debug.result
+++ b/mysql-test/r/subselect_debug.result
@@ -11,3 +11,10 @@ REVERSE(EXISTS(SELECT RAND() FROM t1))
0
SET GLOBAL debug_dbug=@orig_debug;
DROP TABLE t1;
+create table t1 (i int);
+insert into t1 values (1),(2);
+select * from t1 where (i < 200 or i = 300) and i in (select i from t1);
+i
+1
+2
+drop table t1;
diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result
index 05635dd0985..22a5c3abd78 100644
--- a/mysql-test/r/subselect_mat.result
+++ b/mysql-test/r/subselect_mat.result
@@ -2038,6 +2038,27 @@ SELECT * FROM t1 WHERE 8 IN (SELECT MIN(pk) FROM t1) AND (pk = a OR pk = b);
pk a b
DROP TABLE t1;
# End of 5.3 tests
+#
+# MDEV-5056: Wrong result (extra rows) with materialization+semijoin, IN subqueries
+#
+set @tmp_mdev5056=@@join_cache_level;
+SET join_cache_level = 2;
+CREATE TABLE t1 ( c1 VARCHAR(2), c2 VARCHAR(2), INDEX(c1) ) ENGINE=MyISAM;
+INSERT INTO t1 VALUES
+('JP','OM'),('VA','JP'),('CA','ML'),('ML','EG'),('DK','CA'),
+('DK','QA'),('YE','PL'),('TR','ZW'),('DK','SK'),('SK','DK'),
+('RO','ML'),('ML','BG'),('BG','ZW'),('ZW','GE'),('GE','JP'),
+('PL','EG'),('QA','YE'),('WF','DK'),('DK','JP'),('EG','OM');
+CREATE TABLE t2 ( c3 VARCHAR(2), c4 VARCHAR(2) ) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('CA','ML'),('IN','HU'),('HU','IN');
+SELECT * FROM t1 AS alias1, t1 AS alias2
+WHERE ( alias2.c2, alias1.c1 ) IN ( SELECT c4, c3 FROM t2 ) AND alias1.c1 IN ( SELECT c2 FROM t1 );
+c1 c2 c1 c2
+CA ML CA ML
+CA ML RO ML
+DROP TABLE t1,t2;
+set join_cache_level=@tmp_mdev5056;
+# End of 5.5 tests
set @subselect_mat_test_optimizer_switch_value=null;
set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off';
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
diff --git a/mysql-test/r/subselect_sj_mat.result b/mysql-test/r/subselect_sj_mat.result
index 15cb9eeaa0e..a5629d33bfe 100644
--- a/mysql-test/r/subselect_sj_mat.result
+++ b/mysql-test/r/subselect_sj_mat.result
@@ -2078,3 +2078,24 @@ SELECT * FROM t1 WHERE 8 IN (SELECT MIN(pk) FROM t1) AND (pk = a OR pk = b);
pk a b
DROP TABLE t1;
# End of 5.3 tests
+#
+# MDEV-5056: Wrong result (extra rows) with materialization+semijoin, IN subqueries
+#
+set @tmp_mdev5056=@@join_cache_level;
+SET join_cache_level = 2;
+CREATE TABLE t1 ( c1 VARCHAR(2), c2 VARCHAR(2), INDEX(c1) ) ENGINE=MyISAM;
+INSERT INTO t1 VALUES
+('JP','OM'),('VA','JP'),('CA','ML'),('ML','EG'),('DK','CA'),
+('DK','QA'),('YE','PL'),('TR','ZW'),('DK','SK'),('SK','DK'),
+('RO','ML'),('ML','BG'),('BG','ZW'),('ZW','GE'),('GE','JP'),
+('PL','EG'),('QA','YE'),('WF','DK'),('DK','JP'),('EG','OM');
+CREATE TABLE t2 ( c3 VARCHAR(2), c4 VARCHAR(2) ) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('CA','ML'),('IN','HU'),('HU','IN');
+SELECT * FROM t1 AS alias1, t1 AS alias2
+WHERE ( alias2.c2, alias1.c1 ) IN ( SELECT c4, c3 FROM t2 ) AND alias1.c1 IN ( SELECT c2 FROM t1 );
+c1 c2 c1 c2
+CA ML CA ML
+CA ML RO ML
+DROP TABLE t1,t2;
+set join_cache_level=@tmp_mdev5056;
+# End of 5.5 tests
diff --git a/mysql-test/r/userstat-badlogin-4824.result b/mysql-test/r/userstat-badlogin-4824.result
new file mode 100644
index 00000000000..8362e8d5239
--- /dev/null
+++ b/mysql-test/r/userstat-badlogin-4824.result
@@ -0,0 +1,16 @@
+create user foo@localhost identified by 'foo';
+flush user_statistics;
+set global userstat=1;
+select 1;
+1
+1
+select user, bytes_received from information_schema.user_statistics where user = 'foo';
+user bytes_received
+foo 18
+connect(localhost,foo,bar,test,MASTER_PORT,MASTER_SOCKET);
+ERROR 28000: Access denied for user 'foo'@'localhost' (using password: YES)
+select user, bytes_received from information_schema.user_statistics where user = 'foo';
+user bytes_received
+foo 18
+drop user foo@localhost;
+set global userstat=0;
diff --git a/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test b/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test
index 597e3f8a590..398768e87bf 100644
--- a/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test
+++ b/mysql-test/suite/rpl/t/rpl_mysql_upgrade.test
@@ -25,8 +25,7 @@ connection master;
let $before_position= query_get_value(SHOW MASTER STATUS, Position, 1);
#With '--force' option, mysql_upgrade always executes all sql statements for upgrading.
-#--skip-write-binlog option disables binlog.
---exec $MYSQL_UPGRADE --skip-write-binlog --skip-verbose --force --user=root > $MYSQLTEST_VARDIR/log/mysql_upgrade.log 2>&1
+--exec $MYSQL_UPGRADE --skip-verbose --force --user=root > $MYSQLTEST_VARDIR/log/mysql_upgrade.log 2>&1
sync_slave_with_master;
connection master;
@@ -44,7 +43,7 @@ source include/wait_for_slave_sql_to_stop.inc;
connection master;
#With '--force' option, mysql_upgrade always executes all sql statements for upgrading.
---exec $MYSQL_UPGRADE --skip-verbose --force --user=root > $MYSQLTEST_VARDIR/log/mysql_upgrade.log 2>&1
+--exec $MYSQL_UPGRADE --skip-verbose --write-binlog --force --user=root > $MYSQLTEST_VARDIR/log/mysql_upgrade.log 2>&1
connection master;
let $after_file= query_get_value(SHOW MASTER STATUS, File, 1);
diff --git a/mysql-test/suite/sys_vars/r/character_sets_dir_basic.result b/mysql-test/suite/sys_vars/r/character_sets_dir_basic.result
index ef8ec0cd9b8..c04e5dac199 100644
--- a/mysql-test/suite/sys_vars/r/character_sets_dir_basic.result
+++ b/mysql-test/suite/sys_vars/r/character_sets_dir_basic.result
@@ -1,20 +1,20 @@
select @@global.character_sets_dir;
@@global.character_sets_dir
-MYSQL_CHARSETSDIR
+MYSQL_CHARSETSDIR/
select @@session.character_sets_dir;
ERROR HY000: Variable 'character_sets_dir' is a GLOBAL variable
show global variables like 'character_sets_dir';
Variable_name Value
-character_sets_dir MYSQL_CHARSETSDIR
+character_sets_dir MYSQL_CHARSETSDIR/
show session variables like 'character_sets_dir';
Variable_name Value
-character_sets_dir MYSQL_CHARSETSDIR
+character_sets_dir MYSQL_CHARSETSDIR/
select * from information_schema.global_variables where variable_name='character_sets_dir';
VARIABLE_NAME VARIABLE_VALUE
-CHARACTER_SETS_DIR MYSQL_CHARSETSDIR
+CHARACTER_SETS_DIR MYSQL_CHARSETSDIR/
select * from information_schema.session_variables where variable_name='character_sets_dir';
VARIABLE_NAME VARIABLE_VALUE
-CHARACTER_SETS_DIR MYSQL_CHARSETSDIR
+CHARACTER_SETS_DIR MYSQL_CHARSETSDIR/
set global character_sets_dir="foo";
ERROR HY000: Variable 'character_sets_dir' is a read only variable
set session character_sets_dir="foo";
diff --git a/mysql-test/suite/sys_vars/t/character_sets_dir_basic.test b/mysql-test/suite/sys_vars/t/character_sets_dir_basic.test
index 5baff405d28..0bbfd04133d 100644
--- a/mysql-test/suite/sys_vars/t/character_sets_dir_basic.test
+++ b/mysql-test/suite/sys_vars/t/character_sets_dir_basic.test
@@ -2,26 +2,17 @@
#
# show the global and session values;
#
-
-# workaround to adjust for the directory separators being different in
-# different OSes : slash on unixes and backslash or slash on windows.
-# TODO: fix with a proper comparison in mysqltest
-let $rcd= `SELECT REPLACE('$MYSQL_CHARSETSDIR', '\\\\\', '.')`;
-let $rcd= `SELECT REPLACE('$rcd', '/', '.')`;
-let $regex_charsetdir= `SELECT '/$rcd[[:punct:]]/MYSQL_CHARSETSDIR/'`;
-
---replace_regex $regex_charsetdir
+--replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR
select @@global.character_sets_dir;
-
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.character_sets_dir;
---replace_regex $regex_charsetdir
+--replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR
show global variables like 'character_sets_dir';
---replace_regex $regex_charsetdir
+--replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR
show session variables like 'character_sets_dir';
---replace_regex $regex_charsetdir
+--replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR
select * from information_schema.global_variables where variable_name='character_sets_dir';
---replace_regex $regex_charsetdir
+--replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR
select * from information_schema.session_variables where variable_name='character_sets_dir';
#
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 0c2f28ab25d..cf5f00c3ee1 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -1465,3 +1465,56 @@ SELECT AVG(DISTINCT outr.col_int_nokey) FROM t1 AS outr LEFT JOIN t1 AS outr2 ON
outr.col_int_nokey = outr2.col_int_nokey;
DROP TABLE t1;
--echo # End of the bug#57932
+
+
+--echo #
+--echo # MDEV-5257: MIN/MAX Optimization (Select tables optimized away) does not work for DateTime
+--echo # MDEV-3855: MIN/MAX optimization doesnt work for int_col > INET_ATON
+--echo # (correct the fix for Bug #884175)
+--echo #
+
+CREATE TABLE `t1` (
+ `a` int(11) NOT NULL AUTO_INCREMENT,
+ `b` datetime DEFAULT NULL,
+ PRIMARY KEY (`a`),
+ KEY `idx_b` (`b`)
+);
+
+INSERT INTO `t1` (b) VALUES ('2013-01-06 23:59:59');
+INSERT INTO `t1` (b) VALUES ('2013-02-06 23:59:59');
+INSERT INTO `t1` (b) VALUES ('2013-03-06 23:59:59');
+INSERT INTO `t1` (b) VALUES ('2013-04-06 23:59:59');
+INSERT INTO `t1` (b) VALUES ('2013-05-06 23:59:59');
+INSERT INTO `t1` (b) VALUES ('2013-06-06 23:59:59');
+INSERT INTO `t1` (b) VALUES ('2013-07-06 23:59:59');
+
+--echo # The following should produce "Select tables optimized away"
+EXPLAIN SELECT MIN(b) FROM t1 WHERE b <= '2013-11-06 23:59:59';
+
+-- connect (con1,localhost,root,,)
+-- connection con1
+set names utf8;
+-- echo # Should be the same as above:
+EXPLAIN SELECT MIN(b) FROM t1 WHERE b <= '2013-11-06 23:59:59';
+
+--connection default
+--disconnect con1
+
+DROP TABLE t1;
+
+CREATE TABLE `t1` (
+ `a` int(11) NOT NULL AUTO_INCREMENT,
+ `b` bigint(20) DEFAULT NULL,
+ PRIMARY KEY (`a`),
+ KEY `idx_b` (`b`)
+);
+
+insert into t1 (b) values (INET_ATON('192.168.0.1'));
+insert into t1 (b) values (INET_ATON('192.168.0.2'));
+insert into t1 (b) values (INET_ATON('192.168.0.3'));
+insert into t1 (b) values (INET_ATON('192.168.0.4'));
+insert into t1 (b) values (INET_ATON('192.168.200.200'));
+--echo # should show "Select tables optimized away"
+explain select MIN(b) from t1 where b >= inet_aton('192.168.119.32');
+DROP TABLE t1;
+
diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test
index 3edf449c92d..78f6ff4a880 100644
--- a/mysql-test/t/having.test
+++ b/mysql-test/t/having.test
@@ -657,3 +657,19 @@ set optimizer_switch=@save_optimizer_switch;
drop table t1,t2,t3;
--echo End of 5.2 tests
+
+--echo #
+--echo # Bug mdev-5160: two-way join with HAVING over the second table
+--echo #
+
+CREATE TABLE t1 (c1 varchar(6)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('s'), ('t'), ('a'), ('x');
+
+CREATE TABLE t2 (c2 varchar(6)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('a'), ('x');
+
+SELECT * FROM t1 JOIN t2 ON c1 = c2 HAVING c2 > 'a' ORDER BY c2 LIMIT 1;
+
+DROP TABLE t1,t2;
+
+--echo End of 10.0 tests
diff --git a/mysql-test/t/mysqld--help.test b/mysql-test/t/mysqld--help.test
index 27ace642b12..55dce60648b 100644
--- a/mysql-test/t/mysqld--help.test
+++ b/mysql-test/t/mysqld--help.test
@@ -54,7 +54,7 @@ perl;
s/\b2146435072\b/9223372036853727232/;
s/\b196608\b/262144/;
s/\b4294963200\b/18446744073709547520/;
- foreach $var (@env) { s/$ENV{$var}/$var/ }
+ foreach $var (@env) { s/\Q$ENV{$var}\E/$var/ }
next if /use --skip-(use-)?symbolic-links to disable/; # for valgrind, again
next if $skip;
print;
diff --git a/mysql-test/t/ps_max_subselect-5113.test b/mysql-test/t/ps_max_subselect-5113.test
new file mode 100644
index 00000000000..255e81c1549
--- /dev/null
+++ b/mysql-test/t/ps_max_subselect-5113.test
@@ -0,0 +1,20 @@
+#
+# MDEV-5113 Wrong result (extra row) and valgrind warnings in Item_maxmin_subselect::any_value on 2nd execution of PS with SELECT subquery
+#
+
+CREATE TABLE t1 (b INT NOT NULL);
+INSERT INTO t1 VALUES (0),(8);
+
+PREPARE stmt FROM '
+ SELECT 1 FROM t1 AS o
+ WHERE o.b >= ALL (
+ SELECT a2.b FROM t1 AS a1 LEFT JOIN t1 AS a2 ON ( a2.b = a1.b )
+ WHERE a1.b <= a2.b
+ )
+';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DROP TABLE t1;
+
diff --git a/mysql-test/t/subselect_debug.test b/mysql-test/t/subselect_debug.test
index 101311beb5c..f27867dc9d0 100644
--- a/mysql-test/t/subselect_debug.test
+++ b/mysql-test/t/subselect_debug.test
@@ -15,3 +15,13 @@ SELECT SUM(EXISTS(SELECT RAND() FROM t1)) FROM t1;
SELECT REVERSE(EXISTS(SELECT RAND() FROM t1));
SET GLOBAL debug_dbug=@orig_debug;
DROP TABLE t1;
+
+#
+# MDEV-5284 Assertion `!(*expr)->fixed' fails in replace_where_subcondition with IN suquery
+#
+
+create table t1 (i int);
+insert into t1 values (1),(2);
+select * from t1 where (i < 200 or i = 300) and i in (select i from t1);
+drop table t1;
+
diff --git a/mysql-test/t/subselect_sj_mat.test b/mysql-test/t/subselect_sj_mat.test
index e9226b8884f..58831c4ffb3 100644
--- a/mysql-test/t/subselect_sj_mat.test
+++ b/mysql-test/t/subselect_sj_mat.test
@@ -1726,3 +1726,29 @@ SELECT * FROM t1 WHERE 8 IN (SELECT MIN(pk) FROM t1) AND (pk = a OR pk = b);
DROP TABLE t1;
--echo # End of 5.3 tests
+
+
+--echo #
+--echo # MDEV-5056: Wrong result (extra rows) with materialization+semijoin, IN subqueries
+--echo #
+set @tmp_mdev5056=@@join_cache_level;
+SET join_cache_level = 2;
+
+CREATE TABLE t1 ( c1 VARCHAR(2), c2 VARCHAR(2), INDEX(c1) ) ENGINE=MyISAM;
+INSERT INTO t1 VALUES
+('JP','OM'),('VA','JP'),('CA','ML'),('ML','EG'),('DK','CA'),
+('DK','QA'),('YE','PL'),('TR','ZW'),('DK','SK'),('SK','DK'),
+('RO','ML'),('ML','BG'),('BG','ZW'),('ZW','GE'),('GE','JP'),
+('PL','EG'),('QA','YE'),('WF','DK'),('DK','JP'),('EG','OM');
+
+CREATE TABLE t2 ( c3 VARCHAR(2), c4 VARCHAR(2) ) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('CA','ML'),('IN','HU'),('HU','IN');
+
+SELECT * FROM t1 AS alias1, t1 AS alias2
+WHERE ( alias2.c2, alias1.c1 ) IN ( SELECT c4, c3 FROM t2 ) AND alias1.c1 IN ( SELECT c2 FROM t1 );
+
+DROP TABLE t1,t2;
+set join_cache_level=@tmp_mdev5056;
+
+--echo # End of 5.5 tests
+
diff --git a/mysql-test/t/userstat-badlogin-4824.test b/mysql-test/t/userstat-badlogin-4824.test
new file mode 100644
index 00000000000..97370c1d081
--- /dev/null
+++ b/mysql-test/t/userstat-badlogin-4824.test
@@ -0,0 +1,33 @@
+#
+# MDEV-4824 userstats - wrong user statistics
+#
+--source include/not_embedded.inc
+
+create user foo@localhost identified by 'foo';
+flush user_statistics;
+set global userstat=1;
+
+connect(foo, localhost, foo, foo);
+select 1;
+disconnect foo;
+connection default;
+
+# wait for user_statistics changes to become visible
+let $wait_condition= select count(*) = 1 from information_schema.processlist;
+--source include/wait_condition.inc
+
+# 41 is for ps-procotol
+--replace_result 41 18
+select user, bytes_received from information_schema.user_statistics where user = 'foo';
+
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error ER_ACCESS_DENIED_ERROR
+connect(foo, localhost, foo, bar);
+
+connection default;
+
+--replace_result 41 18
+select user, bytes_received from information_schema.user_statistics where user = 'foo';
+
+drop user foo@localhost;
+set global userstat=0;
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index 3c63acddc0c..430b0067c11 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -18,6 +18,8 @@ niceness=0
nowatch=0
mysqld_ld_preload=
mysqld_ld_library_path=
+flush_caches=0
+numa_interleave=0
# Initial logging status: error log is not open, and not using syslog
logging=init
@@ -85,6 +87,10 @@ Usage: $0 [OPTIONS]
--syslog Log messages to syslog with 'logger'
--skip-syslog Log messages to error log (default)
--syslog-tag=TAG Pass -t "mysqld-TAG" to 'logger'
+ --flush-caches Flush and purge buffers/caches before
+ starting the server
+ --numa-interleave Run mysqld with its memory interleaved
+ on all NUMA nodes
All other options are passed to the mysqld program.
@@ -244,6 +250,8 @@ parse_arguments() {
--skip-syslog) want_syslog=0 ;;
--syslog-tag=*) syslog_tag="$val" ;;
--timezone=*) TZ="$val"; export TZ; ;;
+ --flush-caches) flush_caches=1 ;;
+ --numa-interleave) numa_interleave=1 ;;
--help) usage ;;
@@ -762,6 +770,41 @@ mysqld daemon not started"
fi
#
+# Flush and purge buffers/caches.
+#
+
+if @TARGET_LINUX@ && test $flush_caches -eq 1
+then
+ # Locate sync, ensure it exists.
+ if ! my_which sync > /dev/null 2>&1
+ then
+ log_error "sync command not found, required for --flush-caches"
+ exit 1
+ # Flush file system buffers.
+ elif ! sync
+ then
+ # Huh, the sync() function is always successful...
+ log_error "sync failed, check if sync is properly installed"
+ fi
+
+ # Locate sysctl, ensure it exists.
+ if ! my_which sysctl > /dev/null 2>&1
+ then
+ log_error "sysctl command not found, required for --flush-caches"
+ exit 1
+ # Purge page cache, dentries and inodes.
+ elif ! sysctl -q -w vm.drop_caches=3
+ then
+ log_error "sysctl failed, check the error message for details"
+ exit 1
+ fi
+elif test $flush_caches -eq 1
+then
+ log_error "--flush-caches is not supported on this platform"
+ exit 1
+fi
+
+#
# Uncomment the following lines if you want all tables to be automatically
# checked and repaired during startup. You should add sensible key_buffer
# and sort_buffer values to my.cnf to improve check performance or require
@@ -781,6 +824,31 @@ fi
cmd="`mysqld_ld_preload_text`$NOHUP_NICENESS"
+#
+# Set mysqld's memory interleave policy.
+#
+
+if @TARGET_LINUX@ && test $numa_interleave -eq 1
+then
+ # Locate numactl, ensure it exists.
+ if ! my_which numactl > /dev/null 2>&1
+ then
+ log_error "numactl command not found, required for --numa-interleave"
+ exit 1
+ # Attempt to run a command, ensure it works.
+ elif ! numactl --interleave=all true
+ then
+ log_error "numactl failed, check if numactl is properly installed"
+ fi
+
+ # Launch mysqld with numactl.
+ cmd="$cmd numactl --interleave=all"
+elif test $numa_interleave -eq 1
+then
+ log_error "--numa-interleave is not supported on this platform"
+ exit 1
+fi
+
for i in "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \
"--datadir=$DATADIR" "--plugin-dir=$plugin_dir" "$USER_OPTION"
do
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc
index e236319d757..d65180a60be 100644
--- a/sql/event_data_objects.cc
+++ b/sql/event_data_objects.cc
@@ -1337,7 +1337,7 @@ Event_job_data::execute(THD *thd, bool drop)
DBUG_ENTER("Event_job_data::execute");
- mysql_reset_thd_for_next_command(thd, 0);
+ mysql_reset_thd_for_next_command(thd);
/*
MySQL parser currently assumes that current database is either
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 6c814429122..a438139bcfe 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -516,8 +516,8 @@ public:
bool fix_fields(THD *thd, Item **ref)
{return Item_func::fix_fields(thd, ref);}
virtual void print(String *str, enum_query_type query_type);
- void set_sum_test(Item_sum_hybrid *item) { test_sum_item= item; };
- void set_sub_test(Item_maxmin_subselect *item) { test_sub_item= item; };
+ void set_sum_test(Item_sum_hybrid *item) { test_sum_item= item; test_sub_item= 0; };
+ void set_sub_test(Item_maxmin_subselect *item) { test_sub_item= item; test_sum_item= 0;};
bool empty_underlying_subquery();
Item *neg_transformer(THD *thd);
};
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 70e7476fcfd..30cdabb0aa7 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -5680,7 +5680,7 @@ int Load_log_event::do_apply_event(NET* net, rpl_group_info *rgi,
*/
lex_start(thd);
thd->lex->local_file= local_fname;
- mysql_reset_thd_for_next_command(thd, 0);
+ mysql_reset_thd_for_next_command(thd);
/*
We test replicate_*_db rules. Note that we have already prepared
@@ -8372,7 +8372,7 @@ int Append_block_log_event::do_apply_event(rpl_group_info *rgi)
as the present method does not call mysql_parse().
*/
lex_start(thd);
- mysql_reset_thd_for_next_command(thd, 0);
+ mysql_reset_thd_for_next_command(thd);
/* old copy may exist already */
mysql_file_delete(key_file_log_event_data, fname, MYF(0));
if ((fd= mysql_file_create(key_file_log_event_data,
@@ -9333,7 +9333,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
*/
delete_explain_query(thd->lex);
lex_start(thd);
- mysql_reset_thd_for_next_command(thd, 0);
+ mysql_reset_thd_for_next_command(thd);
/*
The current statement is just about to begin and
has not yet modified anything. Note, all.modified is reset
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index 0de331e96c5..211768150af 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -89,7 +89,7 @@ Old_rows_log_event::do_apply_event(Old_rows_log_event *ev, rpl_group_info *rgi)
*/
delete_explain_query(thd->lex);
lex_start(ev_thd);
- mysql_reset_thd_for_next_command(ev_thd, 0);
+ mysql_reset_thd_for_next_command(ev_thd);
/*
This is a row injection, so we flag the "statement" as
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index eb1f9d85d36..deef5f24926 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3561,7 +3561,6 @@ static bool init_global_datetime_format(timestamp_type format_type,
SHOW_VAR com_status_vars[]= {
{"admin_commands", (char*) offsetof(STATUS_VAR, com_other), SHOW_LONG_STATUS},
- {"assign_to_keycache", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ASSIGN_TO_KEYCACHE]), SHOW_LONG_STATUS},
{"alter_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_DB]), SHOW_LONG_STATUS},
{"alter_db_upgrade", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_DB_UPGRADE]), SHOW_LONG_STATUS},
{"alter_event", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_EVENT]), SHOW_LONG_STATUS},
@@ -3571,6 +3570,7 @@ SHOW_VAR com_status_vars[]= {
{"alter_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_TABLE]), SHOW_LONG_STATUS},
{"alter_tablespace", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_TABLESPACE]), SHOW_LONG_STATUS},
{"analyze", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ANALYZE]), SHOW_LONG_STATUS},
+ {"assign_to_keycache", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ASSIGN_TO_KEYCACHE]), SHOW_LONG_STATUS},
{"begin", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_BEGIN]), SHOW_LONG_STATUS},
{"binlog", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_BINLOG_BASE64_EVENT]), SHOW_LONG_STATUS},
{"call_procedure", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CALL]), SHOW_LONG_STATUS},
@@ -3643,7 +3643,6 @@ SHOW_VAR com_status_vars[]= {
{"savepoint", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SAVEPOINT]), SHOW_LONG_STATUS},
{"select", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SELECT]), SHOW_LONG_STATUS},
{"set_option", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SET_OPTION]), SHOW_LONG_STATUS},
- {"signal", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SIGNAL]), SHOW_LONG_STATUS},
{"show_authors", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_AUTHORS]), SHOW_LONG_STATUS},
{"show_binlog_events", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOG_EVENTS]), SHOW_LONG_STATUS},
{"show_binlogs", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOGS]), SHOW_LONG_STATUS},
@@ -3661,8 +3660,8 @@ SHOW_VAR com_status_vars[]= {
{"show_engine_logs", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_ENGINE_LOGS]), SHOW_LONG_STATUS},
{"show_engine_mutex", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_ENGINE_MUTEX]), SHOW_LONG_STATUS},
{"show_engine_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_ENGINE_STATUS]), SHOW_LONG_STATUS},
- {"show_events", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_EVENTS]), SHOW_LONG_STATUS},
{"show_errors", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_ERRORS]), SHOW_LONG_STATUS},
+ {"show_events", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_EVENTS]), SHOW_LONG_STATUS},
{"show_explain", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_EXPLAIN]), SHOW_LONG_STATUS},
{"show_fields", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_FIELDS]), SHOW_LONG_STATUS},
#ifndef DBUG_OFF
@@ -3670,8 +3669,8 @@ SHOW_VAR com_status_vars[]= {
#endif
{"show_function_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS_FUNC]), SHOW_LONG_STATUS},
{"show_grants", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_GRANTS]), SHOW_LONG_STATUS},
- {"show_keys", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_KEYS]), SHOW_LONG_STATUS},
{"show_index_statistics", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_INDEX_STATS]), SHOW_LONG_STATUS},
+ {"show_keys", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_KEYS]), SHOW_LONG_STATUS},
{"show_master_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_MASTER_STAT]), SHOW_LONG_STATUS},
{"show_open_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_OPEN_TABLES]), SHOW_LONG_STATUS},
{"show_plugins", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PLUGINS]), SHOW_LONG_STATUS},
@@ -3696,6 +3695,7 @@ SHOW_VAR com_status_vars[]= {
{"show_variables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_VARIABLES]), SHOW_LONG_STATUS},
{"show_warnings", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_WARNS]), SHOW_LONG_STATUS},
{"shutdown", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHUTDOWN]), SHOW_LONG_STATUS},
+ {"signal", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SIGNAL]), SHOW_LONG_STATUS},
{"start_all_slaves", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_ALL_START]), SHOW_LONG_STATUS},
{"start_slave", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_START]), SHOW_LONG_STATUS},
{"stmt_close", (char*) offsetof(STATUS_VAR, com_stmt_close), SHOW_LONG_STATUS},
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index ea5fd03b3b4..c156c1642e7 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -437,9 +437,7 @@ Currently, solution #2 is implemented.
static
bool subquery_types_allow_materialization(Item_in_subselect *in_subs);
-static bool replace_where_subcondition(JOIN *join, Item **expr,
- Item *old_cond, Item *new_cond,
- bool do_fix_fields);
+static bool replace_where_subcondition(JOIN *, Item **, Item *, Item *, bool);
static int subq_sj_candidate_cmp(Item_in_subselect* el1, Item_in_subselect* el2,
void *arg);
static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred);
@@ -1313,7 +1311,7 @@ static bool replace_where_subcondition(JOIN *join, Item **expr,
}
else if (item->type() == Item::COND_ITEM)
{
- DBUG_ASSERT(!(*expr)->fixed);
+ DBUG_ASSERT(!do_fix_fields || !(*expr)->fixed);
replace_where_subcondition(join, li.ref(),
old_cond, new_cond,
do_fix_fields);
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index b8d39057ba8..d4fc458c948 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -479,6 +479,24 @@ int opt_sum_query(THD *thd,
}
+/*
+ Check if both item1 and item2 are strings, and item1 has fewer characters
+ than item2.
+*/
+
+static bool check_item1_shorter_item2(Item *item1, Item *item2)
+{
+ if (item1->cmp_type() == STRING_RESULT &&
+ item2->cmp_type() == STRING_RESULT)
+ {
+ int len1= item1->max_length / item1->collation.collation->mbmaxlen;
+ int len2= item2->max_length / item2->collation.collation->mbmaxlen;
+ return len1 < len2;
+ }
+ return false; /* When the check is not applicable, it means "not bigger" */
+}
+
+
/**
Test if the predicate compares a field with constants.
@@ -509,7 +527,7 @@ bool simple_pred(Item_func *func_item, Item **args, bool *inv_order)
if (!(item= it++))
return 0;
args[0]= item->real_item();
- if (args[0]->max_length < args[1]->max_length)
+ if (check_item1_shorter_item2(args[0], args[1]))
return 0;
if (it++)
return 0;
@@ -544,7 +562,7 @@ bool simple_pred(Item_func *func_item, Item **args, bool *inv_order)
}
else
return 0;
- if (args[0]->max_length < args[1]->max_length)
+ if (check_item1_shorter_item2(args[0], args[1]))
return 0;
break;
case 3:
@@ -559,7 +577,7 @@ bool simple_pred(Item_func *func_item, Item **args, bool *inv_order)
if (!item->const_item())
return 0;
args[i]= item;
- if (args[0]->max_length < args[i]->max_length)
+ if (check_item1_shorter_item2(args[0], args[1]))
return 0;
}
}
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc
index d280a9476f2..8429f1c7f58 100644
--- a/sql/rpl_gtid.cc
+++ b/sql/rpl_gtid.cc
@@ -329,7 +329,7 @@ rpl_slave_state::record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id,
}
if (!in_statement)
- mysql_reset_thd_for_next_command(thd, 0);
+ mysql_reset_thd_for_next_command(thd);
DBUG_EXECUTE_IF("gtid_inject_record_gtid",
{
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index 1c43dcd39c6..ec6a16ddefa 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -1325,7 +1325,7 @@ rpl_load_gtid_slave_state(THD *thd)
goto end;
array_inited= true;
- mysql_reset_thd_for_next_command(thd, 0);
+ mysql_reset_thd_for_next_command(thd);
tlist.init_one_table(STRING_WITH_LEN("mysql"),
rpl_gtid_slave_state_table_name.str,
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 062ad06db00..3ddeb7d82bb 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -2853,29 +2853,29 @@ ER_UDF_EXISTS
swe "Funktionen '%-.192s' finns redan"
ukr "Функція '%-.192s' вже існує"
ER_CANT_OPEN_LIBRARY
- cze "Nemohu otevřít sdílenou knihovnu '%-.192s' (errno: %d %-.128s)"
- dan "Kan ikke åbne delt bibliotek '%-.192s' (errno: %d %-.128s)"
- nla "Kan shared library '%-.192s' niet openen (Errcode: %d %-.128s)"
- eng "Can't open shared library '%-.192s' (errno: %d %-.128s)"
- est "Ei suuda avada jagatud teeki '%-.192s' (veakood: %d %-.128s)"
- fre "Impossible d'ouvrir la bibliothèque partagée '%-.192s' (errno: %d %-.128s)"
- ger "Kann Shared Library '%-.192s' nicht öffnen (Fehler: %d %-.128s)"
- greek "Δεν είναι δυνατή η ανάγνωση της shared library '%-.192s' (κωδικός λάθους: %d %-.128s)"
- hun "A(z) '%-.192s' megosztott konyvtar nem hasznalhato (hibakod: %d %-.128s)"
- ita "Impossibile aprire la libreria condivisa '%-.192s' (errno: %d %-.128s)"
- jpn "共有ライブラリ '%-.192s' を開く事ができません。(エラー番号: %d %-.128s)"
- kor "'%-.192s' 공유 라이버러리를 열수 없습니다.(에러번호: %d %-.128s)"
- nor "Can't open shared library '%-.192s' (errno: %d %-.128s)"
- norwegian-ny "Can't open shared library '%-.192s' (errno: %d %-.128s)"
- pol "Can't open shared library '%-.192s' (errno: %d %-.128s)"
- por "Não pode abrir biblioteca compartilhada '%-.192s' (erro no. %d '%-.128s')"
- rum "Nu pot deschide libraria shared '%-.192s' (Eroare: %d %-.128s)"
- rus "Невозможно открыть динамическую библиотеку '%-.192s' (ошибка: %d %-.128s)"
- serbian "Ne mogu da otvorim share-ovanu biblioteku '%-.192s' (errno: %d %-.128s)"
- slo "Nemôžem otvoriť zdieľanú knižnicu '%-.192s' (chybový kód: %d %-.128s)"
- spa "No puedo abrir libraria conjugada '%-.192s' (errno: %d %-.128s)"
- swe "Kan inte öppna det dynamiska biblioteket '%-.192s' (Felkod: %d %-.128s)"
- ukr "Не можу відкрити розділювану бібліотеку '%-.192s' (помилка: %d %-.128s)"
+ cze "Nemohu otevřít sdílenou knihovnu '%-.192s' (errno: %d, %-.128s)"
+ dan "Kan ikke åbne delt bibliotek '%-.192s' (errno: %d, %-.128s)"
+ nla "Kan shared library '%-.192s' niet openen (Errcode: %d, %-.128s)"
+ eng "Can't open shared library '%-.192s' (errno: %d, %-.128s)"
+ est "Ei suuda avada jagatud teeki '%-.192s' (veakood: %d, %-.128s)"
+ fre "Impossible d'ouvrir la bibliothèque partagée '%-.192s' (errno: %d, %-.128s)"
+ ger "Kann Shared Library '%-.192s' nicht öffnen (Fehler: %d, %-.128s)"
+ greek "Δεν είναι δυνατή η ανάγνωση της shared library '%-.192s' (κωδικός λάθους: %d, %-.128s)"
+ hun "A(z) '%-.192s' megosztott konyvtar nem hasznalhato (hibakod: %d, %-.128s)"
+ ita "Impossibile aprire la libreria condivisa '%-.192s' (errno: %d, %-.128s)"
+ jpn "共有ライブラリ '%-.192s' を開く事ができません。(エラー番号: %d, %-.128s)"
+ kor "'%-.192s' 공유 라이버러리를 열수 없습니다.(에러번호: %d, %-.128s)"
+ nor "Can't open shared library '%-.192s' (errno: %d, %-.128s)"
+ norwegian-ny "Can't open shared library '%-.192s' (errno: %d, %-.128s)"
+ pol "Can't open shared library '%-.192s' (errno: %d, %-.128s)"
+ por "Não pode abrir biblioteca compartilhada '%-.192s' (erro no. %d, %-.128s)"
+ rum "Nu pot deschide libraria shared '%-.192s' (Eroare: %d, %-.128s)"
+ rus "Невозможно открыть динамическую библиотеку '%-.192s' (ошибка: %d, %-.128s)"
+ serbian "Ne mogu da otvorim share-ovanu biblioteku '%-.192s' (errno: %d, %-.128s)"
+ slo "Nemôžem otvoriť zdieľanú knižnicu '%-.192s' (chybový kód: %d, %-.128s)"
+ spa "No puedo abrir libraria conjugada '%-.192s' (errno: %d, %-.128s)"
+ swe "Kan inte öppna det dynamiska biblioteket '%-.192s' (Felkod: %d, %-.128s)"
+ ukr "Не можу відкрити розділювану бібліотеку '%-.192s' (помилка: %d, %-.128s)"
ER_CANT_FIND_DL_ENTRY
cze "Nemohu najít funkci '%-.128s' v knihovně"
dan "Kan ikke finde funktionen '%-.128s' i bibliotek"
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 7ed27e2620e..d1fa138f33c 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1351,6 +1351,7 @@ void THD::init(void)
reset_binlog_local_stmt_filter();
set_status_var_init();
bzero((char *) &org_status_var, sizeof(org_status_var));
+ start_bytes_received= 0;
if (variables.sql_log_bin)
variables.option_bits|= OPTION_BIN_LOG;
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 5e8dc8269de..25090ee596a 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1768,7 +1768,7 @@ public:
/* Used to SLAVE SQL thread */
Rpl_filter* rpl_filter;
- void reset_for_next_command(bool calculate_userstat);
+ void reset_for_next_command();
/*
Constant for THD::where initialization in the beginning of every query.
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 98d7e640509..2036cd1b373 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -902,7 +902,6 @@ bool do_command(THD *thd)
net_new_transaction(net);
-
/* Save for user statistics */
thd->start_bytes_received= thd->status_var.bytes_received;
@@ -1141,6 +1140,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (!(server_command_flags[command] & CF_SKIP_QUESTIONS))
statistic_increment(thd->status_var.questions, &LOCK_status);
+ /* Copy data for user stats */
+ if ((thd->userstat_running= opt_userstat_running))
+ {
+ thd->start_cpu_time= my_getcputime();
+ memcpy(&thd->org_status_var, &thd->status_var, sizeof(thd->status_var));
+ thd->select_commands= thd->update_commands= thd->other_commands= 0;
+ }
+
/**
Clear the set of flags that are expected to be cleared at the
beginning of each command.
@@ -1412,7 +1419,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break;
}
packet= arg_end + 1;
- mysql_reset_thd_for_next_command(thd, opt_userstat_running);
+ mysql_reset_thd_for_next_command(thd);
lex_start(thd);
/* Must be before we init the table list. */
if (lower_case_table_names)
@@ -6039,15 +6046,15 @@ bool my_yyoverflow(short **yyss, YYSTYPE **yyvs, ulong *yystacksize)
@todo Call it after we use THD for queries, not before.
*/
-void mysql_reset_thd_for_next_command(THD *thd, my_bool calculate_userstat)
+void mysql_reset_thd_for_next_command(THD *thd)
{
- thd->reset_for_next_command(calculate_userstat);
+ thd->reset_for_next_command();
}
-void THD::reset_for_next_command(bool calculate_userstat)
+void THD::reset_for_next_command()
{
THD *thd= this;
- DBUG_ENTER("mysql_reset_thd_for_next_command");
+ DBUG_ENTER("THD::reset_for_next_command");
DBUG_ASSERT(!thd->spcont); /* not for substatements of routines */
DBUG_ASSERT(! thd->in_sub_stmt);
thd->free_list= 0;
@@ -6092,14 +6099,6 @@ void THD::reset_for_next_command(bool calculate_userstat)
thd->m_sent_row_count= thd->m_examined_row_count= 0;
thd->accessed_rows_and_keys= 0;
- /* Copy data for user stats */
- if ((thd->userstat_running= calculate_userstat))
- {
- thd->start_cpu_time= my_getcputime();
- memcpy(&thd->org_status_var, &thd->status_var, sizeof(thd->status_var));
- thd->select_commands= thd->update_commands= thd->other_commands= 0;
- }
-
thd->query_plan_flags= QPLAN_INIT;
thd->query_plan_fsort_passes= 0;
@@ -6308,7 +6307,7 @@ void mysql_parse(THD *thd, char *rawbuf, uint length,
FIXME: cleanup the dependencies in the code to simplify this.
*/
lex_start(thd);
- mysql_reset_thd_for_next_command(thd, opt_userstat_running);
+ mysql_reset_thd_for_next_command(thd);
if (query_cache_send_result_to_client(thd, rawbuf, length) <= 0)
{
@@ -6422,7 +6421,7 @@ bool mysql_test_parse_for_slave(THD *thd, char *rawbuf, uint length)
if (!(error= parser_state.init(thd, rawbuf, length)))
{
lex_start(thd);
- mysql_reset_thd_for_next_command(thd, opt_userstat_running);
+ mysql_reset_thd_for_next_command(thd);
if (!parse_sql(thd, & parser_state, NULL, true) &&
all_tables_not_ok(thd, lex->select_lex.table_list.first))
diff --git a/sql/sql_parse.h b/sql/sql_parse.h
index 8240d2ba6a1..1545edeaa8a 100644
--- a/sql/sql_parse.h
+++ b/sql/sql_parse.h
@@ -84,7 +84,7 @@ bool alloc_query(THD *thd, const char *packet, uint packet_length);
void mysql_init_select(LEX *lex);
void mysql_parse(THD *thd, char *rawbuf, uint length,
Parser_state *parser_state);
-void mysql_reset_thd_for_next_command(THD *thd, my_bool calculate_userstat);
+void mysql_reset_thd_for_next_command(THD *thd);
bool mysql_new_select(LEX *lex, bool move_down);
void create_select_for_variable(const char *var_name);
void create_table_set_open_action_and_adjust_tables(LEX *lex);
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 0ece0e1967d..72c7ca2b0cc 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -515,7 +515,7 @@ static my_bool read_mysql_plugin_info(struct st_plugin_dl *plugin_dl,
if (plugin_dl->mysqlversion < min_plugin_interface_version ||
(plugin_dl->mysqlversion >> 8) > (MYSQL_PLUGIN_INTERFACE_VERSION >> 8))
{
- report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, 0,
+ report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, ENOEXEC,
"plugin interface version mismatch");
DBUG_RETURN(TRUE);
}
@@ -636,7 +636,7 @@ static my_bool read_maria_plugin_info(struct st_plugin_dl *plugin_dl,
if (plugin_dl->mariaversion < min_maria_plugin_interface_version ||
(plugin_dl->mariaversion >> 8) > (MARIA_PLUGIN_INTERFACE_VERSION >> 8))
{
- report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, 0,
+ report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, ENOEXEC,
"plugin interface version mismatch");
DBUG_RETURN(TRUE);
}
@@ -780,7 +780,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
my_snprintf(buf, sizeof(buf),
"service '%s' interface version mismatch",
list_of_services[i].name);
- report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, 0, buf);
+ report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, ENOEXEC, buf);
goto ret;
}
*(void**)sym= list_of_services[i].service;
@@ -1073,7 +1073,7 @@ static bool plugin_add(MEM_ROOT *tmp_root,
plugin_type_names[plugin->type].str,
" plugin ", tmp.name.str,
" not supported by this version of the server", NullS);
- report_error(report, ER_CANT_OPEN_LIBRARY, dl->str, 0, buf);
+ report_error(report, ER_CANT_OPEN_LIBRARY, dl->str, ENOEXEC, buf);
goto err;
}
if (plugin_maturity_map[plugin->maturity] < plugin_maturity)
@@ -1085,7 +1085,7 @@ static bool plugin_add(MEM_ROOT *tmp_root,
" is prohibited by --plugin-maturity=",
plugin_maturity_names[plugin_maturity],
NullS);
- report_error(report, ER_CANT_OPEN_LIBRARY, dl->str, 0, buf);
+ report_error(report, ER_CANT_OPEN_LIBRARY, dl->str, EPERM, buf);
goto err;
}
tmp.plugin= plugin;
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index e28d171df73..7e038bf28f0 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -2308,7 +2308,7 @@ void mysqld_stmt_prepare(THD *thd, const char *packet, uint packet_length)
DBUG_PRINT("prep_query", ("%s", packet));
/* First of all clear possible warnings from the previous command */
- mysql_reset_thd_for_next_command(thd, opt_userstat_running);
+ mysql_reset_thd_for_next_command(thd);
if (! (stmt= new Prepared_statement(thd)))
goto end; /* out of memory: error is set in Sql_alloc */
@@ -2699,7 +2699,7 @@ void mysqld_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
packet+= 9; /* stmt_id + 5 bytes of flags */
/* First of all clear possible warnings from the previous command */
- mysql_reset_thd_for_next_command(thd, opt_userstat_running);
+ mysql_reset_thd_for_next_command(thd);
if (!(stmt= find_prepared_statement(thd, stmt_id)))
{
@@ -2798,7 +2798,7 @@ void mysqld_stmt_fetch(THD *thd, char *packet, uint packet_length)
DBUG_ENTER("mysqld_stmt_fetch");
/* First of all clear possible warnings from the previous command */
- mysql_reset_thd_for_next_command(thd, opt_userstat_running);
+ mysql_reset_thd_for_next_command(thd);
status_var_increment(thd->status_var.com_stmt_fetch);
if (!(stmt= find_prepared_statement(thd, stmt_id)))
@@ -2858,7 +2858,7 @@ void mysqld_stmt_reset(THD *thd, char *packet)
DBUG_ENTER("mysqld_stmt_reset");
/* First of all clear possible warnings from the previous command */
- mysql_reset_thd_for_next_command(thd, opt_userstat_running);
+ mysql_reset_thd_for_next_command(thd);
status_var_increment(thd->status_var.com_stmt_reset);
if (!(stmt= find_prepared_statement(thd, stmt_id)))
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 6470dcf7708..f5cfbf8ffd1 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2909,6 +2909,7 @@ void JOIN::exec_inner()
JOIN_TAB *curr_table= &curr_join->join_tab[curr_join->const_tables];
table_map used_tables= (curr_join->const_table_map |
curr_table->table->map);
+ curr_join->tmp_having->update_used_tables();
Item* sort_table_cond= make_cond_for_table(thd, curr_join->tmp_having,
used_tables,
@@ -12927,12 +12928,14 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
/*
If we're inside an SJM-nest (current_sjm!=NULL), and the multi-equality
doesn't include a constant, we should produce equality with the first
- of the equals in this SJM.
+ of the equal items in this SJM (except for the first element inside the
+ SJM. For that, we produce the equality with the "head" item).
In other cases, get the "head" item, which is either first of the
equals on top level, or the constant.
*/
- Item *head_item= (!item_const && current_sjm)? current_sjm_head: head;
+ Item *head_item= (!item_const && current_sjm &&
+ current_sjm_head != field_item) ? current_sjm_head: head;
Item *head_real_item= head_item->real_item();
if (head_real_item->type() == Item::FIELD_ITEM)
head_item= head_real_item;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 5c1650351e3..fc86722a1bf 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -2462,10 +2462,10 @@ void select_result_text_buffer::save_to(String *res)
{
List_iterator<char*> it(rows);
char **row;
- res->append("## <explain>\n");
+ res->append("#\n");
while ((row= it++))
{
- res->append("## ");
+ res->append("# explain: ");
for (int i=0; i < n_columns; i++)
{
if (i)
@@ -2474,7 +2474,7 @@ void select_result_text_buffer::save_to(String *res)
}
res->append("\n");
}
- res->append("## </explain>\n");
+ res->append("#\n");
}
@@ -2661,7 +2661,8 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
command_name[tmp->get_command()].length, cs);
/* MYSQL_TIME */
ulonglong start_utime= tmp->start_time * HRTIME_RESOLUTION + tmp->start_time_sec_part;
- ulonglong utime= start_utime < unow.val ? unow.val - start_utime : 0;
+ ulonglong utime= start_utime && start_utime < unow.val
+ ? unow.val - start_utime : 0;
table->field[5]->store(utime / HRTIME_RESOLUTION, TRUE);
/* STATE */
if ((val= thread_state_info(tmp)))
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index 0445abd8d99..158ab7fb898 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -1125,14 +1125,10 @@ int ha_myisam::repair(THD *thd, HA_CHECK &param, bool do_optimize)
statistics_done=1;
if (THDVAR(thd, repair_threads)>1)
{
- char buf[40];
/* TODO: respect myisam_repair_threads variable */
- my_snprintf(buf, 40, "Repair with %d threads", my_count_bits(key_map));
- thd_proc_info(thd, buf);
+ thd_proc_info(thd, "Parallel repair");
error = mi_repair_parallel(&param, file, fixed_name,
test(param.testflag & T_QUICK));
- thd_proc_info(thd, "Repair done"); // to reset proc_info, as
- // it was pointing to local buffer
}
else
{
diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt
index aa9dc83f68b..8dca7092b91 100644
--- a/storage/tokudb/CMakeLists.txt
+++ b/storage/tokudb/CMakeLists.txt
@@ -15,9 +15,20 @@ IF(NOT TOKUDB_OK)
ENDIF()
SET(ENV{TOKUDB_VERSION} "7.0.4")
+SET(TOKUDB_DEB_FILES "usr/lib/mysql/plugin/ha_tokudb.so\netc/mysql/conf.d/tokudb.cnf\nusr/bin/tokuftdump\nusr/share/doc/mariadb-server-10.0/README-TOKUDB\nusr/share/doc/mariadb-server-10.0/README.md" PARENT_SCOPE)
SET(USE_BDB OFF CACHE BOOL "")
SET(USE_VALGRIND OFF CACHE BOOL "")
SET(BUILD_TESTING OFF CACHE BOOL "")
+MARK_AS_ADVANCED(BUILDNAME)
+MARK_AS_ADVANCED(BUILD_TESTING)
+MARK_AS_ADVANCED(CMAKE_TOKUDB_REVISION)
+MARK_AS_ADVANCED(LIBTOKUDB)
+MARK_AS_ADVANCED(LIBTOKUPORTABILITY)
+MARK_AS_ADVANCED(TOKUDB_DATA)
+MARK_AS_ADVANCED(TOKU_DEBUG_PARANOID)
+MARK_AS_ADVANCED(USE_BDB)
+MARK_AS_ADVANCED(USE_VALGRIND)
+MARK_AS_ADVANCED(XZ_SOURCE_DIR)
############################################
IF(DEFINED ENV{TOKUDB_VERSION})
@@ -45,7 +56,12 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/ft-index/toku_include)
SET(TOKUDB_PLUGIN_DYNAMIC "ha_tokudb")
SET(TOKUDB_SOURCES ha_tokudb.cc)
MYSQL_ADD_PLUGIN(tokudb ${TOKUDB_SOURCES} STORAGE_ENGINE MODULE_ONLY
- COMPONENT "tokudb-engine" CONFIG tokudb.cnf
LINK_LIBRARIES tokufractaltree_static tokuportability_static ${ZLIB_LIBRARY} stdc++)
SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -flto -fuse-linker-plugin")
+SET(CPACK_RPM_server_PACKAGE_OBSOLETES
+ "${CPACK_RPM_server_PACKAGE_OBSOLETES} MariaDB-tokudb-engine < 10.0.5" PARENT_SCOPE)
+
+IF (INSTALL_SYSCONF2DIR)
+ INSTALL(FILES tokudb.cnf DESTINATION ${INSTALL_SYSCONF2DIR} COMPONENT Server)
+ENDIF(INSTALL_SYSCONF2DIR)
diff --git a/storage/tokudb/ft-index/CMakeLists.txt b/storage/tokudb/ft-index/CMakeLists.txt
index 41e3116b16d..87c04be75e5 100644
--- a/storage/tokudb/ft-index/CMakeLists.txt
+++ b/storage/tokudb/ft-index/CMakeLists.txt
@@ -57,7 +57,7 @@ add_subdirectory(include)
add_subdirectory(toku_include)
#add_subdirectory(examples)
-INSTALL_DOCUMENTATION(README.md README-TOKUDB COMPONENT "tokudb-engine")
+INSTALL_DOCUMENTATION(README.md README-TOKUDB COMPONENT Server)
## build tags
#include(TokuBuildTagDatabases)
diff --git a/storage/tokudb/ft-index/cmake_modules/TokuSetupCTest.cmake b/storage/tokudb/ft-index/cmake_modules/TokuSetupCTest.cmake
index f6aedca0868..5ca2fb64458 100644
--- a/storage/tokudb/ft-index/cmake_modules/TokuSetupCTest.cmake
+++ b/storage/tokudb/ft-index/cmake_modules/TokuSetupCTest.cmake
@@ -60,7 +60,7 @@ macro(hostname out)
COMMAND hostname
OUTPUT_VARIABLE fullhostname
OUTPUT_STRIP_TRAILING_WHITESPACE)
- string(REGEX REPLACE "\\.tokutek\\.com$" "" ${out} ${fullhostname})
+ string(REGEX REPLACE "\\.tokutek\\.com$" "" ${out} "${fullhostname}")
endmacro(hostname)
## gather machine info
diff --git a/storage/tokudb/ft-index/ft/CMakeLists.txt b/storage/tokudb/ft-index/ft/CMakeLists.txt
index 748e501f922..c773f4b3391 100644
--- a/storage/tokudb/ft-index/ft/CMakeLists.txt
+++ b/storage/tokudb/ft-index/ft/CMakeLists.txt
@@ -103,7 +103,7 @@ target_link_libraries(ftverify m)
install(
TARGETS tokuftdump
- COMPONENT "tokudb-engine"
+ COMPONENT Server
DESTINATION ${INSTALL_BINDIR}
)
diff --git a/support-files/rpm/server-postin.sh b/support-files/rpm/server-postin.sh
index b5ba10bd265..b4d63815fe9 100644
--- a/support-files/rpm/server-postin.sh
+++ b/support-files/rpm/server-postin.sh
@@ -31,7 +31,7 @@ if [ $1 = 1 ] ; then
# owns all database files.
chown -R %{mysqld_user}:%{mysqld_group} $datadir
- if [ ! -e $datadir ]; then
+ if [ ! -e $datadir/mysql ]; then
# Create data directory
mkdir -p $datadir/{mysql,test}