Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
5ddfcb05
Commit
5ddfcb05
authored
Feb 17, 2017
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-9455: [ERROR] mysqld got signal 11
Switch MEM_ROOT to non-prune_partitions() during optimizing subselect.
parent
1b7aae90
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
191 additions
and
2 deletions
+191
-2
mysql-test/r/partition_innodb.result
mysql-test/r/partition_innodb.result
+89
-0
mysql-test/t/partition_innodb.test
mysql-test/t/partition_innodb.test
+93
-0
sql/opt_range.cc
sql/opt_range.cc
+9
-2
No files found.
mysql-test/r/partition_innodb.result
View file @
5ddfcb05
...
...
@@ -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;
mysql-test/t/partition_innodb.test
View file @
5ddfcb05
...
...
@@ -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
;
sql/opt_range.cc
View file @
5ddfcb05
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment