← Back to team overview

maria-developers team mailing list archive

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

 

Hi, Sachin!

On May 31, Sachin wrote:
> revision-id: fab8349af86 (mariadb-10.4.11-223-gfab8349af86)
> parent(s): 61b2cd38d48
> author: Sachin <sachin.setiya@xxxxxxxxxxx>
> committer: Sachin <sachin.setiya@xxxxxxxxxxx>
> timestamp: 2020-05-29 11:56:45 +0530
> message:
> 
> MDEV-21804 Assertion `marked_for_read()' failed upon INSERT into table with long unique blob under binlog_row_image=NOBLOB
> 
> Problem:-
>   In the case of BINLOG_ROW_IMAGE_NOBLOB table->readset is PKE + non blob fields
>   But while updating virtual fields we need to read the blob field, which will
>   generate assert failure.
> Solution:-
>   If binlog_row_image == NOBLOB, then set read_bit for the blob field.
> 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)));
> 
> diff --git a/sql/field.cc b/sql/field.cc
> index 0a8fdc3d3f5..bcad056e76a 100644
> --- a/sql/field.cc
> +++ b/sql/field.cc
> @@ -8467,6 +8467,10 @@ longlong Field_blob::val_int(void)
>  String *Field_blob::val_str(String *val_buffer __attribute__((unused)),
>  			    String *val_ptr)
>  {
> +  ulong binlog_row_image= table->in_use->variables.binlog_row_image;
> +  if (table->read_set && !bitmap_is_set(table->read_set, field_index) &&
> +          binlog_row_image == BINLOG_ROW_IMAGE_NOBLOB)
> +    bitmap_set_bit(table->read_set, field_index);
>    DBUG_ASSERT(marked_for_read());
>    char *blob;
>    memcpy(&blob, ptr+packlength, sizeof(char*));

A couple of red flags here.

First, you don't fix BINLOG_ROW_IMAGE_MINIMAL.

And generally you should not modify read/write sets from val_str,
if should be done earlier before the execution phase.

Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx