Skip to content

Commit

Permalink
Merge branch '5.5' into 10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cvicentiu committed Jun 10, 2018
2 parents 7053e26 + 1d43f71 commit 3ead951
Show file tree
Hide file tree
Showing 27 changed files with 259 additions and 54 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -461,3 +461,9 @@ UpgradeLog*.htm

# Microsoft Fakes
FakesAssemblies/

# macOS garbage
.DS_Store

# QtCreator && CodeBlocks
*.cbp
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,10 @@ INCLUDE(maintainer)

IF(WITH_UNIT_TESTS)
ENABLE_TESTING()
# This is the only instance where ADD_TEST should be used,
# to make sure that make test will run MTR,
# use MY_ADD_TEST macro to add other tests
ADD_TEST(NAME MTR COMMAND ./mysql-test-run WORKING_DIRECTORY "mysql-test")
ADD_SUBDIRECTORY(unittest/mytap)
ADD_SUBDIRECTORY(unittest/strings)
ADD_SUBDIRECTORY(unittest/examples)
Expand Down
15 changes: 8 additions & 7 deletions client/mysqldump.c
Original file line number Diff line number Diff line change
Expand Up @@ -4893,6 +4893,14 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
if (opt_xml)
print_xml_tag(md_result_file, "", "\n", "database", "name=", db, NullS);


/* obtain dump of routines (procs/functions) */
if (opt_routines && mysql_get_server_version(mysql) >= 50009)
{
DBUG_PRINT("info", ("Dumping routines for database %s", db));
dump_routines_for_db(db);
}

if (opt_single_transaction && mysql_get_server_version(mysql) >= 50500)
{
verbose_msg("-- Setting savepoint...\n");
Expand All @@ -4902,7 +4910,6 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
DBUG_RETURN(1);
}
}

