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

myisampack creates corrupted table when compressing table with same values

    XMLWordPrintable

Details

    Description

      The following MTR script

      CREATE TABLE t1 AS WITH RECURSIVE cte AS (SELECT 1 AS n UNION ALL SELECT n + 1 FROM cte WHERE n < 256)
      SELECT 42 FROM cte;
       
      let $MYSQLD_DATADIR = `select @@datadir`;
      --exec $MYISAMPACK --join=$MYSQLD_DATADIR/test/t2 $MYSQLD_DATADIR/test/t1 2>&1
      SELECT COUNT(*) FROM t2;
      

      leads to:

      Program terminated with signal SIGABRT, Aborted.
      Thread 1 (Thread 0x74e7c601f6c0 (LWP 222944)):
      #0  __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=0) at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (threadid=<optimized out>, signo=6) at ./nptl/pthread_kill.c:89
      #2  __GI___pthread_kill (threadid=<optimized out>, signo=6) at ./nptl/pthread_kill.c:100
      #3  0x00005a197a315f71 in my_write_core (sig=6) at /src/mariadb2/mysys/stacktrace.c:424
      #4  0x00005a1979924d4e in handle_fatal_signal (sig=6) at /src/mariadb2/sql/signal_handler.cc:298
      #5  <signal handler called>
      #6  __pthread_kill_implementation (threadid=<optimized out>, signo=6, no_tid=0) at ./nptl/pthread_kill.c:44
      #7  __pthread_kill_internal (threadid=<optimized out>, signo=6) at ./nptl/pthread_kill.c:89
      #8  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:100
      #9  0x000074e7d12456de in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
      #10 0x000074e7d12288cd in __GI_abort () at ./stdlib/abort.c:73
      #11 0x000074e7d1228830 in __assert_fail_base (fmt=<optimized out>, assertion=<optimized out>, file=<optimized out>, line=<optimized out>, function=<optimized out>) at ./assert/assert.c:118
      #12 0x00005a197a30f63a in my_realloc (key=109, old_point=0x74e7b41c73d8, size=0, my_flags=0) at /src/mariadb2/mysys/my_malloc.c:147
      #13 0x00005a197a2ac077 in _mi_read_pack_info (info=0x74e7c601bf20, fix_keys=1 '\001') at /src/mariadb2/storage/myisam/mi_packrec.c:263
      #14 0x00005a197a2a6400 in mi_open (name=0x74e7b41c2b20 "./test/t2", mode=2, open_flags=82) at /src/mariadb2/storage/myisam/mi_open.c:533
      #15 0x00005a197a275557 in ha_myisam::open (this=0x74e7b41c49b8, name=0x74e7b41c2b20 "./test/t2", mode=2, test_if_locked=18) at /src/mariadb2/storage/myisam/ha_myisam.cc:813
      #16 0x00005a1979930ce2 in handler::ha_open (this=0x74e7b41c49b8, table_arg=0x74e7b41c44e8, name=0x74e7b41c2b20 "./test/t2", mode=2, test_if_locked=18, mem_root=0x0, partitions_to_open=0x0) at /src/mariadb2/sql/handler.cc:3633
      #17 0x00005a19796612c9 in open_table_from_share (thd=0x74e7b4000dc8, share=0x74e7b41c2480, alias=0x74e7b40189b0, db_stat=33, prgflag=8, ha_open_flags=18, outparam=0x74e7b41c44e8, is_create_table=false, partitions_to_open=0x0) at /src/mariadb2/sql/table.cc:4669
      #18 0x00005a19793df463 in open_table (thd=0x74e7b4000dc8, table_list=0x74e7b4018968, ot_ctx=0x74e7c601d420) at /src/mariadb2/sql/sql_base.cc:2262
      #19 0x00005a19793e3dcf in open_and_process_table (thd=0x74e7b4000dc8, tables=0x74e7b4018968, counter=0x74e7c601d4b4, flags=0, prelocking_strategy=0x74e7c601d538, has_prelocking_list=false, ot_ctx=0x74e7c601d420) at /src/mariadb2/sql/sql_base.cc:4200
      #20 0x00005a19793e513f in open_tables (thd=0x74e7b4000dc8, options=..., start=0x74e7c601d498, counter=0x74e7c601d4b4, flags=0, prelocking_strategy=0x74e7c601d538) at /src/mariadb2/sql/sql_base.cc:4686
      #21 0x00005a19793e716c in open_and_lock_tables (thd=0x74e7b4000dc8, options=..., tables=0x74e7b4018968, derived=true, flags=0, prelocking_strategy=0x74e7c601d538) at /src/mariadb2/sql/sql_base.cc:5658
      #22 0x00005a19793f783b in open_and_lock_tables (thd=0x74e7b4000dc8, tables=0x74e7b4018968, derived=true, flags=0) at /src/mariadb2/sql/sql_base.h:535
      #23 0x00005a19794be92a in execute_sqlcom_select (thd=0x74e7b4000dc8, all_tables=0x74e7b4018968) at /src/mariadb2/sql/sql_parse.cc:6087
      #24 0x00005a19794b66f2 in mysql_execute_command (thd=0x74e7b4000dc8, is_called_from_prepared_stmt=false) at /src/mariadb2/sql/sql_parse.cc:3954
      #25 0x00005a19794c415c in mysql_parse (thd=0x74e7b4000dc8, rawbuf=0x74e7b40181f0 "SELECT COUNT(*) FROM t2", length=23, parser_state=0x74e7c601e2c0) at /src/mariadb2/sql/sql_parse.cc:7891
      #26 0x00005a19794af967 in dispatch_command (command=COM_QUERY, thd=0x74e7b4000dc8, packet=0x74e7b400c149 "SELECT COUNT(*) FROM t2", packet_length=23, blocking=true) at /src/mariadb2/sql/sql_parse.cc:1877
      #27 0x00005a19794ae24c in do_command (thd=0x74e7b4000dc8, blocking=true) at /src/mariadb2/sql/sql_parse.cc:1416
      #28 0x00005a19796c9a6a in do_handle_one_connection (connect=0x5a1982e91f58, put_in_cache=true) at /src/mariadb2/sql/sql_connect.cc:1414
      #29 0x00005a19796c97df in handle_one_connection (arg=0x5a1982e6cf18) at /src/mariadb2/sql/sql_connect.cc:1326
      #30 0x00005a1979caa44e in pfs_spawn_thread (arg=0x5a1982df7e08) at /src/mariadb2/storage/perfschema/pfs.cc:2198
      #31 0x000074e7d12a2ef1 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:448
      #32 0x000074e7d133445c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
       
      mariadbd: /src/mariadb2/mysys/my_malloc.c:147: my_realloc: Assertion `size > 0' failed.
      250628 14:38:31 [ERROR] /src/mariadb2/sql/mariadbd got signal 6 ;
      

      Changing 42 to n results in:

      SELECT COUNT(*) FROM t2;
      COUNT(*)
      256
      

      Attachments

        Activity

          People

            serg Sergei Golubchik
            qobood Vasilii Lakhin
            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.