1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-15656 Assertion `is_last_prefix <= 0' failed in QUICK_GROUP_MIN_MAX_SELECT::get_next

When QUICK_GROUP_MIN_MAX_SELECT is initialized or being reset
it stores the prefix of the last group of the index chosen for
retrieving data (last_value). Later, when looping through records
at get_next() method, the server checks whether the retrieved
group is the last, and if so, it finishes processing.

At the same time, it looks like there is no need for that additional
check since method next_prefix() returns HA_ERR_KEY_NOT_FOUND
or HA_ERR_END_OF_FILE when there are no more satisfying records.
If we do not perform the check, we do not need to retrieve and
store last_value either.

This commit removes using of last_value from QUICK_GROUP_MIN_MAX_SELECT.

Reviewer: Sergei Petrunia <sergey@mariadb.com>
This commit is contained in:
Oleg Smirnov
2023-11-10 20:03:06 +07:00
parent d5fc34db4c
commit a8bd6a9813
6 changed files with 202 additions and 38 deletions

View File

@ -273,6 +273,53 @@ eval $query;
DROP TABLES t1, t2;
--echo #
--echo # MDEV-15656: Assertion `is_last_prefix <= 0' failed in
--echo # QUICK_GROUP_MIN_MAX_SELECT::get_next
--echo #
SET @lru_depth.save= @@innodb_lru_scan_depth;
SET GLOBAL innodb_lru_scan_depth= 1024;
CREATE TABLE t1 (
pk_part1 INT AUTO_INCREMENT,
a VARCHAR(4),
row_start timestamp(6) default current_timestamp,
PRIMARY KEY (pk_part1, row_start)
) ENGINE=InnoDB;
INSERT INTO t1 (a) VALUES
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo');
--connect (con1,localhost,root,,test)
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
--let $run= 20
--disable_result_log
while ($run)
{
--send
SELECT DISTINCT pk_part1 FROM t1;
--connection default
INSERT INTO t1 (pk_part1) VALUES (NULL);
--connection con1
--reap
--dec $run
}
--enable_result_log
--disconnect con1
--connection default
DROP TABLE t1;
SET GLOBAL innodb_lru_scan_depth= @lru_depth.save;
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=
@innodb_stats_persistent_sample_pages_save;