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

Assertion `((keypart_map+1) & keypart_map) == 0' failed in _mi_pack_key with an index on a POINT column

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.0.0, 5.5.28a, 5.3.11
    • Fix Version/s: 10.0.2, 5.5.29
    • Component/s: None
    • Labels:

      Description

      The test case is created from MySQL bug http://bugs.mysql.com/67889. The initial bug report is about a wrong result, but it's not reproducible on MariaDB: debug versions abort with the assertion failure (as well as MySQL debug builds), while release builds of MariaDB produce the expected result (unlike MySQL release builds).

      mysqld: mi_key.c:232: _mi_pack_key: Assertion `((keypart_map+1) & keypart_map) == 0' failed.
      mysqld got signal 6 ;

      #6  0x00007f86ce097d4d in __GI___assert_fail (assertion=0xe07518 "((keypart_map+1) & keypart_map) == 0", file=<optimized out>, line=232, function=<optimized out>) at assert.c:81
      #7  0x000000000097d4bc in _mi_pack_key (info=0x39f79e0, keynr=1, key=0x39f8656 "\031", old=0x7f86c5397cd8 "\031", keypart_map=140216811221696, last_used_keyseg=0x0) at mi_key.c:232
      #8  0x000000000098f798 in _mi_record_pos (info=0x39f79e0, key=0x7f86c5397cd8 "\031", keypart_map=140216811221696, search_flag=HA_READ_MBR_CONTAIN) at mi_range.c:135
      #9  0x000000000098f549 in mi_records_in_range (info=0x39f79e0, inx=1, min_key=0x7f86c5397200, max_key=0x0) at mi_range.c:100
      #10 0x0000000000955f0d in ha_myisam::records_in_range (this=0x39f6a08, inx=1, min_key=0x7f86c5397200, max_key=0x0) at ha_myisam.cc:2206
      #11 0x0000000000935c53 in handler::multi_range_read_info_const (this=0x39f6a08, keyno=1, seq=0x7f86c53978b0, seq_init_param=0x7f86c5397390, n_ranges_arg=0, bufsz=0x7f86c53972ec, flags=0x7f86c53972e8, cost=0x7f86c5397970) at multi_range_read.cc:78
      #12 0x0000000000939013 in DsMrr_impl::dsmrr_info_const (this=0x39f6e38, keyno=1, seq=0x7f86c53978b0, seq_init_param=0x7f86c5397390, n_ranges=0, bufsz=0x7f86c5397a08, flags=0x7f86c5397a04, cost=0x7f86c5397970) at multi_range_read.cc:1434
      #13 0x0000000000956273 in ha_myisam::multi_range_read_info_const (this=0x39f6a08, keyno=1, seq=0x7f86c53978b0, seq_init_param=0x7f86c5397390, n_ranges=0, bufsz=0x7f86c5397a08, flags=0x7f86c5397a04, cost=0x7f86c5397970) at ha_myisam.cc:2319
      #14 0x000000000081df47 in check_quick_select (param=0x7f86c5397b80, idx=0, index_only=false, tree=0x3a16a38, update_tbl_stats=true, mrr_flags=0x7f86c5397a04, bufsize=0x7f86c5397a08, cost=0x7f86c5397970) at opt_range.cc:9902
      #15 0x000000000081649c in get_key_scans_params (param=0x7f86c5397b80, tree=0x39fc0c8, index_read_must_be_used=false, update_tbl_stats=true, read_time=4.51953125) at opt_range.cc:6617
      #16 0x000000000080efdf in SQL_SELECT::test_quick_select (this=0x39f1678, thd=0x3980690, keys_to_use=..., prev_tables=0, limit=18446744073709551615, force_quick_range=false, ordered_output=false) at opt_range.cc:3128
      #17 0x0000000000747019 in get_quick_record_count (thd=0x3980690, select=0x39f1678, table=0x39f45a0, keys=0x39fb218, limit=18446744073709551615) at sql_select.cc:3032
      #18 0x0000000000748da3 in make_join_statistics (join=0x39fab08, tables_list=..., conds=0x39fa768, keyuse_array=0x39fae08) at sql_select.cc:3576
      #19 0x0000000000740201 in JOIN::optimize (this=0x39fab08) at sql_select.cc:1153
      #20 0x0000000000746cf5 in mysql_select (thd=0x3980690, rref_pointer_array=0x39833f8, tables=0x3a15e88, wild_num=0, fields=..., conds=0x39fa768, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147764736, result=0x39faab8, unit=0x3982c28, select_lex=0x3983150) at sql_select.cc:2969
      #21 0x000000000073d7a3 in handle_select (thd=0x3980690, lex=0x3982b88, result=0x39faab8, setup_tables_done_option=0) at sql_select.cc:286
      #22 0x00000000006c8c3b in execute_sqlcom_select (thd=0x3980690, all_tables=0x3a15e88) at sql_parse.cc:5157
      #23 0x00000000006bf9fa in mysql_execute_command (thd=0x3980690) at sql_parse.cc:2290
      #24 0x00000000006cb693 in mysql_parse (thd=0x3980690, rawbuf=0x3a17fb8 "SELECT id\nFROM point_test\nWHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)'))", length=101, found_semicolon=0x7f86c539b7e0) at sql_parse.cc:6158
      #25 0x00000000006bd1a0 in dispatch_command (command=COM_QUERY, thd=0x3980690, packet=0x39c9c71 "SELECT id\nFROM point_test\nWHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)'))\n", packet_length=102) at sql_parse.cc:1228
      #26 0x00000000006bc4b4 in do_command (thd=0x3980690) at sql_parse.cc:923
      #27 0x00000000006b8f0d in handle_one_connection (arg=0x3980690) at sql_connect.cc:1218
      #28 0x00007f86ceba6efc in start_thread (arg=0x7f86c539c700) at pthread_create.c:304

      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x3a17fb8): SELECT id FROM point_test WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)'))
      Connection ID (thread ID): 2
      Status: NOT_KILLED

      branch: maria/5.3
      bzr version-info
      revision-id: sanja@montyprogram.com-20121205190600-fzhla1o8ecu3hf20
      date: 2012-12-05 21:06:00 +0200
      revno: 3606

      Also reproducible on maria/5.5 and maria/10.0.
      Reproducible with the default optimizer_switch as well as with all OFF values.
      Reproducible with Aria too.

      CREATE TABLE point_test (
            id INT UNSIGNED NOT NULL AUTO_INCREMENT
          , point_data POINT NOT NULL
          , PRIMARY KEY (id)
          , KEY idx_point_data(point_data)
      ) ENGINE=MyISAM;
      INSERT INTO point_test (point_data)
      VALUES
            (GeomFromText('Point(37.0248492 23.8512726)'))
          , (GeomFromText('Point(38.0248492 23.8512726)'))
      ;
      SELECT id
      FROM point_test
      WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)'))
      ;

        Attachments

          Activity

            People

            • Assignee:
              serg Sergei Golubchik
              Reporter:
              elenst Elena Stepanova
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: