summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicențiu Ciorbaru <vicentiu@mariadb.org>2018-06-10 17:16:27 +0300
committerVicențiu Ciorbaru <vicentiu@mariadb.org>2018-06-10 17:16:27 +0300
commit3ead95118098340f7fe36e34e1690839d183db1e (patch)
tree90dcbcf7f6793609af78220fd45bf7337f00ff62
parent7053e26e1869962ef473043686996f40ac0fb88c (diff)
parent1d43f71c7b4c39a6fd196c104b5ebafb65376199 (diff)
downloadmariadb-git-3ead95118098340f7fe36e34e1690839d183db1e.tar.gz
Merge branch '5.5' into 10.0
-rw-r--r--.gitignore6
-rw-r--r--CMakeLists.txt4
-rw-r--r--client/mysqldump.c15
-rw-r--r--client/mysqlslap.c4
-rw-r--r--cmake/ctest.cmake2
-rwxr-xr-xmysql-test/mysql-test-run.pl2
-rw-r--r--mysql-test/r/limit.result16
-rw-r--r--mysql-test/r/mysqldump.result15
-rw-r--r--mysql-test/r/mysqlslap.result3
-rw-r--r--mysql-test/r/subselect4.result2
-rw-r--r--mysql-test/r/subselect_mat_cost_bugs.result2
-rw-r--r--mysql-test/r/subselect_sj2_mat.result57
-rw-r--r--mysql-test/suite/unit/suite.pm2
-rw-r--r--mysql-test/t/limit.test14
-rw-r--r--mysql-test/t/mysqldump.test22
-rw-r--r--mysql-test/t/mysqlslap.test8
-rw-r--r--mysql-test/t/subselect4.test2
-rw-r--r--mysql-test/t/subselect_sj2_mat.test42
-rw-r--r--sql-common/client.c4
-rw-r--r--sql/sql_base.cc3
-rw-r--r--sql/sql_select.cc63
-rw-r--r--sql/table.cc2
-rw-r--r--storage/tokudb/CMakeLists.txt6
-rw-r--r--storage/tokudb/PerconaFT/portability/memory.h2
-rw-r--r--storage/tokudb/PerconaFT/util/dmt.cc4
-rw-r--r--storage/tokudb/PerconaFT/util/omt.h8
-rw-r--r--unittest/sql/CMakeLists.txt3
27 files changed, 259 insertions, 54 deletions
diff --git a/.gitignore b/.gitignore
index f1c300a89c6..b8d5ea0f803 100644
--- a/.gitignore
+++ b/.gitignore
@@ -461,3 +461,9 @@ UpgradeLog*.htm
# Microsoft Fakes
FakesAssemblies/
+
+# macOS garbage
+.DS_Store
+
+# QtCreator && CodeBlocks
+*.cbp
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 11874650d18..c70ad8b035f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 66a2b5f795c..7e09f5202fd 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -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");
@@ -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++)
{
@@ -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)
{
diff --git a/client/mysqlslap.c b/client/mysqlslap.c
index a78bf35d51b..7b3dcced37d 100644
--- a/client/mysqlslap.c
+++ b/client/mysqlslap.c
@@ -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, ",");
@@ -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");
diff --git a/cmake/ctest.cmake b/cmake/ctest.cmake
index 08852a366f6..fde7e1632f6 100644
--- a/cmake/ctest.cmake
+++ b/cmake/ctest.cmake
@@ -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)
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index dfeca25a361..f6d8cda592d 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -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";
diff --git a/mysql-test/r/limit.result b/mysql-test/r/limit.result
index 176a93c7a46..deb4ca2ab95 100644
--- a/mysql-test/r/limit.result
+++ b/mysql-test/r/limit.result
@@ -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
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 2d26bc774cb..efcfec4ee7a 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -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;
diff --git a/mysql-test/r/mysqlslap.result b/mysql-test/r/mysqlslap.result
index d3c5107dee3..791cb5ac6b3 100644
--- a/mysql-test/r/mysqlslap.result
+++ b/mysql-test/r/mysqlslap.result
@@ -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
+#
diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result
index 574660f0cbb..c610f06688a 100644
--- a/mysql-test/r/subselect4.result
+++ b/mysql-test/r/subselect4.result
@@ -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);
diff --git a/mysql-test/r/subselect_mat_cost_bugs.result b/mysql-test/r/subselect_mat_cost_bugs.result
index df6b543bab8..d33f1488e4d 100644
--- a/mysql-test/r/subselect_mat_cost_bugs.result
+++ b/mysql-test/r/subselect_mat_cost_bugs.result
@@ -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)
diff --git a/mysql-test/r/subselect_sj2_mat.result b/mysql-test/r/subselect_sj2_mat.result
index 5d0c64e9ddb..c629c8196c7 100644
--- a/mysql-test/r/subselect_sj2_mat.result
+++ b/mysql-test/r/subselect_sj2_mat.result
@@ -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;
diff --git a/mysql-test/suite/unit/suite.pm b/mysql-test/suite/unit/suite.pm
index 966fd278a52..fa1da2ae4ff 100644
--- a/mysql-test/suite/unit/suite.pm
+++ b/mysql-test/suite/unit/suite.pm
@@ -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);
diff --git a/mysql-test/t/limit.test b/mysql-test/t/limit.test
index 4dbe13096d4..668d3b74518 100644
--- a/mysql-test/t/limit.test
+++ b/mysql-test/t/limit.test
@@ -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
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index bb5a9ae1846..784e65af3f5 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -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;
diff --git a/mysql-test/t/mysqlslap.test b/mysql-test/t/mysqlslap.test
index c49c4ab3d7d..81115d59d09 100644
--- a/mysql-test/t/mysqlslap.test
+++ b/mysql-test/t/mysqlslap.test
@@ -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
diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test
index 2520159b165..262249d81a5 100644
--- a/mysql-test/t/subselect4.test
+++ b/mysql-test/t/subselect4.test
@@ -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 #
diff --git a/mysql-test/t/subselect_sj2_mat.test b/mysql-test/t/subselect_sj2_mat.test
index cfb6c8c2819..0665cdf68fe 100644
--- a/mysql-test/t/subselect_sj2_mat.test
+++ b/mysql-test/t/subselect_sj2_mat.test
@@ -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;
diff --git a/sql-common/client.c b/sql-common/client.c
index 203e822d3da..8c093abf7e0 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -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 */
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index dc61f396605..0b14e5777c3 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -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
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 1f15d5bcec0..f7f6287c3fd 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1245,10 +1245,19 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
if (cond_value == Item::COND_FALSE || having_value == Item::COND_FALSE ||
(!unit->select_limit_cnt && !(select_options & OPTION_FOUND_ROWS)))
{ /* Impossible cond */
- DBUG_PRINT("info", (having_value == Item::COND_FALSE ?
- "Impossible HAVING" : "Impossible WHERE"));
- zero_result_cause= having_value == Item::COND_FALSE ?
- "Impossible HAVING" : "Impossible WHERE";
+ if (unit->select_limit_cnt)
+ {
+ DBUG_PRINT("info", (having_value == Item::COND_FALSE ?
+ "Impossible HAVING" : "Impossible WHERE"));
+ zero_result_cause= having_value == Item::COND_FALSE ?
+ "Impossible HAVING" : "Impossible WHERE";
+ }
+ else
+ {
+ DBUG_PRINT("info", ("Zero limit"));
+ zero_result_cause= "Zero limit";
+ conds= 0;
+ }
table_count= top_join_tab_count= 0;
error= 0;
goto setup_subq_exit;
@@ -24803,21 +24812,18 @@ void JOIN::set_allowed_join_cache_types()
void JOIN::save_query_plan(Join_plan_state *save_to)
{
- if (keyuse.elements)
- {
- DYNAMIC_ARRAY tmp_keyuse;
- /* Swap the current and the backup keyuse internal arrays. */
- tmp_keyuse= keyuse;
- keyuse= save_to->keyuse; /* keyuse is reset to an empty array. */
- save_to->keyuse= tmp_keyuse;
+ DYNAMIC_ARRAY tmp_keyuse;
+ /* Swap the current and the backup keyuse internal arrays. */
+ tmp_keyuse= keyuse;
+ keyuse= save_to->keyuse; /* keyuse is reset to an empty array. */
+ save_to->keyuse= tmp_keyuse;
- for (uint i= 0; i < table_count; i++)
- {
- save_to->join_tab_keyuse[i]= join_tab[i].keyuse;
- join_tab[i].keyuse= NULL;
- save_to->join_tab_checked_keys[i]= join_tab[i].checked_keys;
- join_tab[i].checked_keys.clear_all();
- }
+ for (uint i= 0; i < table_count; i++)
+ {
+ save_to->join_tab_keyuse[i]= join_tab[i].keyuse;
+ join_tab[i].keyuse= NULL;
+ save_to->join_tab_checked_keys[i]= join_tab[i].checked_keys;
+ join_tab[i].checked_keys.clear_all();
}
memcpy((uchar*) save_to->best_positions, (uchar*) best_positions,
sizeof(POSITION) * (table_count + 1));
@@ -24855,20 +24861,17 @@ void JOIN::reset_query_plan()
void JOIN::restore_query_plan(Join_plan_state *restore_from)
{
- if (restore_from->keyuse.elements)
- {
- DYNAMIC_ARRAY tmp_keyuse;
- tmp_keyuse= keyuse;
- keyuse= restore_from->keyuse;
- restore_from->keyuse= tmp_keyuse;
-
- for (uint i= 0; i < table_count; i++)
- {
- join_tab[i].keyuse= restore_from->join_tab_keyuse[i];
- join_tab[i].checked_keys= restore_from->join_tab_checked_keys[i];
- }
+ DYNAMIC_ARRAY tmp_keyuse;
+ tmp_keyuse= keyuse;
+ keyuse= restore_from->keyuse;
+ restore_from->keyuse= tmp_keyuse;
+ for (uint i= 0; i < table_count; i++)
+ {
+ join_tab[i].keyuse= restore_from->join_tab_keyuse[i];
+ join_tab[i].checked_keys= restore_from->join_tab_checked_keys[i];
}
+
memcpy((uchar*) best_positions, (uchar*) restore_from->best_positions,
sizeof(POSITION) * (table_count + 1));
/* Restore SJM nests */
diff --git a/sql/table.cc b/sql/table.cc
index b5082df7076..6a5cd7dba59 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -5336,6 +5336,8 @@ Item *create_view_field(THD *thd, TABLE_LIST *view, Item **field_ref,
Item *item= new Item_direct_view_ref(&view->view->select_lex.context,
field_ref, view->alias,
name, view);
+ if (!item)
+ return NULL;
/*
Force creation of nullable item for the result tmp table for outer joined
views/derived tables.
diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt
index 3823cc50b6a..3099e704497 100644
--- a/storage/tokudb/CMakeLists.txt
+++ b/storage/tokudb/CMakeLists.txt
@@ -23,6 +23,12 @@ IF(NOT LIBJEMALLOC)
MESSAGE(WARNING "TokuDB is enabled, but jemalloc is not. This configuration is not supported")
ENDIF()
+CHECK_C_COMPILER_FLAG("-Wshadow" HAVE_WSHADOW)
+IF (HAVE_WSHADOW)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-shadow")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-shadow")
+ENDIF()
+
IF (HAVE_WVLA)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-vla")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-vla")
diff --git a/storage/tokudb/PerconaFT/portability/memory.h b/storage/tokudb/PerconaFT/portability/memory.h
index 5ae652d39fc..851e4d69e03 100644
--- a/storage/tokudb/PerconaFT/portability/memory.h
+++ b/storage/tokudb/PerconaFT/portability/memory.h
@@ -107,7 +107,7 @@ size_t toku_malloc_usable_size(void *p) __attribute__((__visibility__("default")
#define XMALLOC(v) CAST_FROM_VOIDP(v, toku_xmalloc(sizeof(*v)))
#define XMALLOC_N(n,v) CAST_FROM_VOIDP(v, toku_xmalloc((n)*sizeof(*v)))
#define XCALLOC_N(n,v) CAST_FROM_VOIDP(v, toku_xcalloc((n), (sizeof(*v))))
-#define XCALLOC(v) XCALLOC_N(1,(v))
+#define XCALLOC(v) XCALLOC_N(1,v)
#define XREALLOC(v,s) CAST_FROM_VOIDP(v, toku_xrealloc(v, s))
#define XREALLOC_N(n,v) CAST_FROM_VOIDP(v, toku_xrealloc(v, (n)*sizeof(*v)))
diff --git a/storage/tokudb/PerconaFT/util/dmt.cc b/storage/tokudb/PerconaFT/util/dmt.cc
index b5b94982487..642c9367d7e 100644
--- a/storage/tokudb/PerconaFT/util/dmt.cc
+++ b/storage/tokudb/PerconaFT/util/dmt.cc
@@ -80,8 +80,8 @@ void dmt<dmtdata_t, dmtdataout_t, dmtwriter_t>::create_from_sorted_memory_of_fix
paranoid_invariant(numvalues > 0);
void *ptr = toku_mempool_malloc(&this->mp, aligned_memsize);
paranoid_invariant_notnull(ptr);
- uint8_t * const CAST_FROM_VOIDP(dest, ptr);
- const uint8_t * const CAST_FROM_VOIDP(src, mem);
+ uint8_t * CAST_FROM_VOIDP(dest, ptr);
+ const uint8_t * CAST_FROM_VOIDP(src, mem);
if (pad_bytes == 0) {
paranoid_invariant(aligned_memsize == mem_length);
memcpy(dest, src, aligned_memsize);
diff --git a/storage/tokudb/PerconaFT/util/omt.h b/storage/tokudb/PerconaFT/util/omt.h
index c7ed2ca546f..36946401381 100644
--- a/storage/tokudb/PerconaFT/util/omt.h
+++ b/storage/tokudb/PerconaFT/util/omt.h
@@ -127,7 +127,7 @@ public:
paranoid_invariant(index != NODE_NULL);
m_index = index;
}
-} __attribute__((__packed__,aligned(4)));
+} ;
template<>
class subtree_templated<true> {
@@ -184,7 +184,7 @@ public:
inline void disable_bit(void) {
m_bitfield &= MASK_INDEX;
}
-} __attribute__((__packed__)) ;
+} ;
template<typename omtdata_t, bool subtree_supports_marks>
class omt_node_templated {
@@ -197,7 +197,7 @@ public:
// this needs to be in both implementations because we don't have
// a "static if" the caller can use
inline void clear_stolen_bits(void) {}
-} __attribute__((__packed__,aligned(4)));
+} ;
template<typename omtdata_t>
class omt_node_templated<omtdata_t, true> {
@@ -234,7 +234,7 @@ public:
this->unset_marked_bit();
this->unset_marks_below_bit();
}
-} __attribute__((__packed__,aligned(4)));
+} ;
}
diff --git a/unittest/sql/CMakeLists.txt b/unittest/sql/CMakeLists.txt
index 7cc05e8cea2..e8ecdf0722d 100644
--- a/unittest/sql/CMakeLists.txt
+++ b/unittest/sql/CMakeLists.txt
@@ -28,5 +28,4 @@ ELSE()
ENDIF()
TARGET_LINK_LIBRARIES(explain_filename-t sql mytap)
-ADD_TEST(explain_filename explain_filename-t)
-
+MY_ADD_TEST(explain_filename explain_filename-t)