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

Galera: Replica nodes crash with signal 6 after indexed virtual columns and FK cascading deletes: WSREP has not yet prepared node for application use

    XMLWordPrintable

Details

    Description

      It was discovered trying to reproduce MDEV-19601. Two (replica nodes) of three galera nodes crash.

      MariaDB Version 10.4.11-MariaDB-debug: Repository: MariaDB/server; branch 10.4; Revision ae72205e31e7665238c1757ede352d9ca53d5327.

      Galera lib 26.4.3(r4548): Repository: MariaDB/galera; branch mariadb-4.x; Revision a5431753a3f6bdd348adcbca00e3450ba0ef9045.

      Client output:

      Server version: 10.4.11-MariaDB-debug-log Source distribution
       
      Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
       
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
       
      MariaDB [(none)]> use test;
      Database changed
      MariaDB [test]> CREATE TABLE testMain (primid INT UNSIGNED NOT NULL AUTO_INCREMENT, PRIMARY KEY (primid)) ENGINE = InnoDB;
      Query OK, 0 rows affected (0.047 sec)
       
      MariaDB [test]> CREATE TABLE testRef (id INT UNSIGNED NOT NULL AUTO_INCREMENT, pid INT UNSIGNED, bitmap TINYINT UNSIGNED NOT NULL DEFAULT 0, bitmap5 TINYINT UNSIGNED GENERATED ALWAYS AS (bitmap&(1<<5)) VIRTUAL, PRIMARY KEY (id), FOREIGN KEY (pid) REFERENCES testMain (primid) ON DELETE CASCADE ON UPDATE CASCADE);
      Query OK, 0 rows affected (0.034 sec)
       
      MariaDB [test]> CREATE INDEX bitmap5 ON testRef(bitmap5) USING BTREE;
      Query OK, 0 rows affected (0.073 sec)
      Records: 0  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> INSERT INTO testMain VALUES(0);
      Query OK, 1 row affected (0.016 sec)
       
      MariaDB [test]> SELECT * FROM testMain;
      +--------+
      | primid |
      +--------+
      |      1 |
      +--------+
      1 row in set (0.001 sec)
       
      MariaDB [test]>  INSERT INTO testRef(pid) VALUES(1);
      Query OK, 1 row affected (0.007 sec)
       
      MariaDB [test]> DELETE FROM testMain WHERE primid=1;
      Query OK, 1 row affected (0.008 sec)
       
      MariaDB [test]> SELECT * FROM testMain;
      ERROR 1047 (08S01): WSREP has not yet prepared node for application use
      MariaDB [test]> SELECT * from testRef;
      ERROR 1047 (08S01): WSREP has not yet prepared node for application use
      

      Node 2 log:
      191125 19:31:49 [ERROR] mysqld got signal 6 ;

      2019-11-25 19:31:49 2 [Note] WSREP: assigned new next trx id: 15
      mysqld: /home/stepan/mariadb/10.4/git/storage/innobase/handler/ha_innodb.cc:20586: dfield_t* innobase_get_computed_value(dtuple_t*, const dict_v_col_t*, const dict_index_t*, mem_heap_t**, mem_heap_t*, const dict_field_t*, THD*, TABLE*, byte*, const dict_table_t*, upd_t*, dict_foreign_t*): Assertion `mysql_table' failed.
      191125 19:31:49 [ERROR] mysqld got signal 6 ;
      This could be because you hit a bug. It is also possible that this binary
      or one of the libraries it was linked against is corrupt, improperly built,
      or misconfigured. This error can also be caused by malfunctioning hardware.
       
      To report this bug, see https://mariadb.com/kb/en/reporting-bugs
       
      We will try our best to scrape up some info that will hopefully help
      diagnose the problem, but since we have already crashed, 
      something is definitely wrong and this may fail.
       
      Server version: 10.4.11-MariaDB-debug-log
      key_buffer_size=1048576
      read_buffer_size=131072
      max_used_connections=1
      max_threads=153
      thread_count=8
      It is possible that mysqld could use up to 
      key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 63618 K  bytes of memory
      Hope that's ok; if not, decrease some variables in the equation.
       
      Thread pointer: 0x7fecc0000af0
      Attempting backtrace. You can use the following information to find out
      where mysqld died. If you see no messages after this, something went
      terribly wrong...
      stack_bottom = 0x7fecd0588950 thread_stack 0x49000
      /home/stepan/mariadb/10.4/git/sql/mysqld(my_print_stacktrace+0x40)[0x55fcd330c976]
      mysys/stacktrace.c:269(my_print_stacktrace)[0x55fcd2a7b215]
      sigaction.c:0(__restore_rt)[0x7fece3f5a5d0]
      :0(__GI_raise)[0x7fece2248207]
      :0(__GI_abort)[0x7fece22498f8]
      :0(__assert_fail_base)[0x7fece2241026]
      :0(__GI___assert_fail)[0x7fece22410d2]
      handler/ha_innodb.cc:20588(innobase_get_computed_value(dtuple_t*, dict_v_col_t const*, dict_index_t const*, mem_block_info_t**, mem_block_info_t*, dict_field_t const*, THD*, TABLE*, unsigned char*, dict_table_t const*, upd_t*, dict_foreign_t*))[0x55fcd2ce9794]
      row/row0upd.cc:2178(row_upd_store_v_row(upd_node_t*, upd_t const*, THD*, TABLE*))[0x55fcd2ece6e9]
      row/row0upd.cc:2245(row_upd_store_row(upd_node_t*, THD*, TABLE*))[0x55fcd2ece9b5]
      row/row0upd.cc:2989(row_upd_del_mark_clust_rec(upd_node_t*, dict_index_t*, unsigned long*, que_thr_t*, unsigned long, bool, mtr_t*))[0x55fcd2ed19b5]
      row/row0upd.cc:3174(row_upd_clust_step(upd_node_t*, que_thr_t*))[0x55fcd2ed2496]
      row/row0upd.cc:3298(row_upd(upd_node_t*, que_thr_t*))[0x55fcd2ed2a50]
      row/row0upd.cc:3442(row_upd_step(que_thr_t*))[0x55fcd2ed3017]
      row/row0mysql.cc:2265(row_update_cascade_for_mysql(que_thr_t*, upd_node_t*, dict_table_t*))[0x55fcd2e70478]
      row/row0ins.cc:1442(row_ins_foreign_check_on_constraint(que_thr_t*, dict_foreign_t*, btr_pcur_t*, dtuple_t*, mtr_t*))[0x55fcd2e4261e]
      row/row0ins.cc:1850(row_ins_check_foreign_constraint(unsigned long, dict_foreign_t*, dict_table_t*, dtuple_t*, que_thr_t*))[0x55fcd2e436cb]
      row/row0upd.cc:297(row_upd_check_references_constraints(upd_node_t*, btr_pcur_t*, dict_table_t*, dict_index_t*, unsigned long*, que_thr_t*, mtr_t*))[0x55fcd2ec94cc]
      row/row0upd.cc:3000(row_upd_del_mark_clust_rec(upd_node_t*, dict_index_t*, unsigned long*, que_thr_t*, unsigned long, bool, mtr_t*))[0x55fcd2ed1a72]
      row/row0upd.cc:3174(row_upd_clust_step(upd_node_t*, que_thr_t*))[0x55fcd2ed2496]
      row/row0upd.cc:3298(row_upd(upd_node_t*, que_thr_t*))[0x55fcd2ed2a50]
      row/row0upd.cc:3442(row_upd_step(que_thr_t*))[0x55fcd2ed3017]
      row/row0mysql.cc:1891(row_update_for_mysql(row_prebuilt_t*))[0x55fcd2e6f535]
      handler/ha_innodb.cc:8970(ha_innobase::delete_row(unsigned char const*))[0x55fcd2cd4556]
      sql/handler.cc:6782(handler::ha_delete_row(unsigned char const*))[0x55fcd2a91ea9]
      sql/log_event.cc:14434(Delete_rows_log_event::do_exec_row(rpl_group_info*))[0x55fcd2beb291]
      sql/log_event.cc:11606(Rows_log_event::do_apply_event(rpl_group_info*))[0x55fcd2be4450]
      sql/log_event.h:1482(Log_event::apply_event(rpl_group_info*))[0x55fcd261ecbf]
      sql/wsrep_applier.cc:200(wsrep_apply_events(THD*, Relay_log_info*, void const*, unsigned long))[0x55fcd299b301]
      sql/wsrep_high_priority_service.cc:496(Wsrep_applier_service::apply_write_set(wsrep::ws_meta const&, wsrep::const_buffer const&, wsrep::mutable_buffer&))[0x55fcd297b03d]
      src/server_state.cpp:328(apply_write_set(wsrep::server_state&, wsrep::high_priority_service&, wsrep::ws_handle const&, wsrep::ws_meta const&, wsrep::const_buffer const&))[0x55fcd33afc95]
      src/server_state.cpp:1111(wsrep::server_state::on_apply(wsrep::high_priority_service&, wsrep::ws_handle const&, wsrep::ws_meta const&, wsrep::const_buffer const&))[0x55fcd33b3497]
      wsrep/high_priority_service.hpp:48(wsrep::high_priority_service::apply(wsrep::ws_handle const&, wsrep::ws_meta const&, wsrep::const_buffer const&))[0x55fcd33ca613]
      src/wsrep_provider_v26.cpp:492((anonymous namespace)::apply_cb(void*, wsrep_ws_handle const*, unsigned int, wsrep_buf const*, wsrep_trx_meta const*, bool*))[0x55fcd33c794b]
      src/trx_handle.cpp:414(galera::TrxHandleSlave::apply(void*, wsrep_cb_status (*)(void*, wsrep_ws_handle const*, unsigned int, wsrep_buf const*, wsrep_trx_meta const*, bool*), wsrep_trx_meta const&, bool&))[0x7fecdbe9b0e1]
      src/replicator_smm.cpp:514(galera::ReplicatorSMM::apply_trx(void*, galera::TrxHandleSlave&))[0x7fecdbecdf72]
      src/replicator_smm.cpp:2157(galera::ReplicatorSMM::process_trx(void*, boost::shared_ptr<galera::TrxHandleSlave> const&))[0x7fecdbed3b70]
      src/gcs_action_source.cpp:63(galera::GcsActionSource::process_writeset(void*, gcs_action const&, bool&))[0x7fecdbeb4cbb]
      src/gcs_action_source.cpp:109(galera::GcsActionSource::dispatch(void*, gcs_action const&, bool&))[0x7fecdbeb4e95]
      src/gcs_action_source.cpp:188(galera::GcsActionSource::process(void*, bool&))[0x7fecdbeb526d]
      src/replicator_smm.cpp:391(galera::ReplicatorSMM::async_recv(void*))[0x7fecdbed4174]
      /home/stepan/mariadb/10.4/git/sql/mysqld(_ZN5wsrep18wsrep_provider_v2611run_applierEPNS_21high_priority_serviceE+0x30)[0x55fcd33c8836]
      src/wsrep_provider_v26.cpp:727(wsrep::wsrep_provider_v26::run_applier(wsrep::high_priority_service*))[0x55fcd299c005]
      sql/wsrep_thd.cc:62(wsrep_replication_process(THD*, void*))[0x55fcd298c6ee]
      sql/wsrep_mysqld.cc:2688(start_wsrep_THD(void*))[0x55fcd329ace5]
      pthread_create.c:0(start_thread)[0x7fece3f52dd5]
      /lib64/libc.so.6(clone+0x6d)[0x7fece230fead]
       
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x7fecd3b7e423): DELETE FROM testMain WHERE primid=1
      Connection ID (thread ID): 2
      Status: NOT_KILLED
       
      Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on
       
      The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
      information that should help you find out what is causing the crash.
      Writing a core file...
      Working directory at /home/stepan/mariadb/10.4/git/mysql-test/var/mysqld.2/data
      Resource Limits:
      Limit                     Soft Limit           Hard Limit           Units     
      Max cpu time              unlimited            unlimited            seconds   
      Max file size             unlimited            unlimited            bytes     
      Max data size             unlimited            unlimited            bytes     
      Max stack size            8388608              unlimited            bytes     
      Max core file size        unlimited            unlimited            bytes     
      Max resident set          unlimited            unlimited            bytes     
      Max processes             4096                 23005                processes 
      Max open files            1024                 4096                 files     
      Max locked memory         65536                65536                bytes     
      Max address space         unlimited            unlimited            bytes     
      Max file locks            unlimited            unlimited            locks     
      Max pending signals       23005                23005                signals   
      Max msgqueue size         819200               819200               bytes     
      Max nice priority         0                    0                    
      Max realtime priority     0                    0                    
      Max realtime timeout      unlimited            unlimited            us        
      Core pattern: |/usr/libexec/abrt-hook-ccpp %s %c %p %u %g %t e %P %I %h
      

      Other logs.

      It is also reproduced on 10.3, but with additional error in the client:

      ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
      

      MariaDB Version 10.3.21-MariaDB-debug: Repository: MariaDB/server; branch 10.3; Revision a14544260c33dcdb057d2f62c4aab33cb09ebcb1.

      Galera lib 25.3.28(r3879)): Repository: MariaDB/galera; branch mariadb-3.x; Revision fa9f6d0127a060cf12031858bedbd766fc6cdb61.

      Client output:

      Server version: 10.3.21-MariaDB-debug-log Source distribution
       
      Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
       
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
       
      MariaDB [(none)]> use test;
      Database changed
      MariaDB [test]> CREATE TABLE testMain (primid INT UNSIGNED NOT NULL AUTO_INCREMENT, PRIMARY KEY (primid)) ENGINE = InnoDB;
      Query OK, 0 rows affected (0.031 sec)
       
      MariaDB [test]> CREATE TABLE testRef (id INT UNSIGNED NOT NULL AUTO_INCREMENT, pid INT UNSIGNED, bitmap TINYINT UNSIGNED NOT NULL DEFAULT 0, bitmap5 TINYINT UNSIGNED GENERATED ALWAYS AS (bitmap&(1<<5)) VIRTUAL, PRIMARY KEY (id), FOREIGN KEY (pid) REFERENCES testMain (primid) ON DELETE CASCADE ON UPDATE CASCADE);
      Query OK, 0 rows affected (0.038 sec)
       
      MariaDB [test]> CREATE INDEX bitmap5 ON testRef(bitmap5) USING BTREE;
      Query OK, 0 rows affected (0.033 sec)
      Records: 0  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> INSERT INTO testMain VALUES(0);
      Query OK, 1 row affected (0.009 sec)
       
      MariaDB [test]>  SELECT * FROM testMain;
      +--------+
      | primid |
      +--------+
      |      1 |
      +--------+
      1 row in set (0.001 sec)
       
      MariaDB [test]>  INSERT INTO testRef(pid) VALUES(1);
      Query OK, 1 row affected (0.017 sec)
       
      MariaDB [test]> DELETE FROM testMain WHERE primid=2;
      Query OK, 0 rows affected (0.001 sec)
       
      MariaDB [test]>  SELECT * FROM testMain;
      +--------+
      | primid |
      +--------+
      |      1 |
      +--------+
      1 row in set (0.001 sec)
       
      MariaDB [test]> DELETE FROM testMain WHERE primid=1;
      Query OK, 1 row affected (0.016 sec)
       
      MariaDB [test]>  SELECT * FROM testMain;
      ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
      MariaDB [test]> SELECT * from testRef;
      ERROR 1047 (08S01): WSREP has not yet prepared node for application use

      Other logs.

      Attachments

        1. 191125_10.4.11_mysqld.2.err
          36 kB
        2. 191125_Replica_Crash_10.3.21.zip
          19 kB
        3. 191125_Replica_Crash_10.4.11.zip
          24 kB
        4. jan.test
          0.9 kB
        5. jan2.test
          0.5 kB

        Issue Links

          Activity

            People

              jplindst Jan Lindström (Inactive)
              stepan.patryshev Stepan Patryshev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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