| Bug #71184 | Wrong result (missing row) on select with index_merge from a partitioned table | ||
|---|---|---|---|
| Submitted: | 19 Dec 2013 21:23 | Modified: | 20 Dec 2013 11:57 |
| Reporter: | Elena Stepanova | Email Updates: | |
| Status: | Can't repeat | Impact on me: | |
| Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
| Version: | 5.6, 5.7 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[19 Dec 2013 21:23]
Elena Stepanova
[19 Dec 2013 22:20]
MySQL Verification Team
Thank you for the bug report. I couldn't repeat with source server:
mysql> INSERT INTO `t1` VALUES (22000018,'ZB',25000,'4m','2008-06-06','2050-12-3
1',60,460);
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> SELECT DISTINCT maintab.BArt FROM t1 AS maintab
-> WHERE maintab.HubLst = 16000
-> AND maintab.TrbwGr = '4m'
-> AND maintab.BArt IN ('D', 'DA', 'DA4', 'DB', 'DQA', 'Z', 'ZA', 'ZB');
Empty set (0.05 sec)
mysql> show variables like "%version%";
+-------------------------+------------------------------+
| Variable_name | Value |
+-------------------------+------------------------------+
| innodb_version | 5.6.15 |
| protocol_version | 10 |
| slave_type_conversions | |
| version | 5.6.15 |
| version_comment | MySQL Community Server (GPL) |
| version_compile_machine | x86_64 |
| version_compile_os | Win64 |
+-------------------------+------------------------------+
7 rows in set (0.01 sec)
mysql 5.6 > INSERT INTO `t1` VALUES (22000018,'ZB',25000,'4m','2008-06-06','2050-12-31',60,460);
Query OK, 1 row affected (0.00 sec)
mysql 5.6 >
mysql 5.6 > SELECT DISTINCT maintab.BArt FROM t1 AS maintab
-> WHERE maintab.HubLst = 16000
-> AND maintab.TrbwGr = '4m'
-> AND maintab.BArt IN ('D', 'DA', 'DA4', 'DB', 'DQA', 'Z', 'ZA', 'ZB');
+------+
| BArt |
+------+
| Z |
+------+
1 row in set (0.05 sec)
mysql 5.6 > show variables like "%version%";
+-------------------------+---------------------+
| Variable_name | Value |
+-------------------------+---------------------+
| innodb_version | 5.6.16 |
| protocol_version | 10 |
| slave_type_conversions | |
| version | 5.6.16-log |
| version_comment | Source distribution |
| version_compile_machine | x86_64 |
| version_compile_os | Win64 |
+-------------------------+---------------------+
7 rows in set (0.00 sec)
[20 Dec 2013 6:13]
MySQL Verification Team
i wonder if it was fixed by http://bugs.mysql.com/bug.php?id=71095 ?
[20 Dec 2013 11:57]
Elena Stepanova
Thank you, Shane. Probably it was, I won't even bother trying, if the verification team is still serious about switching a report into 'Can't repeat' (thus making it totally useless as a public record for further search and reference, btw), without as much as checking what caused the change in behavior, whether it's a fix or a luck, while they can reproduce the bug easily on the last released version.
[18 Mar 2015 20:19]
Benjamin Lin
I actually hit the bug and can reproduce it, please kindly raise the severity of the bug since it result data missing from the result.
test query
mysql> SELECT action,id,data_timestamp
-> FROM mytable
-> where action = 'process_combine'
-> and data_timestamp = '2015-03-18 01:00:00'
-> limit 1;
+-----------------+----------+---------------------+
| action | id | data_timestamp |
+-----------------+----------+---------------------+
| process_combine | 17672161 | 2015-03-18 01:00:00 |
+-----------------+----------+---------------------+
1 row in set (0.00 sec)
# enable index_merge
mysql> set session optimizer_switch="index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on";
Query OK, 0 rows affected (0.00 sec)
# run the same query return 0 row
mysql> SELECT action,id,data_timestamp FROM mytable where action = 'process_combine' and data_timestamp = '2015-03-18 01:00:00' limit 1;
Empty set (0.42 sec)
# query explain indicates index_merge has been used
mysql> explain SELECT action,id,data_timestamp FROM mytable where action = 'process_combine' and data_timestamp = '2015-03-18 01:00:00' limit 1;
+----+-------------+--------+-------------+-----------------------+-----------------------+---------+------+------+------------------------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+--------+-------------+-----------------------+-----------------------+---------+------+------+------------------------------------------------------------------+
| 1 | SIMPLE | mytable | index_merge | data_timestamp,action | data_timestamp,action | 6,48 | NULL | 1 | Using intersect(data_timestamp,action); Using where; Using index |
+----+-------------+--------+-------------+-----------------------+-----------------------+---------+------+------+------------------------------------------------------------------+
# disable index_merge
mysql> set session optimizer_switch="index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off";
Query OK, 0 rows affected (0.00 sec)
# run same query return data again
mysql> SELECT action,id,data_timestamp FROM mytable where action = 'process_combine' and data_timestamp = '2015-03-18 01:00:00' limit 1;
+-----------------+----------+---------------------+
| action | id | data_timestamp |
+-----------------+----------+---------------------+
| process_combine | 17672161 | 2015-03-18 01:00:00 |
+-----------------+----------+---------------------+
mysql> explain SELECT action,id,data_timestamp FROM mytable where action = 'process_combine' and data_timestamp = '2015-03-18 01:00:00' limit 1;
+----+-------------+--------+------+-----------------------+----------------+---------+-------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+--------+------+-----------------------+----------------+---------+-------+------+-------------+
| 1 | SIMPLE | mytable | ref | data_timestamp,action | data_timestamp | 6 | const | 23 | Using where |
+----+-------------+--------+------+-----------------------+----------------+---------+-------+------+-------------+
# table schema, it has been modified a little bit w/o exposing our internal knowledge
CREATE TABLE `mytable` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`timestamp` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`process_time` int(11) DEFAULT NULL,
`data_timestamp` datetime DEFAULT NULL,
`action` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`,`timestamp`),
KEY `timestamp` (`timestamp`),
KEY `data_timestamp` (`data_timestamp`),
KEY `action` (`action`),
) ENGINE=InnoDB AUTO_INCREMENT=18161656 DEFAULT CHARSET=latin1
/*!50500 PARTITION BY RANGE COLUMNS(`timeStamp`)
( PARTITION part20150317150000 VALUES LESS THAN ('2015-03-17 15:00:00') ENGINE = InnoDB,
PARTITION part20150317180000 VALUES LESS THAN ('2015-03-17 18:00:00') ENGINE = InnoDB,
PARTITION part20150317210000 VALUES LESS THAN ('2015-03-17 21:00:00') ENGINE = InnoDB,
PARTITION part20150318000000 VALUES LESS THAN ('2015-03-18 00:00:00') ENGINE = InnoDB,
PARTITION part20150318030000 VALUES LESS THAN ('2015-03-18 03:00:00') ENGINE = InnoDB,
PARTITION part20150318060000 VALUES LESS THAN ('2015-03-18 06:00:00') ENGINE = InnoDB,
PARTITION part20150318090000 VALUES LESS THAN ('2015-03-18 09:00:00') ENGINE = InnoDB,
PARTITION part20150318120000 VALUES LESS THAN ('2015-03-18 12:00:00') ENGINE = InnoDB,
PARTITION part20150318150000 VALUES LESS THAN ('2015-03-18 15:00:00') ENGINE = InnoDB,
PARTITION part20150318180000 VALUES LESS THAN ('2015-03-18 18:00:00') ENGINE = InnoDB,
PARTITION part20150318210000 VALUES LESS THAN ('2015-03-18 21:00:00') ENGINE = InnoDB,
PARTITION part20150319000000 VALUES LESS THAN ('2015-03-19 00:00:00') ENGINE = InnoDB,
PARTITION part20150319030000 VALUES LESS THAN ('2015-03-19 03:00:00') ENGINE = InnoDB,
PARTITION part20150319060000 VALUES LESS THAN ('2015-03-19 06:00:00') ENGINE = InnoDB,
PARTITION part20150319090000 VALUES LESS THAN ('2015-03-19 09:00:00') ENGINE = InnoDB,
PARTITION part20150319120000 VALUES LESS THAN ('2015-03-19 12:00:00') ENGINE = InnoDB,
PARTITION part20150319150000 VALUES LESS THAN ('2015-03-19 15:00:00') ENGINE = InnoDB,
PARTITION part20150319180000 VALUES LESS THAN ('2015-03-19 18:00:00') ENGINE = InnoDB,
PARTITION part20150319210000 VALUES LESS THAN ('2015-03-19 21:00:00') ENGINE = InnoDB,
PARTITION future VALUES LESS THAN (MAXVALUE) ENGINE = InnoDB)
[2 Jul 2015 17:08]
Sveta Smirnova
Benjamin, I cannot repeat this with current version 5.6.25. If you still can create full test case and open separate bug.
