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

ER_CRASHED_ON_USAGE or assertion failure after myisampack on table with vector key

Details

    Description

      Test case 1, myisampack/chk run only on the main .MYI

      --source include/have_sequence.inc
       
      create table t (pk int primary key, v vector(1) not null, vector(v)) engine=MyISAM;
      insert into t select seq, 0x00000000 from seq_1_to_1000;
       
      select pk from t order by vec_distance_euclidean(v,0x00000000) limit 1;
      flush tables;
       
      --let $datadir= `select @@datadir`
      --echo # Running myisampack
      --exec $MYISAMPACK $datadir/test/t.MYI
      --echo # Running myisamchk
      --exec $MYISAMCHK -rq $datadir/test/t.MYI
      select pk from t order by vec_distance_euclidean(v,0x00000000) limit 1;
       
      # Cleanup
      drop table t;
      

      bb-11.6-MDEV-32887-vector a919a7de0ef3d7a11a7a529eb9043e51c577b6d6

      # Running myisampack
      Remember to run myisamchk -rq on compressed tables
      # Running myisamchk
      - check record delete-chain
      - recovering (with sort) MyISAM-table '/mnt8t/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/mysql-test/var/mysqld.1/data//test/t.MYI'
      Data records: 1000
      - Fixing index 1
      select pk from t order by vec_distance_euclidean(v,0x00000000) limit 1;
      bug.t                                    [ fail ]
              Test ended at 2024-10-18 01:05:54
       
      CURRENT_TEST: bug.t
      mysqltest: At line 14: query 'select pk from t order by vec_distance_euclidean(v,0x00000000) limit 1' failed: ER_CRASHED_ON_USAGE (1194): Table 't' is marked as crashed and should be repaired
      

      Test case 2, myisampack/chk on both .MYI files

      --source include/have_sequence.inc
       
      create table t (pk int primary key, v vector(1) not null, vector(v)) engine=MyISAM;
      insert into t select seq, 0x00000000 from seq_1_to_1000;
       
      select pk from t order by vec_distance_euclidean(v,0x00000000) limit 1;
      flush tables;
       
      --let $datadir= `select @@datadir`
      --echo # Running myisampack
      --exec $MYISAMPACK $datadir/test/t*.MYI
      --echo # Running myisamchk
      --exec $MYISAMCHK -rq $datadir/test/t*.MYI
      select pk from t order by vec_distance_euclidean(v,0x00000000) limit 1;
       
      # Cleanup
      drop table t;
      

      # Running myisampack
      Remember to run myisamchk -rq on compressed tables
      # Running myisamchk
      - check record delete-chain
      - recovering (with sort) MyISAM-table '/mnt8t/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/mysql-test/var/mysqld.1/data//test/t#i#01.MYI'
      Data records: 1000
      - Fixing index 1
      - Fixing index 2
       
      ---------
       
      - check record delete-chain
      - recovering (with sort) MyISAM-table '/mnt8t/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/mysql-test/var/mysqld.1/data//test/t.MYI'
      Data records: 1000
      - Fixing index 1
      select pk from t order by vec_distance_euclidean(v,0x00000000) limit 1;
      bug.t                                    [ fail ]
              Test ended at 2024-10-18 01:08:38
       
      CURRENT_TEST: bug.t
      mysqltest: At line 14: query 'select pk from t order by vec_distance_euclidean(v,0x00000000) limit 1' failed: <Unknown> (2013): Lost connection to server during query
      

      mariadbd: /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/handler.cc:7609: int handler::ha_external_lock(THD*, int): Assertion `inited == NONE || table->open_by_handler' failed.
      241018  1:08:36 [ERROR] mysqld got signal 6 ;
       
      #9  0x00007fbaebc53e32 in __GI___assert_fail (assertion=0x56334c06eb00 "inited == NONE || table->open_by_handler", file=0x56334c064120 "/data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/handler.cc", line=7609, function=0x56334c06e960 "int handler::ha_external_lock(THD*, int)") at ./assert/assert.c:101
      #10 0x000056334a13c8af in handler::ha_external_lock (this=0x61d00016f8b8, thd=0x62c0000c0218, lock_type=2) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/handler.cc:7609
      #11 0x00005633494555ce in handler::ha_external_unlock (this=0x61d00016f8b8, thd=0x62c0000c0218) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/handler.h:3599
      #12 0x00005633495eb688 in TABLE::reset_hlindexes (this=0x61900009a698) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_base.cc:9909
      #13 0x000056334a13d94b in handler::ha_reset (this=0x61d0001cd4b8) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/handler.cc:7706
      #14 0x00005633495b6476 in close_thread_table (thd=0x62c0000c0218, table_ptr=0x62c0000c0310) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_base.cc:1044
      #15 0x00005633495b58da in close_thread_tables (thd=0x62c0000c0218) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_base.cc:982
      #16 0x00005633495b49b5 in close_thread_tables_for_query (thd=0x62c0000c0218) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_base.cc:798
      #17 0x000056334978ebfe in mysql_execute_command (thd=0x62c0000c0218, is_called_from_prepared_stmt=false) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_parse.cc:5936
      #18 0x000056334979b576 in mysql_parse (thd=0x62c0000c0218, rawbuf=0x6290000e6238 "select pk from t order by vec_distance_euclidean(v,0x00000000) limit 1", length=70, parser_state=0x7fbae06c29f0) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_parse.cc:7873
      #19 0x0000563349772598 in dispatch_command (command=COM_QUERY, thd=0x62c0000c0218, packet=0x629000253219 "", packet_length=70, blocking=true) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_parse.cc:1892
      #20 0x000056334976f2ac in do_command (thd=0x62c0000c0218, blocking=true) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_parse.cc:1405
      #21 0x0000563349c5e755 in do_handle_one_connection (connect=0x6080000034b8, put_in_cache=true) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_connect.cc:1448
      #22 0x0000563349c5e116 in handle_one_connection (arg=0x608000003438) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/sql/sql_connect.cc:1350
      #23 0x000056334a903c8a in pfs_spawn_thread (arg=0x617000005b98) at /data/bld/preview-11.7-bb-11.6-MDEV-32887-vector-asan/storage/perfschema/pfs.cc:2198
      #24 0x00007fbaebca8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #25 0x00007fbaebd2861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Attachments

        Issue Links

          Activity

            I don't see how it can be prevented, myisampack modifes MYI/MYD files directly without checking the frm and without the server knowing anything about it.

            It'd be useful, though, to have a command to rebuild the vector index only (I'm not sure it's possible now).
            Then one could myisampack tables, rebuild vector indexes, then myisampack them too. And end up having all packed, but usable.

            serg Sergei Golubchik added a comment - I don't see how it can be prevented, myisampack modifes MYI/MYD files directly without checking the frm and without the server knowing anything about it. It'd be useful, though, to have a command to rebuild the vector index only (I'm not sure it's possible now). Then one could myisampack tables, rebuild vector indexes, then myisampack them too. And end up having all packed, but usable.

            I suppose MyISAM can store a flag in the MYI file, basically, saying "myisampack is not permitted"

            serg Sergei Golubchik added a comment - I suppose MyISAM can store a flag in the MYI file, basically, saying "myisampack is not permitted"

            People

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

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.