Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-4790

Order by with loose index scan input results in a failed assert during the join cleanup phase

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 10.0.3, 5.5.31
    • Fix Version/s: None
    • Component/s: None
    • 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;

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            timour Timour Katchaounov added a comment -

            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

            Show
            timour Timour Katchaounov added a comment - 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
            Hide
            timour Timour Katchaounov added a comment -

            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.

            Show
            timour Timour Katchaounov added a comment - 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.
            Show
            pomyk Patryk Pomykalski added a comment - 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
            Hide
            timour Timour Katchaounov added a comment -

            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.

            Show
            timour Timour Katchaounov added a comment - 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.
            Hide
            timour Timour Katchaounov added a comment -

            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.

            Show
            timour Timour Katchaounov added a comment - 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.
            Hide
            timour Timour Katchaounov added a comment -

            Duplicate of MDEV-4219.

            Show
            timour Timour Katchaounov added a comment - Duplicate of MDEV-4219 .

              People

              • Assignee:
                timour Timour Katchaounov
                Reporter:
                timour Timour Katchaounov
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: