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

Assertion `marked_for_read()' failed upon INSERT into table with long unique blob under binlog_row_image=NOBLOB

Details

    Description

      --source include/have_binlog_format_row.inc
       
      SET binlog_row_image= NOBLOB;
       
      CREATE TABLE t1 (pk INT PRIMARY KEY, a TEXT, UNIQUE(a));
      INSERT INTO t1 VALUES (1,'foo');
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 e6373551

      mysqld: /data/src/10.4/sql/field.cc:8461: virtual String* Field_blob::val_str(String*, String*): Assertion `marked_for_read()' failed.
      200224  1:04:50 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f0bcd37cf12 in __GI___assert_fail (assertion=0x55e9f552bc30 "marked_for_read()", file=0x55e9f552ba6b "/data/src/10.4/sql/field.cc", line=8461, function=0x55e9f5530e60 <Field_blob::val_str(String*, String*)::__PRETTY_FUNCTION__> "virtual String* Field_blob::val_str(String*, String*)") at assert.c:101
      #8  0x000055e9f49d0311 in Field_blob::val_str (this=0x7f0bb0127cf8, val_buffer=0x7f0bb012e838, val_ptr=0x7f0bb012e838) at /data/src/10.4/sql/field.cc:8461
      #9  0x000055e9f4a1859c in Item_field::val_str (this=0x7f0bb012e808, str=0x7f0bb012e838) at /data/src/10.4/sql/item.cc:3178
      #10 0x000055e9f472bea6 in Item::val_str (this=0x7f0bb012e808) at /data/src/10.4/sql/item.h:902
      #11 0x000055e9f4a81153 in Item_func_hash::val_int (this=0x7f0bb012e918) at /data/src/10.4/sql/item_func.cc:1758
      #12 0x000055e9f4a22844 in Item::save_int_in_field (this=0x7f0bb012e918, field=0x7f0bb0127e20, no_conversions=false) at /data/src/10.4/sql/item.cc:6540
      #13 0x000055e9f48b0bba in Type_handler_int_result::Item_save_in_field (this=0x55e9f5e59b88 <type_handler_long>, item=0x7f0bb012e918, field=0x7f0bb0127e20, no_conversions=false) at /data/src/10.4/sql/sql_type.cc:3672
      #14 0x000055e9f4a228ef in Item::save_in_field (this=0x7f0bb012e918, field=0x7f0bb0127e20, no_conversions=false) at /data/src/10.4/sql/item.cc:6550
      #15 0x000055e9f47cda31 in TABLE::update_virtual_fields (this=0x7f0bb012cfe0, h=0x7f0bb012de48, update_mode=VCOL_UPDATE_FOR_WRITE) at /data/src/10.4/sql/table.cc:8284
      #16 0x000055e9f45fe57a in fill_record (thd=0x7f0bb0000af0, table=0x7f0bb012cfe0, ptr=0x7f0bb0127c20, values=..., ignore_errors=false, use_value=false) at /data/src/10.4/sql/sql_base.cc:8770
      #17 0x000055e9f45fe678 in fill_record_n_invoke_before_triggers (thd=0x7f0bb0000af0, table=0x7f0bb012cfe0, ptr=0x7f0bb0127c00, values=..., ignore_errors=false, event=TRG_EVENT_INSERT) at /data/src/10.4/sql/sql_base.cc:8811
      #18 0x000055e9f4646e82 in mysql_insert (thd=0x7f0bb0000af0, table_list=0x7f0bb0013380, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false) at /data/src/10.4/sql/sql_insert.cc:1020
      #19 0x000055e9f469567d in mysql_execute_command (thd=0x7f0bb0000af0) at /data/src/10.4/sql/sql_parse.cc:4528
      #20 0x000055e9f46a1e07 in mysql_parse (thd=0x7f0bb0000af0, rawbuf=0x7f0bb0013298 "INSERT INTO t1 VALUES (1,'foo')", length=31, parser_state=0x7f0bc34b4160, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7900
      #21 0x000055e9f468cfea in dispatch_command (command=COM_QUERY, thd=0x7f0bb0000af0, packet=0x7f0bb01362e1 "INSERT INTO t1 VALUES (1,'foo')", packet_length=31, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1842
      #22 0x000055e9f468b677 in do_command (thd=0x7f0bb0000af0) at /data/src/10.4/sql/sql_parse.cc:1360
      #23 0x000055e9f48148e3 in do_handle_one_connection (connect=0x55e9f740dd20) at /data/src/10.4/sql/sql_connect.cc:1412
      #24 0x000055e9f4814632 in handle_one_connection (arg=0x55e9f740dd20) at /data/src/10.4/sql/sql_connect.cc:1316
      #25 0x000055e9f521b281 in pfs_spawn_thread (arg=0x55e9f738bc40) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #26 0x00007f0bcf3054a4 in start_thread (arg=0x7f0bc34b5700) at pthread_create.c:456
      #27 0x00007f0bcd439d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible on 10.4, 10.5.
      The test case is not applicable to 10.3 due to the long unique blob.
      No obvious problem on a non-debug build.

      Attachments

        Issue Links

          Activity

            Roel Roel Van de Paar added a comment - - edited

            Another testcase...

            # mysqld options required for replay: --log-bin --sql_mode= 
            USE test;
            SET @@SESSION.BINLOG_ROW_IMAGE=NOBLOB;
            CREATE TEMPORARY TABLE t1 (c1 INT,c2 INT);
            CREATE TABLE t2(c1 INT KEY,c2 TEXT UNIQUE);
            UPDATE performance_schema.setup_objects SET ENABLED=0;
            INSERT INTO t2 VALUES(0,0);
            

            Leads to:

            10.5.3 364e7a9ae6b5fbf69494cec30733b5ad28738cbb

            mysqld: /test/10.5_dbg/sql/field.cc:8434: virtual String* Field_blob::val_str(String*, String*): Assertion `marked_for_read()' failed.
            

            10.5.3 364e7a9ae6b5fbf69494cec30733b5ad28738cbb

            Core was generated by `/test/MD110420-mariadb-10.5.3-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
            Program terminated with signal SIGABRT, Aborted.
            #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
                at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
            [Current thread is 1 (Thread 0x7f0ab7784700 (LWP 32213))]
            (gdb) bt
            #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
            #1  0x000056074935021e in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518
            #2  0x0000560748af608f in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:329
            #3  <signal handler called>
            #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
            #5  0x00007f0ab5f13801 in __GI_abort () at abort.c:79
            #6  0x00007f0ab5f0339a in __assert_fail_base (fmt=0x7f0ab608a7d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x56074964e764 "marked_for_read()", file=file@entry=0x56074964e593 "/test/10.5_dbg/sql/field.cc", line=line@entry=8434, function=function@entry=0x560749650e00 <Field_blob::val_str(String*, String*)::__PRETTY_FUNCTION__> "virtual String* Field_blob::val_str(String*, String*)") at assert.c:92
            #7  0x00007f0ab5f03412 in __GI___assert_fail (assertion=assertion@entry=0x56074964e764 "marked_for_read()", file=file@entry=0x56074964e593 "/test/10.5_dbg/sql/field.cc", line=line@entry=8434, function=function@entry=0x560749650e00 <Field_blob::val_str(String*, String*)::__PRETTY_FUNCTION__> "virtual String* Field_blob::val_str(String*, String*)") at assert.c:101
            #8  0x0000560748ad5c76 in Field_blob::val_str (this=0x7f0a8a44d8d0, val_buffer=<optimized out>, val_ptr=0x7f0a8a44deb8) at /test/10.5_dbg/sql/field.cc:8434
            #9  0x0000560748b16f04 in Item_field::val_str (this=0x7f0a8a44de80, str=0x7f0a8a44deb8) at /test/10.5_dbg/sql/item.cc:3187
            #10 0x0000560748b78b54 in Item::val_str (this=<optimized out>) at /test/10.5_dbg/sql/item.h:914
            #11 Item_func_hash::val_int (this=0x7f0a8a44e1a0) at /test/10.5_dbg/sql/item_func.cc:1756
            #12 0x0000560748b2a545 in Item::save_int_in_field (this=0x7f0a8a44e1a0, field=0x7f0a8a44d9f8, no_conversions=<optimized out>) at /test/10.5_dbg/sql/item.cc:6559
            #13 0x0000560748a1d39a in Type_handler_int_result::Item_save_in_field (this=<optimized out>, item=<optimized out>, field=<optimized out>, no_conversions=<optimized out>) at /test/10.5_dbg/sql/sql_type.cc:4205
            #14 0x0000560748b1487a in Item::save_in_field (this=0x7f0a8a44e1a0, field=0x7f0a8a44d9f8, no_conversions=<optimized out>) at /test/10.5_dbg/sql/item.cc:6569
            #15 0x000056074895a41a in TABLE::update_virtual_fields (this=this@entry=0x7f0a8a521088, h=<optimized out>, update_mode=update_mode@entry=VCOL_UPDATE_FOR_WRITE) at /test/10.5_dbg/sql/table.cc:8437
            #16 0x00005607487d3e25 in fill_record (thd=thd@entry=0x7f0a8a415088, table=table@entry=0x7f0a8a521088, ptr=0x7f0a8a44d7f8, ptr@entry=0x7f0a8a44d7d8, values=..., ignore_errors=ignore_errors@entry=false, use_value=use_value@entry=false) at /test/10.5_dbg/sql/sql_base.cc:8689
            #17 0x00005607487d410a in fill_record_n_invoke_before_triggers (thd=thd@entry=0x7f0a8a415088, table=table@entry=0x7f0a8a521088, ptr=0x7f0a8a44d7d8, values=..., ignore_errors=ignore_errors@entry=false, event=event@entry=TRG_EVENT_INSERT) at /test/10.5_dbg/sql/sql_base.cc:8730
            #18 0x0000560748815d82 in mysql_insert (thd=thd@entry=0x7f0a8a415088, table_list=0x7f0a8a474188, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at /test/10.5_dbg/sql/sql_insert.cc:1029
            #19 0x000056074884dddc in mysql_execute_command (thd=thd@entry=0x7f0a8a415088) at /test/10.5_dbg/sql/sql_parse.cc:4515
            #20 0x00005607488599d1 in mysql_parse (thd=thd@entry=0x7f0a8a415088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7f0ab7783450, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7953
            #21 0x0000560748845719 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f0a8a415088, packet=packet@entry=0x7f0a8a467089 "INSERT INTO t2 VALUES(0,0)", packet_length=packet_length@entry=26, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1839
            #22 0x0000560748843f6f in do_command (thd=0x7f0a8a415088) at /test/10.5_dbg/sql/sql_parse.cc:1358
            #23 0x000056074899ea53 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x7f0a8e849aa8, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1422
            #24 0x000056074899ed82 in handle_one_connection (arg=arg@entry=0x7f0a8e849aa8) at /test/10.5_dbg/sql/sql_connect.cc:1319
            #25 0x0000560748dff080 in pfs_spawn_thread (arg=0x7f0ab5445b08) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
            #26 0x00007f0ab6bf66db in start_thread (arg=0x7f0ab7784700) at pthread_create.c:463
            #27 0x00007f0ab5ff488f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
            

            Bug confirmed present in:
            MariaDB: 10.4.13 (dbg), 10.5.2 (dbg), 10.5.3 (dbg)

            Bug confirmed not present in:
            MariaDB: 10.1.45 (dbg), 10.1.45 (opt), 10.2.32 (dbg), 10.2.32 (opt), 10.3.23 (dbg), 10.3.23 (opt), 10.4.13 (opt), 10.5.2 (opt), 10.5.3 (opt)
            MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

            Roel Roel Van de Paar added a comment - - edited Another testcase... # mysqld options required for replay: --log-bin --sql_mode= USE test; SET @@SESSION.BINLOG_ROW_IMAGE=NOBLOB; CREATE TEMPORARY TABLE t1 (c1 INT,c2 INT); CREATE TABLE t2(c1 INT KEY,c2 TEXT UNIQUE); UPDATE performance_schema.setup_objects SET ENABLED=0; INSERT INTO t2 VALUES(0,0); Leads to: 10.5.3 364e7a9ae6b5fbf69494cec30733b5ad28738cbb mysqld: /test/10.5_dbg/sql/field.cc:8434: virtual String* Field_blob::val_str(String*, String*): Assertion `marked_for_read()' failed. 10.5.3 364e7a9ae6b5fbf69494cec30733b5ad28738cbb Core was generated by `/test/MD110420-mariadb-10.5.3-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'. Program terminated with signal SIGABRT, Aborted. #0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57 [Current thread is 1 (Thread 0x7f0ab7784700 (LWP 32213))] (gdb) bt #0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57 #1 0x000056074935021e in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518 #2 0x0000560748af608f in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:329 #3 <signal handler called> #4 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 #5 0x00007f0ab5f13801 in __GI_abort () at abort.c:79 #6 0x00007f0ab5f0339a in __assert_fail_base (fmt=0x7f0ab608a7d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x56074964e764 "marked_for_read()", file=file@entry=0x56074964e593 "/test/10.5_dbg/sql/field.cc", line=line@entry=8434, function=function@entry=0x560749650e00 <Field_blob::val_str(String*, String*)::__PRETTY_FUNCTION__> "virtual String* Field_blob::val_str(String*, String*)") at assert.c:92 #7 0x00007f0ab5f03412 in __GI___assert_fail (assertion=assertion@entry=0x56074964e764 "marked_for_read()", file=file@entry=0x56074964e593 "/test/10.5_dbg/sql/field.cc", line=line@entry=8434, function=function@entry=0x560749650e00 <Field_blob::val_str(String*, String*)::__PRETTY_FUNCTION__> "virtual String* Field_blob::val_str(String*, String*)") at assert.c:101 #8 0x0000560748ad5c76 in Field_blob::val_str (this=0x7f0a8a44d8d0, val_buffer=<optimized out>, val_ptr=0x7f0a8a44deb8) at /test/10.5_dbg/sql/field.cc:8434 #9 0x0000560748b16f04 in Item_field::val_str (this=0x7f0a8a44de80, str=0x7f0a8a44deb8) at /test/10.5_dbg/sql/item.cc:3187 #10 0x0000560748b78b54 in Item::val_str (this=<optimized out>) at /test/10.5_dbg/sql/item.h:914 #11 Item_func_hash::val_int (this=0x7f0a8a44e1a0) at /test/10.5_dbg/sql/item_func.cc:1756 #12 0x0000560748b2a545 in Item::save_int_in_field (this=0x7f0a8a44e1a0, field=0x7f0a8a44d9f8, no_conversions=<optimized out>) at /test/10.5_dbg/sql/item.cc:6559 #13 0x0000560748a1d39a in Type_handler_int_result::Item_save_in_field (this=<optimized out>, item=<optimized out>, field=<optimized out>, no_conversions=<optimized out>) at /test/10.5_dbg/sql/sql_type.cc:4205 #14 0x0000560748b1487a in Item::save_in_field (this=0x7f0a8a44e1a0, field=0x7f0a8a44d9f8, no_conversions=<optimized out>) at /test/10.5_dbg/sql/item.cc:6569 #15 0x000056074895a41a in TABLE::update_virtual_fields (this=this@entry=0x7f0a8a521088, h=<optimized out>, update_mode=update_mode@entry=VCOL_UPDATE_FOR_WRITE) at /test/10.5_dbg/sql/table.cc:8437 #16 0x00005607487d3e25 in fill_record (thd=thd@entry=0x7f0a8a415088, table=table@entry=0x7f0a8a521088, ptr=0x7f0a8a44d7f8, ptr@entry=0x7f0a8a44d7d8, values=..., ignore_errors=ignore_errors@entry=false, use_value=use_value@entry=false) at /test/10.5_dbg/sql/sql_base.cc:8689 #17 0x00005607487d410a in fill_record_n_invoke_before_triggers (thd=thd@entry=0x7f0a8a415088, table=table@entry=0x7f0a8a521088, ptr=0x7f0a8a44d7d8, values=..., ignore_errors=ignore_errors@entry=false, event=event@entry=TRG_EVENT_INSERT) at /test/10.5_dbg/sql/sql_base.cc:8730 #18 0x0000560748815d82 in mysql_insert (thd=thd@entry=0x7f0a8a415088, table_list=0x7f0a8a474188, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at /test/10.5_dbg/sql/sql_insert.cc:1029 #19 0x000056074884dddc in mysql_execute_command (thd=thd@entry=0x7f0a8a415088) at /test/10.5_dbg/sql/sql_parse.cc:4515 #20 0x00005607488599d1 in mysql_parse (thd=thd@entry=0x7f0a8a415088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7f0ab7783450, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7953 #21 0x0000560748845719 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f0a8a415088, packet=packet@entry=0x7f0a8a467089 "INSERT INTO t2 VALUES(0,0)", packet_length=packet_length@entry=26, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1839 #22 0x0000560748843f6f in do_command (thd=0x7f0a8a415088) at /test/10.5_dbg/sql/sql_parse.cc:1358 #23 0x000056074899ea53 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x7f0a8e849aa8, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1422 #24 0x000056074899ed82 in handle_one_connection (arg=arg@entry=0x7f0a8e849aa8) at /test/10.5_dbg/sql/sql_connect.cc:1319 #25 0x0000560748dff080 in pfs_spawn_thread (arg=0x7f0ab5445b08) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201 #26 0x00007f0ab6bf66db in start_thread (arg=0x7f0ab7784700) at pthread_create.c:463 #27 0x00007f0ab5ff488f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 Bug confirmed present in: MariaDB: 10.4.13 (dbg), 10.5.2 (dbg), 10.5.3 (dbg) Bug confirmed not present in: MariaDB: 10.1.45 (dbg), 10.1.45 (opt), 10.2.32 (dbg), 10.2.32 (opt), 10.3.23 (dbg), 10.3.23 (opt), 10.4.13 (opt), 10.5.2 (opt), 10.5.3 (opt) MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)
            Roel Roel Van de Paar added a comment - - edited

            And one more, which interestingly does not reproduce in 10.5.3 (dbg), though does reproduce on 10.5.2 (dbg);

            # mysqld options required for replay:  --log-bin --sql_mode= 
            USE test;
            CREATE TEMPORARY TABLE t (c INT PRIMARY KEY, c2 BLOB UNIQUE);
            SET @@SESSION.binlog_row_image=noblob;
            SELECT * FROM performance_schema.hosts;
            INSERT INTO t VALUES(0,0);
            

            Roel Roel Van de Paar added a comment - - edited And one more, which interestingly does not reproduce in 10.5.3 (dbg), though does reproduce on 10.5.2 (dbg); # mysqld options required for replay: --log-bin --sql_mode= USE test; CREATE TEMPORARY TABLE t (c INT PRIMARY KEY, c2 BLOB UNIQUE); SET @@SESSION.binlog_row_image=noblob; SELECT * FROM performance_schema.hosts; INSERT INTO t VALUES(0,0);

            Increased prio based on new findings (inconsistencies between recent 10.5 versions). Feel free to adjust.

            Roel Roel Van de Paar added a comment - Increased prio based on new findings (inconsistencies between recent 10.5 versions). Feel free to adjust.

            This bug can be reproduced even without long unique

            --source include/have_binlog_format_row.inc
             
            SET binlog_row_image= NOBLOB;
            create table t1(id int primary key, a blob, b varchar(20) as (LEFT(a,2)));
            INSERT INTO t1 VALUES (1, 'foo', default);
             
            # Cleanup
            DROP TABLE t1;
            
            

            sachin.setiya.007 Sachin Setiya (Inactive) added a comment - This bug can be reproduced even without long unique --source include/have_binlog_format_row.inc   SET binlog_row_image= NOBLOB; create table t1(id int primary key, a blob, b varchar(20) as (LEFT(a,2))); INSERT INTO t1 VALUES (1, 'foo', default);   # Cleanup DROP TABLE t1;

            Patch branch bb-10.4-sachin2

            sachin.setiya.007 Sachin Setiya (Inactive) added a comment - Patch branch bb-10.4-sachin2

            Filters updated.

            Roel Roel Van de Paar added a comment - Filters updated.

            People

              sachin.setiya.007 Sachin Setiya (Inactive)
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.