Commit e208f91b authored by Sachin's avatar Sachin

MDEV-21804 Assertion `marked_for_read()' failed upon INSERT into table with...

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

Problem:- Calling mark_columns_per_binlog_row_image() earlier may change the
result of mark_virtual_columns_for_write() , Since it can set the bitmap on
for virtual column, and henceforth  mark_virtual_column_deps(field) will
never be called in mark_virtual_column_with_deps.

This bug is not specific for long unique, It also fails for this case
   create table t2(id int primary key, a blob, b varchar(20) as (LEFT(a,2)));
parent c7a2fb1e
......@@ -270,3 +270,10 @@ ERROR 42000: Specified key was too long; max key length is 1000 bytes
create table t1(a int, unique(a) using hash);
#BULK insert > 100 rows (MI_MIN_ROWS_TO_DISABLE_INDEXES)
drop table t1;
SET binlog_row_image= NOBLOB;
CREATE TABLE t1 (pk INT PRIMARY KEY, a text ,UNIQUE(a) using hash);
INSERT INTO t1 VALUES (1,'foo');
create table t2(id int primary key, a blob, b varchar(20) as (LEFT(a,2)));
INSERT INTO t2 VALUES (1, 'foo', default);
DROP TABLE t1, t2;
SET binlog_row_image= FULL;
......@@ -340,3 +340,19 @@ while ($count)
--eval $insert_stmt
--enable_query_log
drop table t1;
#
# MDEV-21804 Assertion `marked_for_read()' failed upon INSERT into table with long unique blob under binlog_row_image=NOBLOB
#
--source include/have_binlog_format_row.inc
SET binlog_row_image= NOBLOB;
CREATE TABLE t1 (pk INT PRIMARY KEY, a text ,UNIQUE(a) using hash);
INSERT INTO t1 VALUES (1,'foo');
create table t2(id int primary key, a blob, b varchar(20) as (LEFT(a,2)));
INSERT INTO t2 VALUES (1, 'foo', default);
# Cleanup
DROP TABLE t1, t2;
SET binlog_row_image= FULL;
......@@ -7039,7 +7039,6 @@ void TABLE::mark_columns_needed_for_update()
DBUG_ENTER("TABLE::mark_columns_needed_for_update");
bool need_signal= false;
mark_columns_per_binlog_row_image();
if (triggers)
triggers->mark_fields_used(TRG_EVENT_UPDATE);
......@@ -7115,6 +7114,7 @@ void TABLE::mark_columns_needed_for_update()
bitmap_union(read_set, write_set);
need_signal= true;
}
mark_columns_per_binlog_row_image();
if (need_signal)
file->column_bitmaps_signal();
DBUG_VOID_RETURN;
......@@ -7131,7 +7131,6 @@ void TABLE::mark_columns_needed_for_update()
void TABLE::mark_columns_needed_for_insert()
{
DBUG_ENTER("mark_columns_needed_for_insert");
mark_columns_per_binlog_row_image();
if (triggers)
{
......@@ -7151,6 +7150,7 @@ void TABLE::mark_columns_needed_for_insert()
/* Mark virtual columns for insert */
if (vfield)
mark_virtual_columns_for_write(TRUE);
mark_columns_per_binlog_row_image();
if (check_constraints)
mark_check_constraint_columns_for_read();
DBUG_VOID_RETURN;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment