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

LIMIT ROWS EXAMINED: Assertion `0' failed in net_end_statement(THD*) on the 2nd PS execution, with DISTINCT, FROM subquery or view in SELECT, JOIN in nested subquery

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.5.21
    • Component/s: None
    • Labels:
      None

      Description

      mysqld: protocol.cc:509: void net_end_statement(THD*): Assertion `0' failed.
      
      #6  0x00007f8116add235 in __assert_fail () from /lib64/libc.so.6
      #7  0x00000000006d5e99 in net_end_statement (thd=0x1c73ae8) at protocol.cc:509
      #8  0x00000000006f4b90 in dispatch_command (command=COM_QUERY, thd=0x1c73ae8, packet=0x1caaff9 "EXECUTE ps", 
          packet_length=10) at sql_parse.cc:1620
      #9  0x00000000006f2b38 in do_command (thd=0x1c73ae8) at sql_parse.cc:923
      #10 0x00000000006efa16 in handle_one_connection (arg=0x1c73ae8) at sql_connect.cc:1193
      #11 0x00007f8117798a4f in start_thread () from /lib64/libpthread.so.0
      #12 0x00007f8116b8282d in clone () from /lib64/libc.so.6
      

      bzr version-info

      revision-id: timour@askmonty.org-20120309222351-jlq0uf1narp45gep
      date: 2012-03-10 00:23:51 +0200
      build-date: 2012-03-11 07:38:33 +0200
      revno: 3456
      

      Minimal optimizer_switch:

      in_to_exists=on
      

      Full optimizer_switch (default):

      index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
      

      EXPLAIN for the SELECT:

      id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
      1       PRIMARY <derived2>      ALL     NULL    NULL    NULL    NULL    2       100.00
      2       DERIVED t1      ALL     NULL    NULL    NULL    NULL    2       100.00  Using where; Using temporary
      3       SUBQUERY        t1      ALL     NULL    NULL    NULL    NULL    2       100.00
      3       SUBQUERY        t2      ALL     NULL    NULL    NULL    NULL    3       100.00  Using where; Using join buffer (flat, BNL join)
      Warnings:
      Note    1003    select `v`.`a` AS `a` from `test`.`v`
      

      Test case:

      SET optimizer_switch = 'in_to_exists=on';
      
      CREATE TABLE t1 ( a INT );
      INSERT INTO t1 VALUES (2),(150);
      CREATE TABLE t2 ( b INT );
      INSERT INTO t2 VALUES (2),(17),(6);
      
      CREATE VIEW v AS
      SELECT DISTINCT * FROM t1
      WHERE a = ( SELECT COUNT(*) FROM t1, t2 WHERE a = b );
      
      PREPARE ps FROM
      'SELECT * FROM v LIMIT ROWS EXAMINED 10';
      
      EXECUTE ps;
      EXECUTE ps;
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              timour Timour Katchaounov added a comment -

              The same problem as mdev-174. The fix is to generalize the solution of mdev-174, so that it tests that limit rows is enabled for the outermost select, and not just test that there is no unit->item.

              Show
              timour Timour Katchaounov added a comment - The same problem as mdev-174. The fix is to generalize the solution of mdev-174, so that it tests that limit rows is enabled for the outermost select, and not just test that there is no unit->item.

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - 0 minutes
                    0m
                    Logged:
                    Time Spent - 1 hour
                    1h