/* Dump each selected table */
for (pos= dump_tables; pos < end; pos++)
{
Expand Down Expand Up @@ -4964,12 +4971,6 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
DBUG_PRINT("info", ("Dumping events for database %s", db));
dump_events_for_db(db);
}
/* obtain dump of routines (procs/functions) */
if (opt_routines && mysql_get_server_version(mysql) >= 50009)
{
DBUG_PRINT("info", ("Dumping routines for database %s", db));
dump_routines_for_db(db);
}
free_root(&glob_root, MYF(0));
if (opt_xml)
{
Expand Down
4 changes: 2 additions & 2 deletions client/mysqlslap.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ build_table_string(void)

if (auto_generate_sql_guid_primary)
{
dynstr_append(&table_string, "id varchar(32) primary key");
dynstr_append(&table_string, "id varchar(36) primary key");

if (num_int_cols || num_char_cols || auto_generate_sql_guid_primary)
dynstr_append(&table_string, ",");
Expand All @@ -868,7 +868,7 @@ build_table_string(void)
if (count) /* Except for the first pass we add a comma */
dynstr_append(&table_string, ",");

if (snprintf(buf, HUGE_STRING_LENGTH, "id%d varchar(32) unique key", count)
if (snprintf(buf, HUGE_STRING_LENGTH, "id%d varchar(36) unique key", count)
> HUGE_STRING_LENGTH)
{
fprintf(stderr, "Memory Allocation error in create table\n");
Expand Down
2 changes: 1 addition & 1 deletion cmake/ctest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake)

MACRO(MY_ADD_TEST name)
ADD_TEST(${name} ${name}-t)
ADD_TEST(NAME ${name} COMMAND ${name}-t CONFIGURATIONS default_ignore)
ENDMACRO()

MACRO (MY_ADD_TESTS)
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/mysql-test-run.pl
Original file line number Diff line number Diff line change
Expand Up @@ -6128,7 +6128,7 @@ sub lldb_arguments {
$input = $input ? "< $input" : "";

# write init file for mysqld or client
mtr_tofile($lldb_init_file, "set args $str $input\n");
mtr_tofile($lldb_init_file, "process launch --stop-at-entry -- $str $input\n");

print "\nTo start lldb for $type, type in another window:\n";
print "cd $glob_mysql_test_dir && lldb -s $lldb_init_file $$exe\n";
Expand Down
16 changes: 16 additions & 0 deletions mysql-test/r/limit.result
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,19 @@ a
16
DROP TABLE t1;
End of 5.1 tests
#
# mdev-16235: SELECT over a table with LIMIT 0
#
EXPLAIN
SELECT * FROM mysql.slow_log WHERE sql_text != 'foo' LIMIT 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Zero limit
SELECT * FROM mysql.slow_log WHERE sql_text != 'foo' LIMIT 0;
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text
EXPLAIN
SELECT * FROM mysql.help_topic WHERE help_category_id != example LIMIT 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Zero limit
SELECT * FROM mysql.help_topic WHERE help_category_id != example LIMIT 0;
help_topic_id name help_category_id description example url
End of 5.5 tests
15 changes: 15 additions & 0 deletions mysql-test/r/mysqldump.result
Original file line number Diff line number Diff line change
Expand Up @@ -5404,3 +5404,18 @@ DELIMITER ;
ALTER DATABASE `a\"'``b` CHARACTER SET utf8 COLLATE utf8_general_ci ;
DROP DATABASE `a\"'``b`;
FOUND /Database: mysql/ in bug11505.sql
#
# MDEV-15021: Fix the order in which routines are called
#
use test;
CREATE FUNCTION f() RETURNS INT RETURN 1;
CREATE VIEW v1 AS SELECT f();
# Running mysqldump -uroot test --routines --tables v1 > **vardir**/test.dmp
DROP VIEW v1;
DROP FUNCTION f;
# Running mysql -uroot test < **vardir**/test.dmp
#
# Cleanup after succesful import.
#
DROP VIEW v1;
DROP FUNCTION f;
3 changes: 3 additions & 0 deletions mysql-test/r/mysqlslap.result
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,6 @@ Benchmark
# MDEV-4684 - Enhancement request: --init-command support for mysqlslap
#
DROP TABLE t1;
#
# Bug MDEV-15789 (Upstream: #80329): MYSQLSLAP OPTIONS --AUTO-GENERATE-SQL-GUID-PRIMARY and --AUTO-GENERATE-SQL-SECONDARY-INDEXES DONT WORK
#
2 changes: 1 addition & 1 deletion mysql-test/r/subselect4.result
Original file line number Diff line number Diff line change
Expand Up @@ -2499,7 +2499,7 @@ SELECT 2 IN (SELECT 2 from DUAL WHERE 1 != 1);
SET optimizer_switch= @@global.optimizer_switch;
set @@tmp_table_size= @@global.tmp_table_size;
#
# mfrv-14515: Wrong results for tableless query with subquery in WHERE
# mdev-14515: Wrong results for tableless query with subquery in WHERE
# and implicit aggregation
#
create table t1 (i1 int, i2 int);
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/subselect_mat_cost_bugs.result
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ SELECT * FROM t1
WHERE (f1) IN (SELECT f1 FROM t2)
LIMIT 0;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Zero limit
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
SELECT * FROM t1
WHERE (f1) IN (SELECT f1 FROM t2)
Expand Down
57 changes: 57 additions & 0 deletions mysql-test/r/subselect_sj2_mat.result
Original file line number Diff line number Diff line change
Expand Up @@ -1634,3 +1634,60 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 11 func 1
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where
DROP TABLE t1,t2;
#
# MDEV-16225: wrong resultset from query with semijoin=on
#
CREATE TABLE t1 (
`id` int(10) NOT NULL AUTO_INCREMENT,
`local_name` varchar(64) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;
insert into t1(`id`,`local_name`) values
(1,'Cash Advance'),
(2,'Cash Advance'),
(3,'Rollover'),
(4,'AL Installment'),
(5,'AL Installment'),
(6,'AL Installment'),
(7,'AL Installment'),
(8,'AL Installment'),
(9,'AL Installment'),
(10,'Internet Payday'),
(11,'Rollover - Internet Payday'),
(12,'AL Monthly Installment'),
(13,'AL Semi-Monthly Installment');
explain
SELECT SQL_NO_CACHE t.id
FROM t1 t
WHERE (
t.id IN (SELECT A.id FROM t1 AS A WHERE A.local_name IN (SELECT B.local_name FROM t1 AS B WHERE B.id IN (0,4,12,13,1,10,3,11)))
OR
(t.id IN (0,4,12,13,1,10,3,11))
);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t index PRIMARY PRIMARY 4 NULL 13 Using where; Using index
2 MATERIALIZED <subquery3> ALL distinct_key NULL NULL NULL 8
2 MATERIALIZED A ALL PRIMARY NULL NULL NULL 13 Using where; Using join buffer (flat, BNL join)
3 MATERIALIZED B ALL PRIMARY NULL NULL NULL 13 Using where
SELECT SQL_NO_CACHE t.id
FROM t1 t
WHERE (
t.id IN (SELECT A.id FROM t1 AS A WHERE A.local_name IN (SELECT B.local_name FROM t1 AS B WHERE B.id IN (0,4,12,13,1,10,3,11)))
OR
(t.id IN (0,4,12,13,1,10,3,11))
);
id
1
2
3
4
5
6
7
8
9
10
11
12
13
drop table t1;
2 changes: 1 addition & 1 deletion mysql-test/suite/unit/suite.pm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ sub start_test {
return "Not run for embedded server" if $::opt_embedded_server;
return "Not configured to run ctest" unless -f "../CTestTestfile.cmake";
my ($ctest_vs)= $opt_vs_config ? "--build-config $opt_vs_config" : "";
my (@ctest_list)= `cd .. && ctest $opt_vs_config --show-only --verbose`;
my (@ctest_list)= `cd .. && ctest $opt_vs_config -E MTR -C default_ignore --show-only --verbose`;
return "No ctest" if $?;

my ($command, %tests);
Expand Down
14 changes: 14 additions & 0 deletions mysql-test/t/limit.test
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,17 @@ SELECT a FROM t1 ORDER BY a LIMIT 2 OFFSET 14;
DROP TABLE t1;

--echo End of 5.1 tests

--echo #
--echo # mdev-16235: SELECT over a table with LIMIT 0
--echo #

EXPLAIN
SELECT * FROM mysql.slow_log WHERE sql_text != 'foo' LIMIT 0;
SELECT * FROM mysql.slow_log WHERE sql_text != 'foo' LIMIT 0;

EXPLAIN
SELECT * FROM mysql.help_topic WHERE help_category_id != example LIMIT 0;
SELECT * FROM mysql.help_topic WHERE help_category_id != example LIMIT 0;

--echo End of 5.5 tests
22 changes: 22 additions & 0 deletions mysql-test/t/mysqldump.test
Original file line number Diff line number Diff line change
Expand Up @@ -2570,3 +2570,25 @@ let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/bug11505.sql;
let SEARCH_PATTERN=Database: mysql;
exec $MYSQL_DUMP mysql func > $SEARCH_FILE;
source include/search_pattern_in_file.inc;

--echo #
--echo # MDEV-15021: Fix the order in which routines are called
--echo #
use test;
CREATE FUNCTION f() RETURNS INT RETURN 1;
CREATE VIEW v1 AS SELECT f();

--echo # Running mysqldump -uroot test --routines --tables v1 > **vardir**/test.dmp
--exec $MYSQL_DUMP -uroot test --routines --tables v1 > $MYSQLTEST_VARDIR/test.dmp

DROP VIEW v1;
DROP FUNCTION f;

--echo # Running mysql -uroot test < **vardir**/test.dmp
--exec $MYSQL -uroot test < $MYSQLTEST_VARDIR/test.dmp

--echo #
--echo # Cleanup after succesful import.
--echo #
DROP VIEW v1;
DROP FUNCTION f;
8 changes: 8 additions & 0 deletions mysql-test/t/mysqlslap.test
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,11 @@ DROP DATABASE bug58090;

--exec $MYSQL_SLAP --create-schema=test --init-command="CREATE TABLE t1(a INT)" --silent --concurrency=1 --iterations=1
DROP TABLE t1;

--echo #
--echo # Bug MDEV-15789 (Upstream: #80329): MYSQLSLAP OPTIONS --AUTO-GENERATE-SQL-GUID-PRIMARY and --AUTO-GENERATE-SQL-SECONDARY-INDEXES DONT WORK
--echo #

--exec $MYSQL_SLAP --concurrency=1 --silent --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --create-schema=slap

--exec $MYSQL_SLAP --concurrency=1 --silent --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-secondary-indexes=1 --create-schema=slap
2 changes: 1 addition & 1 deletion mysql-test/t/subselect4.test
Original file line number Diff line number Diff line change
Expand Up @@ -2044,7 +2044,7 @@ SET optimizer_switch= @@global.optimizer_switch;
set @@tmp_table_size= @@global.tmp_table_size;

--echo #
--echo # mfrv-14515: Wrong results for tableless query with subquery in WHERE
--echo # mdev-14515: Wrong results for tableless query with subquery in WHERE
--echo # and implicit aggregation
--echo #

Expand Down
42 changes: 42 additions & 0 deletions mysql-test/t/subselect_sj2_mat.test
Original file line number Diff line number Diff line change
Expand Up @@ -303,3 +303,45 @@ eval $q;
eval explain $q;

DROP TABLE t1,t2;

--echo #
--echo # MDEV-16225: wrong resultset from query with semijoin=on
--echo #

CREATE TABLE t1 (
`id` int(10) NOT NULL AUTO_INCREMENT,
`local_name` varchar(64) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;

insert into t1(`id`,`local_name`) values
(1,'Cash Advance'),
(2,'Cash Advance'),
(3,'Rollover'),
(4,'AL Installment'),
(5,'AL Installment'),
(6,'AL Installment'),
(7,'AL Installment'),
(8,'AL Installment'),
(9,'AL Installment'),
(10,'Internet Payday'),
(11,'Rollover - Internet Payday'),
(12,'AL Monthly Installment'),
(13,'AL Semi-Monthly Installment');

explain
SELECT SQL_NO_CACHE t.id
FROM t1 t
WHERE (
t.id IN (SELECT A.id FROM t1 AS A WHERE A.local_name IN (SELECT B.local_name FROM t1 AS B WHERE B.id IN (0,4,12,13,1,10,3,11)))
OR
(t.id IN (0,4,12,13,1,10,3,11))
);
SELECT SQL_NO_CACHE t.id
FROM t1 t
WHERE (
t.id IN (SELECT A.id FROM t1 AS A WHERE A.local_name IN (SELECT B.local_name FROM t1 AS B WHERE B.id IN (0,4,12,13,1,10,3,11)))
OR
(t.id IN (0,4,12,13,1,10,3,11))
);
drop table t1;
4 changes: 4 additions & 0 deletions sql-common/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -2518,6 +2518,10 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio,
mysql->client_flag|= CLIENT_MULTI_RESULTS;

#ifdef HAVE_OPENSSL
if (mysql->options.ssl_key || mysql->options.ssl_cert ||
mysql->options.ssl_ca || mysql->options.ssl_capath ||
mysql->options.ssl_cipher)
mysql->options.use_ssl = 1;
if (mysql->options.use_ssl)
mysql->client_flag|= CLIENT_SSL;
#endif /* HAVE_OPENSSL */
Expand Down
3 changes: 3 additions & 0 deletions sql/sql_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6160,6 +6160,9 @@ find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name,
column reference. See create_view_field() for details.
*/
item= nj_col->create_item(thd);
if (!item)
DBUG_RETURN(NULL);

/*
*ref != NULL means that *ref contains the item that we need to
replace. If the item was aliased by the user, set the alias to
Expand Down
Loading

0 comments on commit 3ead951

Please sign in to comment.