mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-6808: MariaDB 10.0.13 crash with optimizer_use_condition_selectivity > 1
Fix a trivial typo: in table_multi_eq_cond_selectivity(), reset the loop variable between loops.
This commit is contained in:
@@ -1358,4 +1358,39 @@ set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivit
|
||||
DROP TABLE t1,t2;
|
||||
set use_stat_tables=@save_use_stat_tables;
|
||||
set optimizer_switch=@save_optimizer_switch_for_selectivity_test;
|
||||
#
|
||||
# MDEV-6808: MariaDB 10.0.13 crash with optimizer_use_condition_selectivity > 1
|
||||
#
|
||||
set @tmp_mdev6808= @@optimizer_use_condition_selectivity;
|
||||
SET optimizer_use_condition_selectivity = 2;
|
||||
CREATE TABLE t1 (
|
||||
event_id int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (event_id)
|
||||
) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (
|
||||
repost_id int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
subject_type varchar(24) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
|
||||
subject_id int(11) unsigned NOT NULL,
|
||||
object_type varchar(24) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
|
||||
object_id int(11) unsigned NOT NULL,
|
||||
is_private int(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (repost_id),
|
||||
UNIQUE KEY `BETWEEN` (subject_type,subject_id,object_type,object_id,is_private),
|
||||
KEY SUBJECT (subject_type,subject_id),
|
||||
KEY OBJECT (object_type,object_id)
|
||||
) ENGINE=InnoDB;
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
t2, t1
|
||||
WHERE
|
||||
t2.object_type = 'event' AND
|
||||
t2.object_id = t1.event_id AND
|
||||
t2.is_private = 0 AND
|
||||
t2.subject_id = 127994 AND
|
||||
t2.subject_type in ('user')
|
||||
;
|
||||
repost_id subject_type subject_id object_type object_id is_private event_id
|
||||
DROP TABLE t1, t2;
|
||||
set optimizer_use_condition_selectivity=@tmp_mdev6808;
|
||||
SET SESSION STORAGE_ENGINE=DEFAULT;
|
||||
|
@@ -9,4 +9,41 @@ set optimizer_switch='extended_keys=on';
|
||||
|
||||
set optimizer_switch=@save_optimizer_switch_for_selectivity_test;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-6808: MariaDB 10.0.13 crash with optimizer_use_condition_selectivity > 1
|
||||
--echo #
|
||||
set @tmp_mdev6808= @@optimizer_use_condition_selectivity;
|
||||
SET optimizer_use_condition_selectivity = 2;
|
||||
CREATE TABLE t1 (
|
||||
event_id int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (event_id)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE t2 (
|
||||
repost_id int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
subject_type varchar(24) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
|
||||
subject_id int(11) unsigned NOT NULL,
|
||||
object_type varchar(24) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
|
||||
object_id int(11) unsigned NOT NULL,
|
||||
is_private int(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (repost_id),
|
||||
UNIQUE KEY `BETWEEN` (subject_type,subject_id,object_type,object_id,is_private),
|
||||
KEY SUBJECT (subject_type,subject_id),
|
||||
KEY OBJECT (object_type,object_id)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
t2, t1
|
||||
WHERE
|
||||
t2.object_type = 'event' AND
|
||||
t2.object_id = t1.event_id AND
|
||||
t2.is_private = 0 AND
|
||||
t2.subject_id = 127994 AND
|
||||
t2.subject_type in ('user')
|
||||
;
|
||||
DROP TABLE t1, t2;
|
||||
set optimizer_use_condition_selectivity=@tmp_mdev6808;
|
||||
|
||||
SET SESSION STORAGE_ENGINE=DEFAULT;
|
||||
|
@@ -7199,7 +7199,7 @@ double table_multi_eq_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s,
|
||||
uint i;
|
||||
KEYUSE *keyuse= pos->key;
|
||||
uint key= keyuse->key;
|
||||
|
||||
// psergey-todo: why does the following loop not include 'i' ???
|
||||
for (i= 0; i < keyparts; i++)
|
||||
{
|
||||
uint fldno;
|
||||
@@ -7372,6 +7372,7 @@ double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s,
|
||||
already taken into account in table->cond_selectivity.
|
||||
*/
|
||||
keyuse= pos->key;
|
||||
keyparts=0;
|
||||
while (keyuse->table == table && keyuse->key == key)
|
||||
{
|
||||
if (!(keyuse->used_tables & (rem_tables | table->map)))
|
||||
|
Reference in New Issue
Block a user