Commit 5ddfcb05 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-9455: [ERROR] mysqld got signal 11

Switch MEM_ROOT to non-prune_partitions() during optimizing subselect.
parent 1b7aae90
......@@ -718,3 +718,92 @@ d
1991-01-01
DROP TABLE t1;
set global default_storage_engine=default;
#
# MDEV-9455: [ERROR] mysqld got signal 11
#
CREATE TABLE `t1` (
`DIARY_TOTAL_DAY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`IMORY_ID` bigint(20) NOT NULL,
`NAME` varchar(75) DEFAULT NULL,
`DATETIME` varchar(10) NOT NULL DEFAULT '',
`DAILY_CALL_CNT` int(11) DEFAULT NULL,
`DAILY_SMS_CNT` int(11) DEFAULT NULL,
`NUMBER` varchar(64) DEFAULT NULL,
`DURATION` varchar(16) DEFAULT NULL,
PRIMARY KEY (`DIARY_TOTAL_DAY_SEQ`,`DATETIME`),
KEY `IDX_t1_01` (`IMORY_ID`,`DATETIME`)
) AUTO_INCREMENT=328702514 DEFAULT CHARSET=utf8mb4
PARTITION BY RANGE COLUMNS(`DATETIME`)
(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB,
PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB,
PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB,
PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB,
PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB,
PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB,
PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB,
PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB)
;
CREATE TABLE `t2` (
`DIARY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`IMORY_ID` bigint(20) NOT NULL,
`CALL_TYPE` varchar(1) DEFAULT NULL,
`DATA_TYPE` varchar(1) DEFAULT NULL,
`FEATURES` varchar(1) DEFAULT NULL,
`NAME` varchar(75) DEFAULT NULL,
`NUMBER` varchar(64) DEFAULT NULL,
`DATETIME` datetime NOT NULL,
`REG_DATE` datetime NOT NULL,
`TITLE` varchar(50) DEFAULT NULL,
`BODY` varchar(4200) DEFAULT NULL,
`MIME_TYPE` varchar(32) DEFAULT NULL,
`DURATION` varchar(16) DEFAULT NULL,
`DEVICE_ID` varchar(64) DEFAULT NULL,
`DEVICE_NAME` varchar(32) DEFAULT NULL,
PRIMARY KEY (`DIARY_SEQ`,`DATETIME`,`REG_DATE`),
KEY `IDX_TB_DIARY_01` (`IMORY_ID`,`DATETIME`,`CALL_TYPE`,`NUMBER`),
KEY `IDX_TB_DIARY_02` (`REG_DATE`)
) AUTO_INCREMENT=688799006 DEFAULT CHARSET=utf8mb4
PARTITION BY RANGE COLUMNS(REG_DATE)
(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB,
PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB,
PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB,
PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB,
PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB,
PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB,
PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB,
PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB)
;
SELECT
A.IMORY_ID,
A.NUMBER,
A.NAME,
DATE_FORMAT(A.DATETIME, '%Y-%m-%d') AS TARGET_DATE,
SUM( CASE WHEN A.DATA_TYPE='1' THEN 1 ELSE 0 END) AS CALL_CNT,
SUM( CASE WHEN A.DATA_TYPE IN ('2', '3') THEN 1 ELSE 0 END) AS SMS_CNT,
SUM(CAST(A.DURATION AS INT)) AS DURATION,
( SELECT COUNT(*)
FROM t1
WHERE IMORY_ID=A.IMORY_ID
AND NUMBER=A.NUMBER
AND NAME=A.NAME
AND DATETIME = DATE_FORMAT(A.DATETIME, '%Y-%m-%d')
) STATS_COUNT
FROM t2 A
WHERE A.IMORY_ID = 55094102
AND A.DATETIME LIKE (
SELECT CONCAT (DATE_FORMAT(DATETIME, '%Y-%m-%d') ,'%')
FROM t2
WHERE IMORY_ID=55094102
AND DIARY_SEQ IN ( 608351221, 608351225, 608351229 )
group by DATE_FORMAT(DATETIME, '%Y-%m-%d')
)
GROUP BY A.IMORY_ID, A.NUMBER, A.NAME, DATE_FORMAT(A.DATETIME, '%Y-%m-%d')
;
IMORY_ID NUMBER NAME TARGET_DATE CALL_CNT SMS_CNT DURATION STATS_COUNT
drop table t2, t1;
......@@ -808,3 +808,96 @@ SELECT * FROM t1 WHERE d = '1991-01-01';
DROP TABLE t1;
set global default_storage_engine=default;
--echo #
--echo # MDEV-9455: [ERROR] mysqld got signal 11
--echo #
CREATE TABLE `t1` (
`DIARY_TOTAL_DAY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`IMORY_ID` bigint(20) NOT NULL,
`NAME` varchar(75) DEFAULT NULL,
`DATETIME` varchar(10) NOT NULL DEFAULT '',
`DAILY_CALL_CNT` int(11) DEFAULT NULL,
`DAILY_SMS_CNT` int(11) DEFAULT NULL,
`NUMBER` varchar(64) DEFAULT NULL,
`DURATION` varchar(16) DEFAULT NULL,
PRIMARY KEY (`DIARY_TOTAL_DAY_SEQ`,`DATETIME`),
KEY `IDX_t1_01` (`IMORY_ID`,`DATETIME`)
) AUTO_INCREMENT=328702514 DEFAULT CHARSET=utf8mb4
PARTITION BY RANGE COLUMNS(`DATETIME`)
(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB,
PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB,
PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB,
PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB,
PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB,
PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB,
PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB,
PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB)
;
CREATE TABLE `t2` (
`DIARY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`IMORY_ID` bigint(20) NOT NULL,
`CALL_TYPE` varchar(1) DEFAULT NULL,
`DATA_TYPE` varchar(1) DEFAULT NULL,
`FEATURES` varchar(1) DEFAULT NULL,
`NAME` varchar(75) DEFAULT NULL,
`NUMBER` varchar(64) DEFAULT NULL,
`DATETIME` datetime NOT NULL,
`REG_DATE` datetime NOT NULL,
`TITLE` varchar(50) DEFAULT NULL,
`BODY` varchar(4200) DEFAULT NULL,
`MIME_TYPE` varchar(32) DEFAULT NULL,
`DURATION` varchar(16) DEFAULT NULL,
`DEVICE_ID` varchar(64) DEFAULT NULL,
`DEVICE_NAME` varchar(32) DEFAULT NULL,
PRIMARY KEY (`DIARY_SEQ`,`DATETIME`,`REG_DATE`),
KEY `IDX_TB_DIARY_01` (`IMORY_ID`,`DATETIME`,`CALL_TYPE`,`NUMBER`),
KEY `IDX_TB_DIARY_02` (`REG_DATE`)
) AUTO_INCREMENT=688799006 DEFAULT CHARSET=utf8mb4
PARTITION BY RANGE COLUMNS(REG_DATE)
(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB,
PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB,
PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB,
PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB,
PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB,
PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB,
PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB,
PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB)
;
SELECT
A.IMORY_ID,
A.NUMBER,
A.NAME,
DATE_FORMAT(A.DATETIME, '%Y-%m-%d') AS TARGET_DATE,
SUM( CASE WHEN A.DATA_TYPE='1' THEN 1 ELSE 0 END) AS CALL_CNT,
SUM( CASE WHEN A.DATA_TYPE IN ('2', '3') THEN 1 ELSE 0 END) AS SMS_CNT,
SUM(CAST(A.DURATION AS INT)) AS DURATION,
( SELECT COUNT(*)
FROM t1
WHERE IMORY_ID=A.IMORY_ID
AND NUMBER=A.NUMBER
AND NAME=A.NAME
AND DATETIME = DATE_FORMAT(A.DATETIME, '%Y-%m-%d')
) STATS_COUNT
FROM t2 A
WHERE A.IMORY_ID = 55094102
AND A.DATETIME LIKE (
SELECT CONCAT (DATE_FORMAT(DATETIME, '%Y-%m-%d') ,'%')
FROM t2
WHERE IMORY_ID=55094102
AND DIARY_SEQ IN ( 608351221, 608351225, 608351229 )
group by DATE_FORMAT(DATETIME, '%Y-%m-%d')
)
GROUP BY A.IMORY_ID, A.NUMBER, A.NAME, DATE_FORMAT(A.DATETIME, '%Y-%m-%d')
;
drop table t2, t1;
......@@ -7500,8 +7500,15 @@ static SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param,COND *cond)
if (cond_func->functype() == Item_func::BETWEEN ||
cond_func->functype() == Item_func::IN_FUNC)
inv= ((Item_func_opt_neg *) cond_func)->negated;
else if (cond_func->select_optimize() == Item_func::OPTIMIZE_NONE)
DBUG_RETURN(0);
else
{
MEM_ROOT *tmp_root= param->mem_root;
param->thd->mem_root= param->old_root;
Item_func::optimize_type opt_res= cond_func->select_optimize();
param->thd->mem_root= tmp_root;
if (opt_res == Item_func::OPTIMIZE_NONE)
DBUG_RETURN(0);
}
param->cond= cond;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment