Commit 0552ed86 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 61b2cd38
......@@ -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;
......@@ -7040,7 +7040,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);
......@@ -7048,6 +7047,7 @@ void TABLE::mark_columns_needed_for_update()
mark_default_fields_for_write(FALSE);
if (vfield)
need_signal|= mark_virtual_columns_for_write(FALSE);
mark_columns_per_binlog_row_image();
if (file->ha_table_flags() & HA_REQUIRES_KEY_COLUMNS_FOR_DELETE)
{
KEY *end= key_info + s->keys;
......@@ -7132,7 +7132,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)
{
......@@ -7152,6 +7151,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