[MDEV-4790] Order by with loose index scan input results in a failed assert during the join cleanup phase Created: 2013-07-16  Updated: 2013-07-16  Resolved: 2013-07-16

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0.3, 5.5.31
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Timour Katchaounov (Inactive) Assignee: Timour Katchaounov (Inactive)
Resolution: Duplicate Votes: 0
Labels: None


 Description   

The following test case (based on Bug #32268: Indexed queries give bogus MIN and MAX results, from group_min_max.test) leads to a crash during the cleanup phase:

CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3);
INSERT INTO t1 SELECT a + 1, b FROM t1;
INSERT INTO t1 SELECT a + 2, b FROM t1;

CREATE INDEX break_it ON t1 (a, b);

SELECT distinct a, b FROM t1 where a = '3' ORDER BY b;



 Comments   
Comment by Timour Katchaounov (Inactive) [ 2013-07-16 ]

The crash is due to the following failed assert:

int ha_index_end()
{
DBUG_ENTER("ha_index_end");
DBUG_ASSERT(inited==INDEX);
...
}

Call stack:

#3 0x00007f1ae1927192 in _GI_assert_fail (assertion=0xd478de "inited==INDEX", file=0xd47890 "/home/tsk/mprog/src/5.5/sql/handler.h", line=1861, function=0xd4a570 <handler::ha_index_end()::PRETTY_FUNCTION_> "int handler::ha_index_end()") at assert.c:103
#4 0x00000000005a9f32 in handler::ha_index_end (this=0x7f1a7400c4f8) at /home/tsk/mprog/src/5.5/sql/handler.h:1861
#5 0x00000000008ecd4b in QUICK_GROUP_MIN_MAX_SELECT::~QUICK_GROUP_MIN_MAX_SELECT (this=0x7f1a74016cd0, __in_chrg=<optimized out>) at /home/tsk/mprog/src/5.5/sql/opt_range.cc:13181
#6 0x00000000008ece2e in QUICK_GROUP_MIN_MAX_SELECT::~QUICK_GROUP_MIN_MAX_SELECT (this=0x7f1a74016cd0, __in_chrg=<optimized out>) at /home/tsk/mprog/src/5.5/sql/opt_range.cc:13190
#7 0x00000000008d280d in SQL_SELECT::cleanup (this=0x7f1a74013420) at /home/tsk/mprog/src/5.5/sql/opt_range.cc:1745
#8 0x0000000000672543 in JOIN::clean_pre_sort_join_tab (this=0x7f1a74007110) at /home/tsk/mprog/src/5.5/sql/sql_select.cc:19395
#9 0x000000000065d446 in JOIN::cleanup (this=0x7f1a74007110, full=true) at /home/tsk/mprog/src/5.5/sql/sql_select.cc:10635
#10 0x000000000065d10c in JOIN::join_free (this=0x7f1a74007110) at /home/tsk/mprog/src/5.5/sql/sql_select.cc:10547

Comment by Timour Katchaounov (Inactive) [ 2013-07-16 ]

This is a test case for MySQL's bug:

Bug#16394084: LOOSE INDEX SCAN WITH QUOTED INT PREDICATE RETURNS RANDOM DATA,
http://bazaar.launchpad.net/~mysql/mysql-server/5.5/revision/jorgen.loland@oracle.com-20130320102012-ahrillh9h5h4fs49

which has no test case.

Comment by Patryk Pomykalski [ 2013-07-16 ]

I think it was a fix for the following bug: http://bugs.mysql.com/bug.php?id=68473 Can you look at my comment?
https://mariadb.atlassian.net/browse/MDEV-4219?focusedCommentId=30382&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-30382

Comment by Timour Katchaounov (Inactive) [ 2013-07-16 ]

Patryk,

Thanks, indeed, these two bug reports are duplicates. I will mark them as such.
Your comment seems to be very reasonable, I will check your hypothesis first.

Comment by Timour Katchaounov (Inactive) [ 2013-07-16 ]

Patryk,

Thanks, indeed, these two bug reports are duplicates. I will mark them as such.
Your comment seems to be very reasonable, I will check your hypothesis first.

Comment by Timour Katchaounov (Inactive) [ 2013-07-16 ]

Duplicate of MDEV-4219.

Generated at Thu Feb 08 06:59:10 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.