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

Server hangs upon UPDATE/DELETE on a view reading from versioned partitioned table

    XMLWordPrintable

Details

    Description

      Note: The patch for MDEV-17091 is already in the branches.

      --source include/have_partition.inc
       
      CREATE TABLE t1 (f CHAR(6)) WITH SYSTEM VERSIONING PARTITION BY system_time LIMIT 1 (PARTITION p1 HISTORY, PARTITION p2 HISTORY, PARTITION pn CURRENT);
      INSERT INTO t1 VALUES (NULL);
      UPDATE t1 SET f = 'foo';
      UPDATE t1 SET f = 'bar';
      CREATE VIEW v1 AS SELECT * FROM t1 FOR SYSTEM_TIME ALL;
      UPDATE v1 SET f = '';
       
      # Cleanup
      DROP VIEW v1;
      DROP TABLE t1;
      

      On a debug build, the test case causes an assertion failure. Reproducible with at least MyISAM, InnoDB, Aria:

      10.3 c7559747

      mysqld: /data/src/10.3/sql/ha_partition.cc:4404: virtual int ha_partition::update_row(const uchar*, const uchar*): Assertion `old_part_id == m_last_part' failed.
      200429 19:31:10 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f7abb953102 in __GI___assert_fail (assertion=0x55fd75b1a8e0 "old_part_id == m_last_part", file=0x55fd75b17220 "/data/src/10.3/sql/ha_partition.cc", line=4404, function=0x55fd75b22580 <ha_partition::update_row(unsigned char const*, unsigned char const*)::__PRETTY_FUNCTION__> "virtual int ha_partition::update_row(const uchar*, const uchar*)") at assert.c:101
      #8  0x000055fd74f9f159 in ha_partition::update_row (this=0x61d0001b5910, old_data=0x61900008a360 "\377      ^\251\253\316\r\221\346^\251\253\316\r\241\211\276\276\276\375bar   ^\251\253\316\r\246\252\177\377\377\377\017B?", '\276' <repeats 11 times>, "\300\243\b", new_data=0x61900008a348 "\375      ^\251\253\316\r\260y\177\377\377\377\017B?\276\276\276\377      ^\251\253\316\r\221\346^\251\253\316\r\241\211\276\276\276\375bar   ^\251\253\316\r\246\252\177\377\377\377\017B?", '\276' <repeats 11 times>, "\300\243\b") at /data/src/10.3/sql/ha_partition.cc:4404
      #9  0x000055fd73be7eeb in handler::ha_update_row (this=0x61d0001b5910, old_data=0x61900008a360 "\377      ^\251\253\316\r\221\346^\251\253\316\r\241\211\276\276\276\375bar   ^\251\253\316\r\246\252\177\377\377\377\017B?", '\276' <repeats 11 times>, "\300\243\b", new_data=0x61900008a348 "\375      ^\251\253\316\r\260y\177\377\377\377\017B?\276\276\276\377      ^\251\253\316\r\221\346^\251\253\316\r\241\211\276\276\276\375bar   ^\251\253\316\r\246\252\177\377\377\377\017B?", '\276' <repeats 11 times>, "\300\243\b") at /data/src/10.3/sql/handler.cc:6485
      #10 0x000055fd736dcb0f in mysql_update (thd=0x62a000060270, table_list=0x62b000000398, fields=..., values=..., conds=0x0, order_num=0, order=0x0, limit=18446744073709551615, ignore=false, found_return=0x7f7ab17b7e20, updated_return=0x7f7ab17b7e60) at /data/src/10.3/sql/sql_update.cc:952
      #11 0x000055fd734218b2 in mysql_execute_command (thd=0x62a000060270) at /data/src/10.3/sql/sql_parse.cc:4293
      #12 0x000055fd7343b25d in mysql_parse (thd=0x62a000060270, rawbuf=0x62b000000290 "UPDATE v1 SET f = ''", length=20, parser_state=0x7f7ab17b99a0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7817
      #13 0x000055fd73411af0 in dispatch_command (command=COM_QUERY, thd=0x62a000060270, packet=0x6290000e6271 "UPDATE v1 SET f = ''", packet_length=20, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1855
      #14 0x000055fd7340e22b in do_command (thd=0x62a000060270) at /data/src/10.3/sql/sql_parse.cc:1401
      #15 0x000055fd737f7ab9 in do_handle_one_connection (connect=0x611000005fb0) at /data/src/10.3/sql/sql_connect.cc:1403
      #16 0x000055fd737f7371 in handle_one_connection (arg=0x611000005fb0) at /data/src/10.3/sql/sql_connect.cc:1308
      #17 0x000055fd74f451ab in pfs_spawn_thread (arg=0x61600000cff0) at /data/src/10.3/storage/perfschema/pfs.cc:1869
      #18 0x00007f7abc1cdfa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
      #19 0x00007f7abba1c4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      On a non-debug build it passes with MyISAM and Aria, but hangs with InnoDB, seemingly forever, or until InnoDB buffer pool is 95% exhausted (the latter was observed with small buffer pools, like the one that MTR sets; when set to a bigger value, it continues running, I have no information whether it keeps growing and will ever abort):

      --source include/have_partition.inc
      --source include/have_innodb.inc
       
      CREATE TABLE t1 (f CHAR(6)) ENGINE=InnoDB WITH SYSTEM VERSIONING PARTITION BY system_time LIMIT 1 (PARTITION p1 HISTORY, PARTITION p2 HISTORY, PARTITION pn CURRENT);
      INSERT INTO t1 VALUES (NULL);
      UPDATE t1 SET f = 'foo';
      UPDATE t1 SET f = 'bar';
      CREATE VIEW v1 AS SELECT * FROM t1 FOR SYSTEM_TIME ALL;
      UPDATE v1 SET f = '';
       
      # Cleanup
      DROP VIEW v1;
      DROP TABLE t1;
      

      The thread doing update is below, all threads stack trace from the hanging server is attached.

      10.3 RelWithDebInfo c7559747

      Thread 27 (Thread 0x7f198c100700 (LWP 1262)):
      #0  page_align (ptr=<optimized out>) at /data/src/10.3/storage/innobase/include/page0page.h:212
      #1  page_rec_is_comp (rec=<optimized out>) at /data/src/10.3/storage/innobase/include/page0page.h:283
      #2  page_rec_get_next (rec=<optimized out>) at /data/src/10.3/storage/innobase/include/page0page.ic:699
      #3  btr_search_update_hash_node_on_insert (cursor=cursor@entry=0x7f198c0fc1a0, ahi_latch=0x561ec8bf0e00) at /data/src/10.3/storage/innobase/btr/btr0sea.cc:1761
      #4  0x0000561ec5de4bef in btr_cur_optimistic_insert (flags=flags@entry=0, cursor=cursor@entry=0x7f198c0fc1a0, offsets=offsets@entry=0x7f198c0fc148, heap=heap@entry=0x7f198c0fc140, entry=entry@entry=0x7f19340814e8, rec=rec@entry=0x7f198c0fc600, big_rec=0x7f198c0fc138, n_ext=<optimized out>, thr=0x7f19340a9dc8, mtr=0x7f198c0fcb60) at /data/src/10.3/storage/innobase/btr/btr0cur.cc:3489
      #5  0x0000561ec5d3b389 in row_ins_clust_index_entry_low (flags=flags@entry=0, mode=mode@entry=2, index=index@entry=0x7f1934069ef8, n_uniq=n_uniq@entry=0, entry=entry@entry=0x7f19340814e8, n_ext=n_ext@entry=0, thr=0x7f19340a9dc8) at /data/src/10.3/storage/innobase/row/row0ins.cc:2747
      #6  0x0000561ec5d3cd05 in row_ins_clust_index_entry (index=index@entry=0x7f1934069ef8, entry=entry@entry=0x7f19340814e8, thr=thr@entry=0x7f19340a9dc8, n_ext=n_ext@entry=0) at /data/src/10.3/storage/innobase/row/row0ins.cc:3203
      #7  0x0000561ec5d3ed88 in row_ins_index_entry (thr=0x7f19340a9dc8, entry=<optimized out>, index=<optimized out>) at /data/src/10.3/storage/innobase/row/row0ins.cc:3328
      #8  row_ins_index_entry_step (thr=0x7f19340a9dc8, node=<optimized out>) at /data/src/10.3/storage/innobase/row/row0ins.cc:3479
      #9  row_ins (thr=<optimized out>, node=<optimized out>) at /data/src/10.3/storage/innobase/row/row0ins.cc:3616
      #10 row_ins_step (thr=thr@entry=0x7f19340a9dc8) at /data/src/10.3/storage/innobase/row/row0ins.cc:3755
      #11 0x0000561ec5d4dfd1 in row_insert_for_mysql (mysql_rec=mysql_rec@entry=0x7f1934065758 "\375      ^\251\254\364\016\004\266\177\377\377\377\017B?", prebuilt=0x7f19340a9628, ins_mode=<optimized out>) at /data/src/10.3/storage/innobase/row/row0mysql.cc:1462
      #12 0x0000561ec5ca3614 in ha_innobase::write_row (this=0x7f1934071e40, record=0x7f1934065758 "\375      ^\251\254\364\016\004\266\177\377\377\377\017B?") at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:8035
      #13 0x0000561ec5b3a05f in handler::ha_write_row (this=0x7f1934071e40, buf=buf@entry=0x7f1934065758 "\375      ^\251\254\364\016\004\266\177\377\377\377\017B?") at /data/src/10.3/sql/handler.cc:6453
      #14 0x0000561ec5fc1aec in ha_partition::update_row (this=0x7f19340707d0, old_data=0x7f1934065770 "\377      ^\251\254\364\016\002#^\251\254\364\016\004\266", new_data=0x7f1934065758 "\375      ^\251\254\364\016\004\266\177\377\377\377\017B?") at /data/src/10.3/sql/ha_partition.cc:4445
      #15 0x0000561ec5b3a15b in handler::ha_update_row (this=0x7f19340707d0, old_data=0x7f1934065770 "\377      ^\251\254\364\016\002#^\251\254\364\016\004\266", new_data=0x7f1934065758 "\375      ^\251\254\364\016\004\266\177\377\377\377\017B?") at /data/src/10.3/sql/handler.cc:6485
      #16 0x0000561ec5a0054c in mysql_update (thd=thd@entry=0x7f19340009a8, table_list=<optimized out>, fields=..., values=..., conds=<optimized out>, order_num=<optimized out>, order=<optimized out>, limit=18446744073705284565, ignore=false, found_return=0x7f198c0fdf60, updated_return=0x7f198c0fe020) at /data/src/10.3/sql/sql_update.cc:952
      #17 0x0000561ec5967b57 in mysql_execute_command (thd=thd@entry=0x7f19340009a8) at /data/src/10.3/sql/sql_parse.cc:4300
      #18 0x0000561ec596e8e9 in mysql_parse (thd=thd@entry=0x7f19340009a8, rawbuf=<optimized out>, length=20, parser_state=parser_state@entry=0x7f198c0ff620, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.3/sql/sql_parse.cc:7817
      #19 0x0000561ec59703d3 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f19340009a8, packet=packet@entry=0x7f19340070c9 "UPDATE v1 SET f = ''", packet_length=packet_length@entry=20, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.3/sql/sql_parse.cc:1856
      #20 0x0000561ec5971d9a in do_command (thd=0x7f19340009a8) at /data/src/10.3/sql/sql_parse.cc:1401
      #21 0x0000561ec5a39254 in do_handle_one_connection (connect=connect@entry=0x561ec8d44388) at /data/src/10.3/sql/sql_connect.cc:1403
      #22 0x0000561ec5a393b4 in handle_one_connection (arg=arg@entry=0x561ec8d44388) at /data/src/10.3/sql/sql_connect.cc:1308
      #23 0x0000561ec5fa3c04 in pfs_spawn_thread (arg=0x561ec8ce0c58) at /data/src/10.3/storage/perfschema/pfs.cc:1869
      #24 0x00007f1994cbc4a4 in start_thread (arg=0x7f198c100700) at pthread_create.c:456
      #25 0x00007f1992df0d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Attachments

        1. all_threads
          31 kB
          Elena Stepanova

        Issue Links

          Activity

            People

              midenok Aleksey Midenkov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.