Meituan-Dianping / Meituan-Dianping/SQLAdvisor
Segmentation fault
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 5.6k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
1.OS version:CentOS release 6.5 (Final) MySQL version:5.7.16-log
2.error
2017-03-10 14:41:26 18622 [Note] 第1步: 对SQL解析优化之后得到的SQL:select count(1) AS `COUNT(1)` from (`mydb`.`archive` `a` left join `mydb`.`archive_detail` `ad` on((`a`.`id` = `ad`.`archive_id`))) where (`a`.`user_id` = 231)
2017-03-10 14:41:26 18622 [Note] 第2步:开始解析where中的条件:(`a`.`user_id` = 231)
2017-03-10 14:41:26 18622 [Note] show index from archive
2017-03-10 14:41:26 18622 [Note] show table status like 'archive'
2017-03-10 14:41:26 18622 [Note] select count(*) from ( select `user_id` from `archive` FORCE INDEX( PRIMARY ) order by id DESC limit 4) `a` where (`a`.`user_id` = 231)
2017-03-10 14:41:26 18622 [Note] 第3步:表archive的行数:9,limit行数:4,得到where条件中(`a`.`user_id` = 231)的选择度:4
2017-03-10 14:41:26 18622 [Note] 第4步:开始解析join on条件:a.id=ad.archive_id
2017-03-10 14:41:26 18622 [Note] 第5步:开始选择驱动表,一共有1个候选驱动表
2017-03-10 14:41:26 18622 [Note] explain select * from archive
Segmentation fault
3.table ddl
CREATE TABLE `archive` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`signed_summary_id` bigint(20) DEFAULT NULL,
`user_id` bigint(20) DEFAULT NULL,
`tilte` varchar(200) DEFAULT NULL,
`archive_type` int(11) DEFAULT NULL,
`archive_date` date DEFAULT NULL,
`created1` bigint(20) DEFAULT NULL,
`created2` varchar(50) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=270 DEFAULT CHARSET=utf8mb4;
CREATE TABLE `archive_detail` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`archive_id` bigint(20) DEFAULT NULL,
`archive_type` int(11) DEFAULT NULL,
`archive_type_name` varchar(20) DEFAULT NULL,
`content` varchar(2000) DEFAULT NULL,
`pic` varchar(200) DEFAULT NULL,
`voice` varchar(2000) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`service_remark` int(5) DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=420 DEFAULT CHARSET=utf8mb4;
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the crash using the reported MySQL 5.7.16 environment, the archive and archive_detail DDL, and the logged SQL. Start with the optimizer path reached after the join-condition analysis and the logged `explain select * from archive`; done means identifying and fixing the segmentation fault and confirming the query no longer crashes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, mysql
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100