summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-07-20 10:54:17 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-07-20 10:54:17 +0300
commiteb9a28478f88a29814779451e8cc91b8a5659446 (patch)
tree1b24ac84ceb28e5df3c85e253f988ad0e3bc88d3
parent832e473d5ea62c72e39fae3b6bc691994ff6a5fb (diff)
parentb4ec3313f6bb3a222b3528b5a8a6dca73b870c20 (diff)
downloadmariadb-git-eb9a28478f88a29814779451e8cc91b8a5659446.tar.gz
Merge 10.5 into 10.6
-rw-r--r--mysql-test/main/cte_nonrecursive.result2
-rw-r--r--mysql-test/main/cte_recursive.result19
-rw-r--r--mysql-test/main/cte_recursive.test17
-rw-r--r--mysql-test/main/wolfssl.result3
-rw-r--r--mysql-test/suite/innodb/r/instant_alter_debug,dynamic.rdiff6
-rw-r--r--mysql-test/suite/perfschema/include/default_mysqld_autosize.cnf53
-rw-r--r--mysql-test/suite/perfschema/include/have_aligned_memory.inc5
-rw-r--r--sql/sql_cte.cc10
-rw-r--r--sql/sql_table.cc4
-rw-r--r--sql/threadpool_generic.cc7
-rw-r--r--storage/spider/mysql-test/spider/r/basic_sql.result6
-rw-r--r--storage/spider/mysql-test/spider/t/basic_sql.test7
-rw-r--r--storage/spider/spd_table.h5
13 files changed, 127 insertions, 17 deletions
diff --git a/mysql-test/main/cte_nonrecursive.result b/mysql-test/main/cte_nonrecursive.result
index 36e7baada00..f1eb1dc1268 100644
--- a/mysql-test/main/cte_nonrecursive.result
+++ b/mysql-test/main/cte_nonrecursive.result
@@ -1126,7 +1126,7 @@ NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL NULL
NULL UNION RESULT <union11,12> ALL NULL NULL NULL NULL NULL NULL
NULL UNION RESULT <union1,6> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 with cte_e as (with cte_o as (with cte_i as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1 union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1)select `cte_e1`.`a` AS `a` from `cte_e` `cte_e1` where `cte_e1`.`a` > 1 union select `cte_e2`.`a` AS `a` from `cte_e` `cte_e2`
+Note 1003 with cte_e as (with cte_o as (with cte_i as (/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)/* select#3 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)/* select#4 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1 union /* select#5 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1)/* select#1 */ select `cte_e1`.`a` AS `a` from `cte_e` `cte_e1` where `cte_e1`.`a` > 1 union /* select#6 */ select `cte_e2`.`a` AS `a` from `cte_e` `cte_e2`
drop table t1;
#
# MDEV-13753: embedded CTE in a VIEW created in prepared statement
diff --git a/mysql-test/main/cte_recursive.result b/mysql-test/main/cte_recursive.result
index dedef068129..805352307ba 100644
--- a/mysql-test/main/cte_recursive.result
+++ b/mysql-test/main/cte_recursive.result
@@ -4790,3 +4790,22 @@ a
NULL
DROP TABLE t1;
# End of 10.3 tests
+#
+# MDEV-26108: Recursive CTE embedded into another CTE which is used twice
+#
+create table t1 (a int);
+insert into t1 values (5), (7);
+with cte_e as (
+with recursive cte_r as (
+select a from t1 union select a+1 as a from cte_r r where a < 10
+) select * from cte_r
+) select * from cte_e s1, cte_e s2 where s1.a=s2.a;
+a a
+5 5
+7 7
+6 6
+8 8
+9 9
+10 10
+drop table t1;
+# End of 10.4 tests
diff --git a/mysql-test/main/cte_recursive.test b/mysql-test/main/cte_recursive.test
index e258d3c3397..eb9150ec86f 100644
--- a/mysql-test/main/cte_recursive.test
+++ b/mysql-test/main/cte_recursive.test
@@ -3091,3 +3091,20 @@ SELECT * FROM cte;
DROP TABLE t1;
--echo # End of 10.3 tests
+
+--echo #
+--echo # MDEV-26108: Recursive CTE embedded into another CTE which is used twice
+--echo #
+
+create table t1 (a int);
+insert into t1 values (5), (7);
+
+with cte_e as (
+ with recursive cte_r as (
+ select a from t1 union select a+1 as a from cte_r r where a < 10
+ ) select * from cte_r
+) select * from cte_e s1, cte_e s2 where s1.a=s2.a;
+
+drop table t1;
+
+--echo # End of 10.4 tests
diff --git a/mysql-test/main/wolfssl.result b/mysql-test/main/wolfssl.result
new file mode 100644
index 00000000000..88df540ca95
--- /dev/null
+++ b/mysql-test/main/wolfssl.result
@@ -0,0 +1,3 @@
+SELECT @@ssl_cipher;
+@@ssl_cipher
+ECDHE-RSA-AES256-GCM-SHA384
diff --git a/mysql-test/suite/innodb/r/instant_alter_debug,dynamic.rdiff b/mysql-test/suite/innodb/r/instant_alter_debug,dynamic.rdiff
new file mode 100644
index 00000000000..379514edad9
--- /dev/null
+++ b/mysql-test/suite/innodb/r/instant_alter_debug,dynamic.rdiff
@@ -0,0 +1,6 @@
+@@ -470,4 +470,4 @@
+ FROM information_schema.global_status
+ WHERE variable_name = 'innodb_instant_alter_column';
+ instants
+-33
++32
diff --git a/mysql-test/suite/perfschema/include/default_mysqld_autosize.cnf b/mysql-test/suite/perfschema/include/default_mysqld_autosize.cnf
new file mode 100644
index 00000000000..eee52ede869
--- /dev/null
+++ b/mysql-test/suite/perfschema/include/default_mysqld_autosize.cnf
@@ -0,0 +1,53 @@
+
+# Default values that applies to all MySQL Servers
+[mysqld]
+local-infile
+character-set-server= latin1
+default-storage-engine=myisam
+
+# Increase default connect_timeout to avoid intermittent
+# disconnects when test servers are put under load see BUG#28359
+connect-timeout= 60
+
+log-bin-trust-function-creators=1
+key_buffer_size= 1M
+sort_buffer_size= 256K
+max_heap_table_size= 1M
+
+loose-innodb_data_file_path= ibdata1:10M:autoextend
+loose-innodb_buffer_pool_size= 8M
+loose-innodb_lru_scan_depth= 100
+loose-innodb_write_io_threads= 2
+loose-innodb_read_io_threads= 2
+loose-innodb_log_buffer_size= 1M
+loose-innodb_log_file_size= 5M
+loose-innodb_log_files_in_group= 2
+
+slave-net-timeout=120
+
+log-bin=mysqld-bin
+
+# No performance schema sizing provided
+
+# Disable everything, we only need the sizing data,
+# and also need a stable output for show engine performance_schema status
+loose-performance-schema-consumer-global-instrumentation=OFF
+
+loose-performance-schema-instrument='%=ON'
+
+loose-performance-schema-consumer-events-stages-current=ON
+loose-performance-schema-consumer-events-stages-history=ON
+loose-performance-schema-consumer-events-stages-history-long=ON
+loose-performance-schema-consumer-events-statements-current=ON
+loose-performance-schema-consumer-events-statements-history=ON
+loose-performance-schema-consumer-events-statements-history-long=ON
+loose-performance-schema-consumer-events-transactions-current=ON
+loose-performance-schema-consumer-events-transactions-history=ON
+loose-performance-schema-consumer-events-transactions-history-long=ON
+loose-performance-schema-consumer-events-waits-current=ON
+loose-performance-schema-consumer-events-waits-history=ON
+loose-performance-schema-consumer-events-waits-history-long=ON
+loose-performance-schema-consumer-thread-instrumentation=ON
+
+binlog-direct-non-transactional-updates
+
diff --git a/mysql-test/suite/perfschema/include/have_aligned_memory.inc b/mysql-test/suite/perfschema/include/have_aligned_memory.inc
index 9638cbe1da4..d420f0e055a 100644
--- a/mysql-test/suite/perfschema/include/have_aligned_memory.inc
+++ b/mysql-test/suite/perfschema/include/have_aligned_memory.inc
@@ -4,10 +4,7 @@
# For tests sensitive to the internal sizes (show engine performance_schema
# status), make sure we use a platform with aligned memory.
---disable_query_log
-let $aligned = `SELECT count(*) from performance_schema.session_connect_attrs where PROCESSLIST_ID = connection_id() and ATTR_NAME = '_os' and ATTR_VALUE in ('Linux', 'Windows')`;
-if (!$aligned)
+if (`SELECT count(*)=0 from performance_schema.session_connect_attrs where PROCESSLIST_ID = connection_id() and ATTR_NAME = '_os' and ATTR_VALUE in ('Linux', 'Windows')`)
{
skip Need a platform with aligned memory;
}
---enable_query_log
diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc
index 396b3f2c8a9..7993cbe09a1 100644
--- a/sql/sql_cte.cc
+++ b/sql/sql_cte.cc
@@ -1039,6 +1039,7 @@ st_select_lex_unit *With_element::clone_parsed_spec(LEX *old_lex,
bool parse_status= false;
st_select_lex *with_select;
+ st_select_lex *last_clone_select;
char save_end= unparsed_spec.str[unparsed_spec.length];
((char*) &unparsed_spec.str[unparsed_spec.length])[0]= '\0';
@@ -1125,11 +1126,14 @@ st_select_lex_unit *With_element::clone_parsed_spec(LEX *old_lex,
lex->unit.include_down(with_table->select_lex);
lex->unit.set_slave(with_select);
lex->unit.cloned_from= spec;
+ last_clone_select= lex->all_selects_list;
+ while (last_clone_select->next_select_in_list())
+ last_clone_select= last_clone_select->next_select_in_list();
old_lex->all_selects_list=
(st_select_lex*) (lex->all_selects_list->
- insert_chain_before(
- (st_select_lex_node **) &(old_lex->all_selects_list),
- with_select));
+ insert_chain_before(
+ (st_select_lex_node **) &(old_lex->all_selects_list),
+ last_clone_select));
/*
Now all references to the CTE defined outside of the cloned specification
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 88fe883c2a4..db6084f3bd8 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1235,7 +1235,6 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables,
bool wrong_drop_sequence= 0;
bool table_dropped= 0, res;
bool is_temporary= 0;
- bool was_view= 0, was_table= 0;
const LEX_CSTRING db= table->db;
const LEX_CSTRING table_name= table->table_name;
LEX_CSTRING cpath= {0,0};
@@ -1392,7 +1391,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables,
}
thd->replication_flags= 0;
- was_view= table_type == TABLE_TYPE_VIEW;
+ const bool was_view= table_type == TABLE_TYPE_VIEW;
if (!table_count++)
{
@@ -1414,7 +1413,6 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables,
. "DROP SEQUENCE", but it's not a sequence
*/
wrong_drop_sequence= drop_sequence && hton;
- was_table|= wrong_drop_sequence;
error= table_type == TABLE_TYPE_UNKNOWN ? ENOENT : -1;
tdc_remove_table(thd, db.str, table_name.str);
if (wrong_drop_sequence)
diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc
index e83676179b7..9ccbeb4822c 100644
--- a/sql/threadpool_generic.cc
+++ b/sql/threadpool_generic.cc
@@ -1590,6 +1590,9 @@ int TP_pool_generic::init()
sql_print_error("Allocation failed");
DBUG_RETURN(-1);
}
+ PSI_register(mutex);
+ PSI_register(cond);
+ PSI_register(thread);
scheduler_init();
threadpool_started= true;
for (uint i= 0; i < threadpool_max_size; i++)
@@ -1603,10 +1606,6 @@ int TP_pool_generic::init()
sql_print_error("Can't set threadpool size to %d",threadpool_size);
DBUG_RETURN(-1);
}
- PSI_register(mutex);
- PSI_register(cond);
- PSI_register(thread);
-
pool_timer.tick_interval= threadpool_stall_limit;
start_timer(&pool_timer);
DBUG_RETURN(0);
diff --git a/storage/spider/mysql-test/spider/r/basic_sql.result b/storage/spider/mysql-test/spider/r/basic_sql.result
index ba904b5f577..2443f3488bd 100644
--- a/storage/spider/mysql-test/spider/r/basic_sql.result
+++ b/storage/spider/mysql-test/spider/r/basic_sql.result
@@ -721,6 +721,12 @@ connection master_1;
create table t2345678911234567892123456789312345678941234567895123234234(id int) ENGINE=SPIDER
COMMENT='host "192.168.21.1", user "spider", password "password", database "test32738123123123"';
drop table t2345678911234567892123456789312345678941234567895123234234;
+#
+# MDEV-26139 Spider crashes with segmentation fault (signal 11) on CREATE TABLE when COMMENT does not contain embedded double quotes
+#
+create table mdev_26139 (id int) ENGINE=SPIDER
+COMMENT="host '192.168.21.1', user 'spider', password 'password', database 'test'";
+drop table mdev_26139;
deinit
connection master_1;
diff --git a/storage/spider/mysql-test/spider/t/basic_sql.test b/storage/spider/mysql-test/spider/t/basic_sql.test
index 5ba8c27d34e..5f71b0b92a2 100644
--- a/storage/spider/mysql-test/spider/t/basic_sql.test
+++ b/storage/spider/mysql-test/spider/t/basic_sql.test
@@ -2682,6 +2682,13 @@ create table t2345678911234567892123456789312345678941234567895123234234(id int)
COMMENT='host "192.168.21.1", user "spider", password "password", database "test32738123123123"';
drop table t2345678911234567892123456789312345678941234567895123234234;
+--echo #
+--echo # MDEV-26139 Spider crashes with segmentation fault (signal 11) on CREATE TABLE when COMMENT does not contain embedded double quotes
+--echo #
+create table mdev_26139 (id int) ENGINE=SPIDER
+ COMMENT="host '192.168.21.1', user 'spider', password 'password', database 'test'";
+drop table mdev_26139;
+
--echo
--echo deinit
--disable_warnings
diff --git a/storage/spider/spd_table.h b/storage/spider/spd_table.h
index c3f1dc09db5..2b40fb33d5a 100644
--- a/storage/spider/spd_table.h
+++ b/storage/spider/spd_table.h
@@ -189,7 +189,8 @@ typedef struct st_spider_param_string_parse
{
DBUG_RETURN(print_param_error());
}
- else if (!sq || sq > dq)
+
+ if (dq && (!sq || sq > dq))
{
while (1)
{
@@ -227,7 +228,7 @@ typedef struct st_spider_param_string_parse
}
}
}
- else
+ else /* sq && (!dq || sq <= dq) */
{
while (1)
{