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

MDEV-31247 Assertion `c >= 0' failed in COST_MULT upon query with many joins

Problem was an overflow when calculating number of join cache refills.
This commit is contained in:
Monty
2023-05-27 14:39:17 +03:00
parent 209fed8eed
commit 661141948f
4 changed files with 131 additions and 3 deletions

View File

@ -0,0 +1,38 @@
#
# MDEV-31247 Assertion `c >= 0' failed in COST_MULT upon query with
# many joins
#
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
CREATE TABLE t3 (c INT) ENGINE=MyISAM;
INSERT INTO t3 VALUES (1),(2),(3);
CREATE TABLE t4 (d CHAR(200), e INT, KEY(e)) ENGINE=Aria;
INSERT INTO t4 (e) VALUES (1),(2),(3);
CREATE TABLE t5 (f INT) ENGINE=MyISAM;
INSERT INTO t5 VALUES (1),(2),(3),(4),(5),(6);
create table t1000 engine=memory select seq from seq_1_to_1000;
create table t2000 engine=memory select seq from seq_1_to_2000;
CREATE ALGORITHM=TEMPTABLE VIEW v AS select t1000.seq
from t1000 ml1
join t1000 ml2
join t1000;
set @@max_statement_time=10;
SELECT * FROM information_schema.TABLES
JOIN t1000 ts
JOIN t1000 d1
JOIN t2000 d3
LEFT JOIN (t1 JOIN t2) ON 1
JOIN t1000 d5
JOIN t1000 PROCESSLIST
JOIN t1000 d2
JOIN t1000 event_name
JOIN t3
JOIN t4 ON ts.seq = t4.e
JOIN v ON ts.seq+1 = v.seq
JOIN t5 limit rows examined 1000;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT MAX_INDEX_LENGTH TEMPORARY seq seq seq a b seq seq seq seq c d e seq f
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least ### rows, which exceeds LIMIT ROWS EXAMINED (1000). The query result may be incomplete
DROP VIEW v;
DROP TABLE t1, t2, t3, t4, t5, t1000, t2000;