[Commits] f3dd96ad25e: MDEV-23937: SIGSEGV in looped best_extension_by_limited_search from greedy_search

Sergei Petrunia psergey at askmonty.org
Thu May 20 18:26:24 EEST 2021


revision-id: f3dd96ad25efe23081981f52a54a57b17a5a890e (mariadb-10.2.31-961-gf3dd96ad25e)
parent(s): 4625830b6794184a57c2702436e810be941a51c0
author: Sergei Petrunia
committer: Sergei Petrunia
timestamp: 2021-05-20 18:26:24 +0300
message:

MDEV-23937: SIGSEGV in looped best_extension_by_limited_search from greedy_search

Add a testcase (fixed by fix for MDEV-17783)

---
 mysql-test/r/selectivity_no_engine.result | 20 ++++++++++++++++++++
 mysql-test/t/selectivity_no_engine.test   | 21 +++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/mysql-test/r/selectivity_no_engine.result b/mysql-test/r/selectivity_no_engine.result
index 7fc3c6e9909..74a52c9fed8 100644
--- a/mysql-test/r/selectivity_no_engine.result
+++ b/mysql-test/r/selectivity_no_engine.result
@@ -293,6 +293,26 @@ SELECT * FROM t1 WHERE t1.d = 0 AND t1.p = '1' AND t1.i != '-1' AND t1.n = 'some
 i	n	d	p
 set optimizer_use_condition_selectivity= @tmp_mdev8779;
 DROP TABLE t1;
+#
+# MDEV-23937: SIGSEGV in looped best_extension_by_limited_search from greedy_search
+# (Testcase only)
+#
+set
+ at tmp_jcl= @@join_cache_level,
+ at tmp_ucs= @@optimizer_use_condition_selectivity;
+set
+join_cache_level=3,
+optimizer_use_condition_selectivity=2;
+CREATE TABLE t1 AS SELECT * FROM mysql.user;
+CREATE TABLE t3 (b VARCHAR (1));
+CREATE TABLE t2 (c2 INT);
+INSERT INTO t2 VALUES (1);
+EXPLAIN
+SELECT * FROM t1 AS a NATURAL JOIN t1 AS b;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	a	ALL	NULL	NULL	NULL	NULL	4	
+1	SIMPLE	b	hash_ALL	NULL	#hash#$hj	827	test.a.Host,test.a.User,test.a.Password,test.a.Select_priv,test.a.Insert_priv,test.a.Update_priv,test.a.Delete_priv,test.a.Create_priv,test.a.Drop_priv,test.a.Reload_priv,test.a.Shutdown_priv,test.a.Process_priv,test.a.File_priv,test.a.Grant_priv,test.a.References_priv,test.a.Index_priv,test.a.Alter_priv,test.a.Show_db_priv,test.a.Super_priv,test.a.Create_tmp_table_priv,test.a.Lock_tables_priv,test.a.Execute_priv,test.a.Repl_slave_priv,test.a.Repl_client_priv,test.a.Create_view_priv,test.a.Show_view_priv,test.a.Create_routine_priv,test.a.Alter_routine_priv,test.a.Create_user_priv,test.a.Event_priv,test.a.Trigger_priv,test.a.Create_tablespace_priv,test.a.ssl_type,test.a.ssl_cipher,test.a.x509_issuer,test.a.x509_subject,test.a.max_questions,test.a.max_updates,test.a.max_connections,test.a.max_user_connections,test.a.plugin,test.a.authentication_string,test.a.password_expired,test.a.is_role,test.a.default_role,test.a.max_statement_time	4	Using whe
 re; Using join buffer (flat, BNLH join)
+DROP TABLE t1,t2,t3;
 # 
 # End of the test file
 # 
diff --git a/mysql-test/t/selectivity_no_engine.test b/mysql-test/t/selectivity_no_engine.test
index 345b7bd1e8a..b5f52dd167d 100644
--- a/mysql-test/t/selectivity_no_engine.test
+++ b/mysql-test/t/selectivity_no_engine.test
@@ -228,6 +228,27 @@ SELECT * FROM t1 WHERE t1.d = 0 AND t1.p = '1' AND t1.i != '-1' AND t1.n = 'some
 set optimizer_use_condition_selectivity= @tmp_mdev8779;
 DROP TABLE t1;
 
+--echo #
+--echo # MDEV-23937: SIGSEGV in looped best_extension_by_limited_search from greedy_search
+--echo # (Testcase only)
+--echo #
+set
+  @tmp_jcl= @@join_cache_level,
+  @tmp_ucs= @@optimizer_use_condition_selectivity;
+set
+  join_cache_level=3,
+  optimizer_use_condition_selectivity=2;
+
+CREATE TABLE t1 AS SELECT * FROM mysql.user;
+CREATE TABLE t3 (b VARCHAR (1));
+CREATE TABLE t2 (c2 INT);
+INSERT INTO t2 VALUES (1);
+
+EXPLAIN
+SELECT * FROM t1 AS a NATURAL JOIN t1 AS b;
+
+DROP TABLE t1,t2,t3;
+
 --echo # 
 --echo # End of the test file
 --echo # 


More information about the commits mailing list