5.5. merge

This commit is contained in:
Sergei Golubchik 2013-11-13 14:07:58 +01:00
commit bdd883ed9a
51 changed files with 487 additions and 145 deletions

View File

@ -353,6 +353,12 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc.in
CONFIGURE_FILE(
${CMAKE_SOURCE_DIR}/cmake/info_macros.cmake.in ${CMAKE_BINARY_DIR}/info_macros.cmake @ONLY)
IF(DEB)
CONFIGURE_FILE(
${CMAKE_SOURCE_DIR}/debian/mariadb-server-5.5.files.in
${CMAKE_SOURCE_DIR}/debian/mariadb-server-5.5.files)
ENDIF(DEB)
# Handle the "INFO_*" files.
INCLUDE(${CMAKE_BINARY_DIR}/info_macros.cmake)
# Source: This can be done during the cmake phase, all information is

View File

@ -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}
};

View File

@ -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")

View File

@ -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"
#export MARIADB_OPTIONAL_DEBS="tokudb-engine"
# Find major.minor version.
#

View File

@ -190,12 +190,13 @@ Depends: mariadb-client-5.5 (>= ${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
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
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
@ -239,11 +240,3 @@ Description: MariaDB database regression test suite (metapackage depending on th
mariadb-test (currently mariadb-test-5.5), as determined by the MariaDB
maintainers.
Package: mariadb-tokudb-engine-5.5
Section: database
Architecture: any
Depends: mariadb-server-5.5
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/

View File

@ -71,3 +71,4 @@ usr/share/mysql/mysql_system_tables_data.sql
usr/share/mysql/mysql_system_tables.sql
usr/share/mysql/mysql_performance_tables.sql
usr/share/mysql/mysql_test_data_timezone.sql
@TOKUDB_DEB_FILES@

View File

@ -184,12 +184,13 @@ Depends: mariadb-client-5.5 (>= ${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
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
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
@ -233,11 +234,3 @@ Description: MariaDB database regression test suite (metapackage depending on th
mariadb-test (currently mariadb-test-5.5), as determined by the MariaDB
maintainers.
Package: mariadb-tokudb-engine-5.5
Section: database
Architecture: any
Depends: mariadb-server-5.5
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/

View File

@ -73,3 +73,4 @@ usr/share/mysql/mysql_system_tables_data.sql
usr/share/mysql/mysql_system_tables.sql
usr/share/mysql/mysql_performance_tables.sql
usr/share/mysql/mysql_test_data_timezone.sql
@TOKUDB_DEB_FILES@

View File

@ -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-5.5/README-TOKUDB
usr/share/doc/mariadb-tokudb-engine-5.5/README.md

View File

@ -1900,7 +1900,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");

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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';

View File

@ -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

View File

@ -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;

View File

@ -24,8 +24,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;
@ -43,7 +42,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);

View File

@ -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";

View File

@ -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';
#

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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 ;;
@ -761,6 +769,41 @@ mysqld daemon not started"
fi
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
@ -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

View File

@ -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

View File

@ -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);
};

View File

@ -5633,7 +5633,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
@ -8326,7 +8326,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,
@ -9288,7 +9288,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

View File

@ -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

View File

@ -3432,7 +3432,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},
@ -3442,6 +3441,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},
@ -3513,7 +3513,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},
@ -3531,8 +3530,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
@ -3540,8 +3539,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},
@ -3566,6 +3565,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},

View File

@ -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);

View File

@ -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;
}
}

View File

@ -328,7 +328,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",
{

View File

@ -1324,7 +1324,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,

View File

@ -2913,30 +2913,30 @@ ER_UDF_EXISTS
swe "Funktionen '%-.192s' finns redan"
ukr "Функція '%-.192s' вже існує"
ER_CANT_OPEN_LIBRARY
cze "Nemohu otev-Bří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)"
jps "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 "shared library '%-.192s' を開く事ができません (errno: %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-Bří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)"
jps "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 "shared library '%-.192s' を開く事ができません (errno: %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-Bít funkci '%-.128s' v knihovně"
dan "Kan ikke finde funktionen '%-.128s' i bibliotek"

View File

@ -1265,6 +1265,7 @@ void THD::init(void)
reset_current_stmt_binlog_format_row();
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;

View File

@ -1712,7 +1712,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.

View File

@ -742,7 +742,6 @@ bool do_command(THD *thd)
net_new_transaction(net);
/* Save for user statistics */
thd->start_bytes_received= thd->status_var.bytes_received;
@ -960,6 +959,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.
@ -1211,7 +1218,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)
@ -5747,15 +5754,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);
DBUG_ASSERT(thd->transaction.on);
@ -5801,14 +5808,6 @@ void THD::reset_for_next_command(bool calculate_userstat)
thd->sent_row_count= thd->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;
@ -6017,7 +6016,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)
{
@ -6120,7 +6119,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) &&
all_tables_not_ok(thd, lex->select_lex.table_list.first))

View File

@ -85,7 +85,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);

View File

@ -635,7 +635,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);
}
@ -779,7 +779,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;
@ -1069,7 +1069,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)
@ -1081,7 +1081,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;

View File

@ -2276,7 +2276,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 */
@ -2667,7 +2667,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)))
{
@ -2766,7 +2766,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)))
@ -2826,7 +2826,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)))

View File

@ -12923,12 +12923,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;

View File

@ -2646,7 +2646,8 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
command_name[tmp->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)))

View File

@ -1114,14 +1114,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
{

View File

@ -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-5.5/README-TOKUDB\nusr/share/doc/mariadb-server-5.5/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,12 +56,13 @@ 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"
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 < 5.5.34" PARENT_SCOPE)
IF (INSTALL_SYSCONF2DIR)
INSTALL(FILES tokudb.cnf DESTINATION ${INSTALL_SYSCONF2DIR} COMPONENT tokudb-engine)
SET(CPACK_RPM_tokudb-engine_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONF2DIR}/*" PARENT_SCOPE)
INSTALL(FILES tokudb.cnf DESTINATION ${INSTALL_SYSCONF2DIR} COMPONENT Server)
ENDIF(INSTALL_SYSCONF2DIR)

View File

@ -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)

View File

@ -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

View File

@ -103,7 +103,7 @@ target_link_libraries(ftverify m)
install(
TARGETS tokuftdump
COMPONENT "tokudb-engine"
COMPONENT Server
DESTINATION ${INSTALL_BINDIR}
)

View File

@ -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}