Uploaded image for project: 'Percona Server for MySQL'
  1. Percona Server for MySQL
  2. PS-5080

inserting or deleting into/from TokuDB table with tokudb_auto_analyze and tokudb_analyze_delete_fraction set could lead to a server crash

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: High
    • Resolution: Won't Fix
    • Affects Version/s: 5.6.41-84.1
    • Fix Version/s: None
    • Component/s: TokuDB
    • Labels:
      None

      Description

      sql:

      # mysqld options required for replay: --plugin-load=tokudb=ha_tokudb.so
      USE test;
      CREATE TABLE t1(a INT UNSIGNED,b INT UNSIGNED NOT NULL,c CHAR(1),d CHAR (1),e VARCHAR(1) NOT NULL,f BINARY (1),g BLOB NOT NULL,h BLOB NOT NULL,id INT NOT NULL,KEY(b),CLUSTERING KEY(e)) ENGINE=tokudb;
      insert into t1(id,a)values (228,2);
      update t1 set b=b+1 where 1<=a and a<=3;
      SET SESSION tokudb_analyze_delete_fraction=0;
      SET SESSION tokudb_auto_analyze=13;
      SELECT SUBSTRING(0,2);
      insert into t1(id,a)values (419,86);
      

      gdb:

      +bt
      #0  0x00007ffb3ce47a01 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
      #1  0x0000000000ad1d4e in my_write_core (sig=6) at /home/hrvoje/worktable/PS-5.6.42-84.2_dbg/mysys/stacktrace.c:424
      #2  0x000000000073f59d in handle_fatal_signal (sig=6) at /home/hrvoje/worktable/PS-5.6.42-84.2_dbg/sql/signal_handler.cc:236
      #3  <signal handler called>
      #4  0x00007ffb3af4b277 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
      #5  0x00007ffb3af4c968 in __GI_abort () at abort.c:90
      #6  0x00007ffb3af44096 in __assert_fail_base (fmt=0x7ffb3b09f580 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0xed1b00 "field_types == 0 || field_types[field_pos] == MYSQL_TYPE_DECIMAL || field_types[field_pos] == MYSQL_TYPE_BIT || field_types[field_pos] == MYSQL_TYPE_NEWDECIMAL || field_types[field_pos] == MYSQL_TYPE_NEWDATE || (field_types[field_pos] >= MYSQL_TYPE_ENUM && field_types[field_pos] <= MYSQL_TYPE_GEOMETRY)", file=file@entry=0xed1770 "/home/hrvoje/worktable/PS-5.6.42-84.2_dbg/sql/protocol.cc", line=line@entry=993, function=function@entry=0xed2260 <Protocol_text::store(char const*, unsigned long, charset_info_st const*)::__PRETTY_FUNCTION__> "virtual bool Protocol_text::store(const char*, size_t, const CHARSET_INFO*)") at assert.c:92
      #7  0x00007ffb3af44142 in __GI___assert_fail (assertion=0xed1b00 "field_types == 0 || field_types[field_pos] == MYSQL_TYPE_DECIMAL || field_types[field_pos] == MYSQL_TYPE_BIT || field_types[field_pos] == MYSQL_TYPE_NEWDECIMAL || field_types[field_pos] == MYSQL_TYPE_NEWDATE || (field_types[field_pos] >= MYSQL_TYPE_ENUM && field_types[field_pos] <= MYSQL_TYPE_GEOMETRY)", file=0xed1770 "/home/hrvoje/worktable/PS-5.6.42-84.2_dbg/sql/protocol.cc", line=993, function=0xed2260 <Protocol_text::store(char const*, unsigned long, charset_info_st const*)::__PRETTY_FUNCTION__> "virtual bool Protocol_text::store(const char*, size_t, const CHARSET_INFO*)") at assert.c:101
      #8  0x0000000000737a60 in Protocol_text::store (this=0x7ffb11fb5500, from=0x7ffb3d436aa0 "test.t1.b", length=9, fromcs=0x17b6780 <my_charset_utf8_general_ci>) at /home/hrvoje/worktable/PS-5.6.42-84.2_dbg/sql/protocol.cc:987
      #9  0x00007ffb1b82d12c in tokudb::analyze::standard_t::on_run (this=0x7ffaa420e400) at /home/hrvoje/worktable/PS-5.6.42-84.2_dbg/storage/tokudb/ha_tokudb_admin.cc:445
      #10 0x00007ffb1b84fd6b in tokudb::background::job_manager_t::job_t::run (this=0x7ffaa420e400) at /home/hrvoje/worktable/PS-5.6.42-84.2_dbg/storage/tokudb/tokudb_background.h:188
      #11 0x00007ffb1b84f662 in tokudb::background::job_manager_t::run (this=0x7ffb39037080, job=0x7ffaa420e400) at /home/hrvoje/worktable/PS-5.6.42-84.2_dbg/storage/tokudb/tokudb_background.cc:210
      #12 0x00007ffb1b84f1b1 in tokudb::background::job_manager_t::run_job (this=0x7ffb39037080, newjob=0x7ffaa420e400, background=false) at /home/hrvoje/worktable/PS-5.6.42-84.2_dbg/storage/tokudb/tokudb_background.cc:125
      #13 0x00007ffb1b82e753 in TOKUDB_SHARE::analyze_standard (this=0x7ffaa40ae000, thd=0x7ffb11fb5000, txn=0x0) at /home/hrvoje/worktable/PS-5.6.42-84.2_dbg/storage/tokudb/ha_tokudb_admin.cc:851
      #14 0x00007ffb1b812b70 in TOKUDB_SHARE::update_row_count (this=0x7ffaa40ae000, thd=0x7ffb11fb5000, added=1, deleted=0, updated=0) at /home/hrvoje/worktable/PS-5.6.42-84.2_dbg/storage/tokudb/ha_tokudb.cc:363
      #15 0x00007ffb1b825444 in ha_tokudb::external_lock (this=0x7ffaa4024010, thd=0x7ffb11fb5000, lock_type=2) at /home/hrvoje/worktable/PS-5.6.42-84.2_dbg/storage/tokudb/ha_tokudb.cc:6519
      #16 0x000000000065be0f in handler::ha_external_lock (this=0x7ffaa4024010, thd=0x7ffb11fb5000, lock_type=2) at /home/hrvoje/worktable/PS-5.6.42-84.2_dbg/sql/handler.cc:7838
      #17 0x000000000096b5da in unlock_external (thd=0x7ffb11fb5000, table=0x7ffaa401aab8, count=1) at /home/hrvoje/worktable/PS-5.6.42-84.2_dbg/sql/lock.cc:648
      #18 0x000000000096ac24 in mysql_unlock_tables (thd=0x7ffb11fb5000, sql_lock=0x7ffaa401aa90) at /home/hrvoje/worktable/PS-5.6.42-84.2_dbg/sql/lock.cc:391
      #19 0x000000000077e371 in close_thread_tables (thd=0x7ffb11fb5000) at /home/hrvoje/worktable/PS-5.6.42-84.2_dbg/sql/sql_base.cc:1452
      #20 0x00000000007fbfd5 in mysql_execute_command (thd=0x7ffb11fb5000) at /home/hrvoje/worktable/PS-5.6.42-84.2_dbg/sql/sql_parse.cc:5686
      #21 0x00000000007ff1ec in mysql_parse (thd=0x7ffb11fb5000, rawbuf=0x7ffaa401f010 "insert into t1(id,a)values (419,86)", length=35, parser_state=0x7ffb3d438470, update_userstat=false) at /home/hrvoje/worktable/PS-5.6.42-84.2_dbg/sql/sql_parse.cc:7056
      #22 0x00000000007f0f04 in dispatch_command (command=COM_QUERY, thd=0x7ffb11fb5000, packet=0x7ffb04be7001 "insert into t1(id,a)values (419,86)", packet_length=35) at /home/hrvoje/worktable/PS-5.6.42-84.2_dbg/sql/sql_parse.cc:1524
      #23 0x00000000007efcd1 in do_command (thd=0x7ffb11fb5000) at /home/hrvoje/worktable/PS-5.6.42-84.2_dbg/sql/sql_parse.cc:1093
      #24 0x00000000007b6ff0 in do_handle_one_connection (thd_arg=0x7ffb11f52000) at /home/hrvoje/worktable/PS-5.6.42-84.2_dbg/sql/sql_connect.cc:1590
      #25 0x00000000007b6cf7 in handle_one_connection (arg=0x7ffb11f52000) at /home/hrvoje/worktable/PS-5.6.42-84.2_dbg/sql/sql_connect.cc:1494
      #26 0x0000000000b15149 in pfs_spawn_thread (arg=0x7ffb11f41de0) at /home/hrvoje/worktable/PS-5.6.42-84.2_dbg/storage/perfschema/pfs.cc:1861
      #27 0x00007ffb3ce42e25 in start_thread (arg=0x7ffb3d439700) at pthread_create.c:308
      #28 0x00007ffb3b013bad in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113
      

      Reproduced on debug builds for 5.6.42-84.2. On release builds for 5.6.41-84.1 and 5.6.42-84.2 this query causes server to hang.

      Few more test cases:

      USE test;
      SET DEFAULT_STORAGE_ENGINE='tokudb';
      CREATE TABLE t1(gesuchnr int,benutzer_id int,KEY (gesuchnr,benutzer_id));
      INSERT INTO t1 VALUES(1,1);
      SET SESSION tokudb_analyze_delete_fraction=0;
      SET SESSION tokudb_auto_analyze=1;
      show binlog events;
      DELETE FROM t1;#ERROR: 2006 - MySQL server has gone away;
      
      # mysqld options required for replay: --plugin-load=tokudb=ha_tokudb.so
      USE test;
      SET SESSION tokudb_analyze_delete_fraction=0;
      SET SESSION tokudb_auto_analyze=10;
      CREATE TEMPORARY TABLE t1(c1 INT,INDEX(c1)) ENGINE=TokuDB;
      SELECT 1 NIST_SHA256_test_vector;
      insert into t1 values(1);
      DELETE FROM t1;
      

        Smart Checklist

          Attachments

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              hrvoje.matijakovic Hrvoje Matijakovic
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - Not Specified
                  Not Specified
                  Logged:
                  Time Spent - 40 minutes
                  40m