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

Crash in ALTER TABLE ADD PRIMARY KEY ..., ADD INDEX

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.5.25
    • Fix Version/s: 5.5.27
    • Component/s: None
    • Labels:
      None
    • Environment:
      OpenSuse 11.2 64-bit

      Description

      When attempting to add indexes to a smaller version of table lineitem from DBT3, the ALTER TABLE crashes the server. How to reproduce:

      • Use DBT3 scale 10
      • Run the following statements:

      create table t_ps_partkey as
      (select distinct ps_partkey, ps_suppkey
      from partsupp
      where ps_partkey in (select p_partkey from part where p_name like 'forest%'));

      alter table t_ps_partkey add index i_ps_partkey(ps_partkey, ps_suppkey);

      create table lineitem_small as
      (select distinct lineitem.* from lineitem, t_ps_partkey
      where l_partkey = ps_partkey
      and l_suppkey = ps_suppkey
      and l_shipdate >= date('1994-01-01')
      and l_shipdate < date('1994-01-01') + interval '1' year );

      ALTER TABLE lineitem_small
      ADD PRIMARY KEY (l_orderkey, l_linenumber),
      ADD INDEX i_l_shipdate(l_shipdate),
      ADD INDEX i_l_suppkey_partkey (l_partkey, l_suppkey),
      ADD INDEX i_l_partkey (l_partkey),
      ADD INDEX i_l_suppkey (l_suppkey),
      ADD INDEX i_l_receiptdate (l_receiptdate),
      ADD INDEX i_l_orderkey (l_orderkey),
      ADD INDEX i_l_orderkey_quantity (l_orderkey, l_quantity),
      ADD INDEX i_l_commitdate (l_commitdate);

      The last statement results in a crash:

      InnoDB: DEBUG: update_statistics for dbt3/lineitem_small.
      120809 23:51:18 InnoDB: Assertion failure in thread 140347972777728 in file buf0buf.ic line 515
      InnoDB: Failing assertion: mutex_own(&buf_pool->LRU_list_mutex)
      InnoDB: We intentionally generate a memory trap.
      InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
      InnoDB: If you get repeated assertion failures or crashes, even
      InnoDB: immediately after the mysqld startup, there may be
      InnoDB: corruption in the InnoDB tablespace. Please refer to
      InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
      InnoDB: about forcing recovery.

      The stack trace is:

      #0 0x00007fa5b074ad95 in raise () from /lib64/libc.so.6
      #1 0x00007fa5b074c2ab in abort () from /lib64/libc.so.6
      #2 0x0000000000b365f3 in buf_page_set_sticky (bpage=0x7fa55b773cc0) at /home/tsk/mprog/src/5.5/storage/xtradb/include/buf0buf.ic:515
      #3 0x0000000000b494aa in buf_flush_yield (buf_pool=0x4bedf08, bpage=0x7fa55b773cc0) at /home/tsk/mprog/src/5.5/storage/xtradb/buf/buf0lru.c:399
      #4 0x0000000000b495a9 in buf_flush_try_yield (buf_pool=0x4bedf08, bpage=0x7fa55b773cc0, processed=1024) at /home/tsk/mprog/src/5.5/storage/xtradb/buf/buf0lru.c:445
      #5 0x0000000000b498b9 in buf_flush_or_remove_pages (buf_pool=0x4bedf08, id=30) at /home/tsk/mprog/src/5.5/storage/xtradb/buf/buf0lru.c:569
      #6 0x0000000000b4992c in buf_flush_dirty_pages (buf_pool=0x4bedf08, id=30) at /home/tsk/mprog/src/5.5/storage/xtradb/buf/buf0lru.c:600
      #7 0x0000000000b49e2f in buf_LRU_flush_or_remove_pages (id=30, buf_remove=BUF_REMOVE_FLUSH_NO_WRITE) at /home/tsk/mprog/src/5.5/storage/xtradb/buf/buf0lru.c:789
      #8 0x0000000000b74ada in fil_delete_tablespace (id=30, evict_all=0) at /home/tsk/mprog/src/5.5/storage/xtradb/fil/fil0fil.c:2383
      #9 0x0000000000add415 in row_drop_table_for_mysql (name=0x7fa5200f0098 "dbt3/lineitem_small@00232", trx=0x7fa520063ac8, drop_db=0) at /home/tsk/mprog/src/5.5/storage/xtradb/row/row0mysql.c:3565
      #10 0x0000000000ad73e9 in row_merge_drop_table (trx=0x7fa520063ac8, table=0x7fa5200683d8) at /home/tsk/mprog/src/5.5/storage/xtradb/row/row0merge.c:2634
      #11 0x0000000000ac2c9a in ha_innobase::final_add_index (this=0x7fa5200deee8, add_arg=0x7fa5200da970, commit=true) at /home/tsk/mprog/src/5.5/storage/xtradb/handler/handler0alter.cc:1023
      #12 0x00000000006c51c6 in mysql_alter_table (thd=0x7e38870, new_db=0x7fa520006cb8 "dbt3", new_name=0x7fa5200066a8 "lineitem_small", create_info=0x7fa54f0fdd00, table_list=0x7fa5200066f0, alter_info=0x7fa54f0fde00, order_num=0, order=0x0, ignore=false, require_online=false) at /home/tsk/mprog/src/5.5/sql/sql_table.cc:6946
      #13 0x000000000093f508 in Alter_table_statement::execute (this=0x7fa5200074b8, thd=0x7e38870) at /home/tsk/mprog/src/5.5/sql/sql_alter.cc:106
      #14 0x000000000062f6ee in mysql_execute_command (thd=0x7e38870) at /home/tsk/mprog/src/5.5/sql/sql_parse.cc:4459
      #15 0x000000000063272a in mysql_parse (thd=0x7e38870, rawbuf=0x7fa5200062c8 "ALTER TABLE lineitem_small\n ADD PRIMARY KEY (l_orderkey, l_linenumber),\n ADD INDEX i_l_shipdate(l_shipdate),\n ADD INDEX i_l_suppkey_partkey (l_partkey, l_suppkey),\n ADD INDEX i_l_partkey (l_pa"..., length=435, parser_state=0x7fa54f0fe660) at /home/tsk/mprog/src/5.5/sql/sql_parse.cc:5736

      The crash is in the function: buf_page_set_sticky(), on the line:
      ut_ad(mutex_own(&buf_pool->LRU_list_mutex));

      p buf_pool->LRU_list_mutex
      $5 = {
      event = 0x4bee840,
      lock_word = 0 '\000',
      waiters = 0,
      list =

      { prev = 0x4bee150, next = 0x4bedf08 }

      ,
      cfile_name = 0xe0b8f0 "/home/src/5.5/storage/xtradb/buf/buf0buf.c",
      cline = 1267,
      thread_id = 18446744073709551615,
      magic_n = 979585,
      count_os_wait = 0,
      count_using = 3578904,
      count_spin_loop = 0,
      count_spin_rounds = 0,
      count_os_yield = 0,
      lspent_time = 0,
      lmax_spent_time = 0,
      mutex_type = 0,
      cmutex_name = 0xe0c1ce "&buf_pool->LRU_list_mutex",
      pfs_psi = 0x0
      }

        Attachments

          Activity

            People

            • Assignee:
              wlad Vladislav Vaintroub
              Reporter:
              timour Timour Katchaounov (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: