We're updating the issue view to help you get more done. 

Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field_index) || bitmap_is_set(table->vcol_set, field_index))' failure or valgrind errors on INSERT DELAYED of a default value into a virtual column

Description

The following test case causes an assertion failure on 5.2, 5.5, 10.0 (debug builds) and valgrind warnings on 5.3 (debug build) and all release builds.

1 2 3 4 5 CREATE TABLE t1 ( ts TIMESTAMP, tsv TIMESTAMP AS (ADDDATE(ts, INTERVAL 1 DAY)) VIRTUAL ) ENGINE=MyISAM; INSERT DELAYED INTO t1 (tsv) VALUES (DEFAULT);

Assertion failure on 5.5 and 10.0 (stack trace from 5.5):

1 2 mysqld: sql/field.cc:4480: int Field_timestamp::store_TIME_with_warning(THD*, MYSQL_TIME*, const ErrConv*, bool, bool): Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field_index) || bitmap_is_set(table->vcol_set, field_index))' failed. [ERROR] mysqld got signal 6 ;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #6 0x00007f51bc84bd4d in __GI___assert_fail (assertion=0xde2958 "!table || (!table->write_set || bitmap_is_set(table->write_set, field_index) || bitmap_is_set(table->vcol_set, field_index))", file=<optimized out>, line=4480, function=<optimized out>) at assert.c:81 #7 0x00000000007afb01 in Field_timestamp::store_TIME_with_warning (this=0x28dadb8, thd=0x28b4d50, l_time=0x7f51b1f2e570, str=0x7f51b1f2e5b0, was_cut=false, have_smth_to_conv=true) at sql/field.cc:4480 #8 0x00000000007afd3b in Field_timestamp::store_time_dec (this=0x28dadb8, ltime=0x7f51b1f2e800, dec=0) at sql/field.cc:4524 #9 0x00000000007deb29 in Item::save_date_in_field (this=0x28d94a8, field=0x28dadb8) at sql/item.cc:422 #10 0x0000000000792c5a in Item_temporal_func::save_in_field (this=0x28d94a8, field=0x28dadb8, no_conversions=false) at sql/item_timefunc.h:503 #11 0x00000000006e48fd in update_virtual_fields (thd=0x27c5ad0, table=0x28bfed8, vcol_update_mode=VCOL_UPDATE_FOR_WRITE) at sql/table.cc:6455 #12 0x00000000005bde87 in fill_record (thd=0x27c5ad0, fields=..., values=..., ignore_errors=false) at sql/sql_base.cc:8879 #13 0x00000000005bdf6f in fill_record_n_invoke_before_triggers (thd=0x27c5ad0, fields=..., values=..., ignore_errors=false, triggers=0x0, event=TRG_EVENT_INSERT) at sql/sql_base.cc:8923 #14 0x00000000005f3415 in mysql_insert (thd=0x27c5ad0, table_list=0x289d0e8, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false) at sql/sql_insert.cc:916 #15 0x000000000061279e in mysql_execute_command (thd=0x27c5ad0) at sql/sql_parse.cc:2915 #16 0x000000000061a81b in mysql_parse (thd=0x27c5ad0, rawbuf=0x28b3898 "INSERT DELAYED INTO t1 (tsv) VALUES (DEFAULT)", length=45, parser_state=0x7f51b1f2f4f0) at sql/sql_parse.cc:5730 #17 0x000000000060e02c in dispatch_command (command=COM_QUERY, thd=0x27c5ad0, packet=0x289f621 "INSERT DELAYED INTO t1 (tsv) VALUES (DEFAULT)", packet_length=45) at sql/sql_parse.cc:1055 #18 0x000000000060d2e3 in do_command (thd=0x27c5ad0) at sql/sql_parse.cc:794 #19 0x00000000007156c1 in do_handle_one_connection (thd_arg=0x27c5ad0) at sql/sql_connect.cc:1253 #20 0x00000000007150ac in handle_one_connection (arg=0x27c5ad0) at sql/sql_connect.cc:1168 #21 0x0000000000bb79cd in pfs_spawn_thread (arg=0x2911c30) at storage/perfschema/pfs.cc:1015 #22 0x00007f51bd58fefc in start_thread (arg=0x7f51b1f30700) at pthread_create.c:304
1 2 3 4 branch: maria/5.5 revision-id: sanja@montyprogram.com-20121126192244-og4wvaoc2074hmbw date: 2012-11-26 21:22:44 +0200 revno: 3591

I didn't get the assertion failure on 5.3, but valgrind warnings instead:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ==15870== Thread 4: ==15870== Conditional jump or move depends on uninitialised value(s) ==15870== at 0x671DEF: Field_timestamp::get_date(st_mysql_time*, unsigned int) (field.cc:4768) ==15870== by 0x5B593D: Item_field::get_date(st_mysql_time*, unsigned int) (item.cc:2342) ==15870== by 0x62A56B: Item_date_add_interval::get_date(st_mysql_time*, unsigned int) (item_timefunc.cc:1935) ==15870== by 0x5B010F: Item::save_date_in_field(Field*) (item.cc:370) ==15870== by 0x62ED6F: Item_temporal_func::save_in_field(Field*, bool) (item_timefunc.h:450) ==15870== by 0x73BA08: update_virtual_fields(THD*, st_table*, enum_vcol_update_mode) (table.cc:5854) ==15870== by 0x72790D: fill_record(THD*, List<Item>&, List<Item>&, bool) (sql_base.cc:8712) ==15870== by 0x727A1B: fill_record_n_invoke_before_triggers(THD*, List<Item>&, List<Item>&, bool, Table_triggers_list*, trg_event_type) (sql_base.cc:8757) ==15870== by 0x77DEAE: mysql_insert(THD*, TABLE_LIST*, List<Item>&, List<List<Item> >&, List<Item>&, List<Item>&, enum_duplicates, bool) (sql_insert.cc:808) ==15870== by 0x6C2568: mysql_execute_command(THD*) (sql_parse.cc:3238) ==15870== by 0x6CB692: mysql_parse(THD*, char*, unsigned int, char const**) (sql_parse.cc:6158) ==15870== by 0x6BD19F: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1228) ==15870== by 0x6BC4B3: do_command(THD*) (sql_parse.cc:923) ==15870== by 0x6B8F0C: handle_one_connection (sql_connect.cc:1218) ==15870== by 0x548BEFB: start_thread (pthread_create.c:304) ==15870== by 0x5F18F4C: clone (clone.S:112)
1 2 3 4 5 branch: maria/5.3 revision-id: sanja@montyprogram.com-20121205190600-fzhla1o8ecu3hf20 date: 2012-12-05 21:06:00 +0200 build-date: 2012-12-15 00:39:11 +0400 revno: 3606

And 5.2 also aborts with an assertion failure, a slightly different one:

1 2 mysqld: field.cc:1766: virtual int Field::store_time(MYSQL_TIME*, timestamp_type): Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field_index) || bitmap_is_set(table->vcol_set, field_index))' failed. 121215 0:36:36 [ERROR] mysqld got signal 6 ;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 #6 0x00007fd93c1a2d4d in __GI___assert_fail (assertion=0xc37c38 "!table || (!table->write_set || bitmap_is_set(table->write_set, field_index) || bitmap_is_set(table->vcol_set, field_index))", file=<optimized out>, line=1766, function=<optimized out>) at assert.c:81 #7 0x000000000062bbab in Field::store_time (this=0x2419250, ltime=0x7fd9334a6910, type_arg=MYSQL_TIMESTAMP_DATETIME) at field.cc:1766 #8 0x000000000058c836 in Item::save_date_in_field (this=0x24195e0, field=0x2419250) at item.cc:343 #9 0x0000000000601f3c in Item_date_func::save_in_field (this=0x24195e0, field=0x2419250, no_conversions=false) at item_timefunc.h:476 #10 0x00000000006ecc1f in update_virtual_fields (thd=0x2366048, table=0x23e4520, for_write=true) at table.cc:5537 #11 0x00000000006d9f8f in fill_record (thd=0x2366048, fields=..., values=..., ignore_errors=false) at sql_base.cc:8463 #12 0x00000000006da070 in fill_record_n_invoke_before_triggers (thd=0x2366048, fields=..., values=..., ignore_errors=false, triggers=0x0, event=TRG_EVENT_INSERT) at sql_base.cc:8507 #13 0x0000000000721d2c in mysql_insert (thd=0x2366048, table_list=0x23e3f90, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false) at sql_insert.cc:792 #14 0x00000000006807dd in mysql_execute_command (thd=0x2366048) at sql_parse.cc:3292 #15 0x00000000006897d2 in mysql_parse (thd=0x2366048, rawbuf=0x23e3e80 "INSERT DELAYED INTO t1 (tsv) VALUES (DEFAULT)", length=45, found_semicolon=0x7fd9334a7898) at sql_parse.cc:6201 #16 0x000000000067b3e9 in dispatch_command (command=COM_QUERY, thd=0x2366048, packet=0x23dab09 "INSERT DELAYED INTO t1 (tsv) VALUES (DEFAULT)", packet_length=45) at sql_parse.cc:1233 #17 0x000000000067a6ce in do_command (thd=0x2366048) at sql_parse.cc:920 #18 0x0000000000677542 in handle_one_connection (arg=0x2366048) at sql_connect.cc:1213 #19 0x00007fd93ccb1efc in start_thread (arg=0x7fd9334a8700) at pthread_create.c:304 #20 0x00007fd93c258f4d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
1 2 3 4 branch: maria/5.2 revision-id: timour@askmonty.org-20121109104912-hu5asxvn8ip8kuhg date: 2012-11-09 12:49:12 +0200 revno: 3186

Environment

None

Status

Assignee

Igor Babaev

Reporter

Elena Stepanova

Fix versions

Affects versions

10.0.0
5.5.28a
5.3.11
5.2.13

Priority

Major