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

multi-update tries to position updated table by null reference

    XMLWordPrintable

    Details

      Description

      Table corruption or Assertion `bitmap_is_set(&(m_part_info->read_partitions), part_id)' failed upon multi-update on a versioned partitioned table

      --source include/have_partition.inc
       
      CREATE TABLE t1 (a INT);
      INSERT INTO t1 VALUES (0),(1);
       
      CREATE TABLE t2 (b INT) WITH SYSTEM VERSIONING PARTITION BY system_time INTERVAL 1 WEEK (PARTITION p1 HISTORY, PARTITION pn CURRENT);
      INSERT INTO t2 VALUES (0),(2);
       
      UPDATE t1 LEFT JOIN t2 ON a > b SET b = 2 ORDER BY b;
       
      # Cleanup
      DROP TABLE t1, t2;
      

      10.3 2842c369 debug

      mysqld: /data/src/10.3/sql/ha_partition.cc:5199: virtual int ha_partition::rnd_pos(uchar*, uchar*): Assertion `bitmap_is_set(&(m_part_info->read_partitions), part_id)' failed.
      190906 16:25:25 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fa4abf42f12 in __GI___assert_fail (assertion=0x564bc5871a90 "bitmap_is_set(&(m_part_info->read_partitions), part_id)", file=0x564bc5870688 "/data/src/10.3/sql/ha_partition.cc", line=5199, function=0x564bc5874c00 <ha_partition::rnd_pos(unsigned char*, unsigned char*)::__PRETTY_FUNCTION__> "virtual int ha_partition::rnd_pos(uchar*, uchar*)") at assert.c:101
      #8  0x0000564bc54025c2 in ha_partition::rnd_pos (this=0x7fa494182458, buf=0x7fa494184ff8 "\375\002", pos=0x7fa49403c159 "") at /data/src/10.3/sql/ha_partition.cc:5199
      #9  0x0000564bc4bac460 in handler::ha_rnd_pos (this=0x7fa494182458, buf=0x7fa494184ff8 "\375\002", pos=0x7fa49403c159 "") at /data/src/10.3/sql/handler.cc:2872
      #10 0x0000564bc49926f4 in multi_update::do_updates (this=0x7fa4940144e8) at /data/src/10.3/sql/sql_update.cc:2669
      #11 0x0000564bc4992ffa in multi_update::send_eof (this=0x7fa4940144e8) at /data/src/10.3/sql/sql_update.cc:2832
      #12 0x0000564bc49004f1 in do_select (join=0x7fa4940145c0, procedure=0x0) at /data/src/10.3/sql/sql_select.cc:19100
      #13 0x0000564bc48d716f in JOIN::exec_inner (this=0x7fa4940145c0) at /data/src/10.3/sql/sql_select.cc:4044
      #14 0x0000564bc48d6534 in JOIN::exec (this=0x7fa4940145c0) at /data/src/10.3/sql/sql_select.cc:3838
      #15 0x0000564bc48d7853 in mysql_select (thd=0x7fa494000b00, tables=0x7fa494012930, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x7fa494014400, group=0x0, having=0x0, proc_param=0x0, select_options=1342177408, result=0x7fa4940144e8, unit=0x7fa4940049d0, select_lex=0x7fa494005150) at /data/src/10.3/sql/sql_select.cc:4243
      #16 0x0000564bc498f44e in mysql_multi_update (thd=0x7fa494000b00, table_list=0x7fa494012930, fields=0x7fa494005278, values=0x7fa494005780, conds=0x0, options=0, handle_duplicates=DUP_ERROR, ignore=false, unit=0x7fa4940049d0, select_lex=0x7fa494005150, result=0x7fa4a6140fd0) at /data/src/10.3/sql/sql_update.cc:1789
      #17 0x0000564bc4888b91 in mysql_execute_command (thd=0x7fa494000b00) at /data/src/10.3/sql/sql_parse.cc:4366
      #18 0x0000564bc48949ff in mysql_parse (thd=0x7fa494000b00, rawbuf=0x7fa494012818 "UPDATE t1 LEFT JOIN t2 ON a > b SET b = 2 ORDER BY b", length=52, parser_state=0x7fa4a61415e0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7830
      #19 0x0000564bc48812fd in dispatch_command (command=COM_QUERY, thd=0x7fa494000b00, packet=0x7fa494008c71 "UPDATE t1 LEFT JOIN t2 ON a > b SET b = 2 ORDER BY b", packet_length=52, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1856
      #20 0x0000564bc487fc24 in do_command (thd=0x7fa494000b00) at /data/src/10.3/sql/sql_parse.cc:1401
      #21 0x0000564bc49f8b94 in do_handle_one_connection (connect=0x564bc742c130) at /data/src/10.3/sql/sql_connect.cc:1403
      #22 0x0000564bc49f88f6 in handle_one_connection (arg=0x564bc742c130) at /data/src/10.3/sql/sql_connect.cc:1308
      #23 0x0000564bc53db060 in pfs_spawn_thread (arg=0x564bc74470b0) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #24 0x00007fa4adab74a4 in start_thread (arg=0x7fa4a6142700) at pthread_create.c:456
      #25 0x00007fa4abfffd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible with at least MyISAM, InnoDB, Aria.

      Non-debug builds don't crash, but produce corruption-like messages, different for different engine.

      MyISAM: ER_KEY_NOT_FOUND

      mysqltest: At line 9: query 'UPDATE t1 LEFT JOIN t2 ON a > b SET b = 2 ORDER BY b' failed: 1032: Can't find record in 't2'
      

      InnoDB: ER_NOT_KEYFILE

      mysqltest: At line 9: query 'UPDATE t1 LEFT JOIN t2 ON a > b SET b = 2 ORDER BY b' failed: 1034: Index for table 't2' is corrupt; try to repair it
      

      Aria: ER_GET_ERRNO

      mysqltest: At line 9: query 'UPDATE t1 LEFT JOIN t2 ON a > b SET b = 2 ORDER BY b' failed: 1030: Got error 176 "Read page with wrong checksum" from storage engine Aria
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              midenok Aleksey Midenkov
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: