summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2016-11-18 22:33:25 +0300
committerSergei Petrunia <psergey@askmonty.org>2016-11-18 22:33:25 +0300
commitd66e1119d31fda5d744d0b5bdd5bb91ce434e56e (patch)
tree1481900e486e34415e81482a6005f565ff735008
parentdace5f9a2f717a627340502ed4fa5e0226de71c6 (diff)
parentb16206845627c2bdcf2df7c5786680c9ba2f47da (diff)
downloadmariadb-git-d66e1119d31fda5d744d0b5bdd5bb91ce434e56e.tar.gz
Merge branch '10.2' of github.com:MariaDB/server into 10.2
-rw-r--r--debian/control18
-rw-r--r--debian/libmariadbclient-dev.install3
-rw-r--r--debian/libmariadbd-dev.install2
-rw-r--r--debian/libmariadbd18.install1
-rw-r--r--debian/libmariadbd19.install1
m---------libmariadb0
-rw-r--r--mysql-test/r/derived_cond_pushdown.result95
-rw-r--r--mysql-test/t/derived_cond_pushdown.test39
-rw-r--r--sql/item_cmpfunc.h2
-rw-r--r--sql/sql_prepare.cc4
-rw-r--r--sql/sql_select.cc15
-rw-r--r--storage/spider/mysql-test/spider/bg/suite.pm1
-rw-r--r--storage/spider/mysql-test/spider/suite.pm1
13 files changed, 176 insertions, 6 deletions
diff --git a/debian/control b/debian/control
index c8b0dfb6785..d53c84bf513 100644
--- a/debian/control
+++ b/debian/control
@@ -74,7 +74,8 @@ Architecture: any
Section: libdevel
Provides: libmysqld-dev
Pre-Depends: ${misc:Pre-Depends}
-Depends: libmariadbclient-dev (= ${binary:Version}),
+Depends: libmariadbd19,
+ libmariadbclient-dev (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: libmysqld-dev
@@ -87,6 +88,21 @@ Description: MariaDB embedded database, development files
.
This package includes the embedded server library development and header files.
+Package: libmariadbd19
+Architecture: any
+Section: libs
+Depends: ${misc:Depends}, ${shlibs:Depends}
+Multi-Arch: same
+Breaks: libmariadbd-dev (<< ${source:Version}), libmysqld-dev
+Replaces: libmariadbd-dev (<< ${source:Version}), libmysqld-dev
+Description: MariaDB embedded database, shared library
+ MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
+ server. SQL (Structured Query Language) is the most popular database query
+ language in the world. The main goals of MariaDB are speed, robustness and
+ ease of use.
+ .
+ This package includes a shared library for embedded MariaDB applications
+
Package: libmariadbclient-dev
Architecture: any
Section: libdevel
diff --git a/debian/libmariadbclient-dev.install b/debian/libmariadbclient-dev.install
index 9e481125c65..2097df6b99c 100644
--- a/debian/libmariadbclient-dev.install
+++ b/debian/libmariadbclient-dev.install
@@ -1,6 +1,7 @@
usr/bin/mysql_config
usr/include/mariadb
-usr/include/mysql/*
+usr/include/mysql/*.h
+usr/include/mysql/psi/*.h
usr/lib/*/libmariadb.so
usr/lib/*/libmariadbclient.a
usr/lib/*/libmysqlservices.a
diff --git a/debian/libmariadbd-dev.install b/debian/libmariadbd-dev.install
index 4608bf6e838..7b058025175 100644
--- a/debian/libmariadbd-dev.install
+++ b/debian/libmariadbd-dev.install
@@ -1,2 +1,2 @@
usr/lib/*/libmysqld.a
-usr/lib/*/libmysqld.so
+usr/bin/mariadb_config
diff --git a/debian/libmariadbd18.install b/debian/libmariadbd18.install
deleted file mode 100644
index 9ae9f9e1721..00000000000
--- a/debian/libmariadbd18.install
+++ /dev/null
@@ -1 +0,0 @@
-usr/lib/*/libmysqld.so.18
diff --git a/debian/libmariadbd19.install b/debian/libmariadbd19.install
new file mode 100644
index 00000000000..a6b58841445
--- /dev/null
+++ b/debian/libmariadbd19.install
@@ -0,0 +1 @@
+usr/lib/*/libmysqld.so*
diff --git a/libmariadb b/libmariadb
-Subproject c8dd0899d484ad698ec2da5bc8e3d19ff8b623b
+Subproject 3837442cbc62c867198091b43dff40198fb6b76
diff --git a/mysql-test/r/derived_cond_pushdown.result b/mysql-test/r/derived_cond_pushdown.result
index d2a51ec5536..98430509618 100644
--- a/mysql-test/r/derived_cond_pushdown.result
+++ b/mysql-test/r/derived_cond_pushdown.result
@@ -7167,3 +7167,98 @@ EXPLAIN
}
DROP VIEW v2,v3;
DROP TABLE t1,t2,t3;
+#
+# MDEV-11102: condition pushdown into materialized inner table
+# of outer join is not applied as not being valid
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0),(2);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (1),(2);
+CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2;
+SELECT * FROM t1 LEFT JOIN t2 ON a = b WHERE b IS NULL;
+a b
+0 NULL
+SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL;
+a b
+0 NULL
+EXPLAIN FORMAT=JSON
+SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL;
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ },
+ "table": {
+ "table_name": "<derived2>",
+ "access_type": "ref",
+ "possible_keys": ["key0"],
+ "key": "key0",
+ "key_length": "5",
+ "used_key_parts": ["b"],
+ "ref": ["test.t1.a"],
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "(trigcond(isnull(v2.b)) and trigcond(trigcond((t1.a is not null))))",
+ "materialized": {
+ "query_block": {
+ "select_id": 2,
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ }
+}
+DROP VIEW v2;
+DROP TABLE t1,t2;
+#
+# MDEV-11103: pushdown condition with ANY subquery
+#
+CREATE TABLE t1 (i INT);
+CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
+INSERT INTO t1 VALUES (1),(2);
+EXPLAIN FORMAT=JSON
+SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 );
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "<derived3>",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "<nop>((v1.i <= 3))",
+ "materialized": {
+ "query_block": {
+ "select_id": 3,
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "rows": 2,
+ "filtered": 100,
+ "attached_condition": "<nop>((t1.i <= 3))"
+ }
+ }
+ }
+ }
+ }
+}
+Warnings:
+Note 1249 Select 2 was reduced during optimization
+SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 );
+i
+1
+2
+DROP VIEW v1;
+DROP TABLE t1;
diff --git a/mysql-test/t/derived_cond_pushdown.test b/mysql-test/t/derived_cond_pushdown.test
index 01d8501016a..1e498661975 100644
--- a/mysql-test/t/derived_cond_pushdown.test
+++ b/mysql-test/t/derived_cond_pushdown.test
@@ -988,3 +988,42 @@ SELECT * FROM t1 WHERE a IN (
DROP VIEW v2,v3;
DROP TABLE t1,t2,t3;
+
+--echo #
+--echo # MDEV-11102: condition pushdown into materialized inner table
+--echo # of outer join is not applied as not being valid
+--echo #
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0),(2);
+
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (1),(2);
+
+CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2;
+
+SELECT * FROM t1 LEFT JOIN t2 ON a = b WHERE b IS NULL;
+
+SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL;
+
+EXPLAIN FORMAT=JSON
+SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL;
+
+DROP VIEW v2;
+DROP TABLE t1,t2;
+
+--echo #
+--echo # MDEV-11103: pushdown condition with ANY subquery
+--echo #
+
+CREATE TABLE t1 (i INT);
+CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
+INSERT INTO t1 VALUES (1),(2);
+
+EXPLAIN FORMAT=JSON
+SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 );
+
+SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 );
+
+DROP VIEW v1;
+DROP TABLE t1;
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 6d432bd97f3..b0120dd6c63 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -649,6 +649,8 @@ public:
longlong val_int();
const char *func_name() const { return "<nop>"; }
Item *neg_transformer(THD *thd);
+ Item *get_copy(THD *thd, MEM_ROOT *mem_root)
+ { return get_item_copy<Item_func_nop_all>(thd, mem_root, this); }
};
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 414f5a4f5c2..97a33a5abc1 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -3063,7 +3063,11 @@ void mysqld_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
uchar *packet= (uchar*)packet_arg; // GCC 4.0.1 workaround
ulong stmt_id= uint4korr(packet);
ulong flags= (ulong) packet[4];
+#ifndef EMBEDDED_LIBRARY
ulong iterations= uint4korr(packet + 5);
+#else
+ ulong iterations= 0; // no support
+#endif
/* Query text for binary, general or slow log, if any of them is open */
String expanded_query;
uchar *packet_end= packet + packet_length;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 1f79010e993..1114e1e1f1d 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1277,10 +1277,21 @@ JOIN::optimize_inner()
List_iterator_fast<TABLE_LIST> li(select_lex->leaf_tables);
while ((tbl= li++))
{
+ /*
+ Do not push conditions from where into materialized inner tables
+ of outer joins: this is not valid.
+ */
if (tbl->is_materialized_derived())
{
- if (pushdown_cond_for_derived(thd, conds, tbl))
- DBUG_RETURN(1);
+ /*
+ Do not push conditions from where into materialized inner tables
+ of outer joins: this is not valid.
+ */
+ if (!tbl->is_inner_table_of_outer_join())
+ {
+ if (pushdown_cond_for_derived(thd, conds, tbl))
+ DBUG_RETURN(1);
+ }
if (mysql_handle_single_derived(thd->lex, tbl, DT_OPTIMIZE))
DBUG_RETURN(1);
}
diff --git a/storage/spider/mysql-test/spider/bg/suite.pm b/storage/spider/mysql-test/spider/bg/suite.pm
index 5569c57bec9..1bb6d7592c8 100644
--- a/storage/spider/mysql-test/spider/bg/suite.pm
+++ b/storage/spider/mysql-test/spider/bg/suite.pm
@@ -4,6 +4,7 @@ package My::Suite::Spider;
return "No Spider engine" unless $ENV{HA_SPIDER_SO};
return "Not run for embedded server" if $::opt_embedded_server;
+return "Test needs --big-test" unless $::opt_big_test;
bless { };
diff --git a/storage/spider/mysql-test/spider/suite.pm b/storage/spider/mysql-test/spider/suite.pm
index 171fa6c4f01..f106147deb6 100644
--- a/storage/spider/mysql-test/spider/suite.pm
+++ b/storage/spider/mysql-test/spider/suite.pm
@@ -4,6 +4,7 @@ package My::Suite::Spider;
return "No Spider engine" unless $ENV{HA_SPIDER_SO};
return "Not run for embedded server" if $::opt_embedded_server;
+return "Test needs --big-test" unless $::opt_big_test;
sub is_default { 1 }