[MDEV-20873] date between and multiple order by crash server Created: 2019-10-22  Updated: 2019-11-25  Resolved: 2019-11-25

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.4.8
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: jeantet guillaume Assignee: Elena Stepanova
Resolution: Duplicate Votes: 0
Labels: need_feedback
Environment:

windows


Issue Links:
Duplicate
is duplicated by MDEV-20252 Specific SQL query consistently crash... Closed

 Description   

CREATE TABLE IF NOT EXISTS `planning` (
`idsalarie` INT(10) UNSIGNED NOT NULL,
`nom` VARCHAR(255) NULL DEFAULT NULL,
`absence` TINYINT(4) NULL DEFAULT 0,
`couleur` CHAR(7) NULL DEFAULT NULL,
`date` DATE NULL DEFAULT NULL,
`heuredebut` TIME NULL DEFAULT NULL,
`heurefin` TIME NULL DEFAULT NULL,
`pause` TINYINT(4) NULL DEFAULT 0,
`pausedebut` TIME NULL DEFAULT NULL,
`pausefin` TIME NULL DEFAULT NULL,
INDEX `FK_PLANNING_SALARIE_idx` (`idsalarie` ASC),
INDEX `INDEX_PLANNING_DATE` (`date` ASC),
CONSTRAINT `FK_PLANNING_SALARIE`
FOREIGN KEY (`idsalarie`)
REFERENCES `rhonline`.`salarie` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8

the followwing request crash the server, if the between statement is deleted it works fine as if the multiple order by are deleted. This request works fine on the 10.3.x releases

SELECT
*
FROM
planning
WHERE
idsalarie = 1
AND `date` BETWEEN '2019-10-21' AND '2019-10-27'
ORDER BY
`date`,
heuredebut,
nom

Thread pointer: 0x2b87a889f48
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
mysqld.exe!handler_index_cond_check()[handler.cc:5973]
mysqld.exe!row_search_idx_cond_check()[row0sel.cc:3939]
mysqld.exe!row_search_mvcc()[row0sel.cc:5257]
mysqld.exe!ha_innobase::index_read()[ha_innodb.cc:9308]
mysqld.exe!ha_innobase::rnd_pos()[ha_innodb.cc:9814]
mysqld.exe!handler::ha_rnd_pos()[handler.cc:2858]
mysqld.exe!rr_from_pointers()[records.cc:543]
mysqld.exe!sub_select()[sql_select.cc:20154]
mysqld.exe!do_select()[sql_select.cc:19695]
mysqld.exe!JOIN::exec_inner()[sql_select.cc:4391]
mysqld.exe!JOIN::exec()[sql_select.cc:4174]
mysqld.exe!mysql_select()[sql_select.cc:4607]
mysqld.exe!handle_select()[sql_select.cc:413]
mysqld.exe!execute_sqlcom_select()[sql_parse.cc:6357]
mysqld.exe!mysql_execute_command()[sql_parse.cc:3899]
mysqld.exe!mysql_parse()[sql_parse.cc:7914]
mysqld.exe!dispatch_command()[sql_parse.cc:1845]
mysqld.exe!do_command()[sql_parse.cc:1359]
mysqld.exe!threadpool_process_request()[threadpool_common.cc:366]
mysqld.exe!tp_callback()[threadpool_common.cc:193]



 Comments   
Comment by Elena Stepanova [ 2019-10-22 ]

Thanks for the report. It appears to be the same problem as MDEV-20252. If it indeed is, setting optimizer_switch='rowid_filter=off' should help as a workaround. Could you please try?

Slightly simplified test case:

--source include/have_innodb.inc
 
CREATE TABLE `planning` (
`idsalarie` INT(10) UNSIGNED NOT NULL,
`nom` VARCHAR(255) NULL DEFAULT NULL,
`date` DATE NULL DEFAULT NULL,
INDEX (`idsalarie`),
INDEX (`date`)
) ENGINE = InnoDB CHARACTER SET = utf8;
 
INSERT INTO planning VALUES (1,NULL,NULL), (1,NULL,'2019-10-25'),(1,NULL,NULL);
 
SELECT * FROM planning
WHERE idsalarie = 1 AND `date` BETWEEN '2019-10-21' AND '2019-10-27'
ORDER BY `date`, nom;

Generated at Thu Feb 08 09:02:51 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.