← Back to team overview

maria-developers team mailing list archive

Re: d5352b8154d: MDEV-20015 Assertion `!in_use->is_error()' failed in TABLE::update_virtual_field

 

Hi, Aleksey!

On Oct 25, Aleksey Midenkov wrote:
> revision-id: d5352b8154d (mariadb-10.2.25-54-gd5352b8154d)
> parent(s): 1153950ad0a
> author: Aleksey Midenkov <midenok@xxxxxxxxx>
> committer: Aleksey Midenkov <midenok@xxxxxxxxx>
> timestamp: 2019-07-22 15:40:06 +0300
> message:
> 
> MDEV-20015 Assertion `!in_use->is_error()' failed in TABLE::update_virtual_field
> 
> Preserve and restore statement DA.

This is strange. Diagnostics areas aren't supposed to be temporarily
created on the frame, they aren't arenas.

Why TABLE::update_virtual_field() is called at all if there's already
an error?

> diff --git a/sql/table.cc b/sql/table.cc
> index f5b5bad99cc..65611d78bde 100644
> --- a/sql/table.cc
> +++ b/sql/table.cc
> @@ -7682,15 +7682,25 @@ int TABLE::update_virtual_fields(handler *h, enum_vcol_update_mode update_mode)
>  
>  int TABLE::update_virtual_field(Field *vf)
>  {
> -  DBUG_ASSERT(!in_use->is_error());
> +  Diagnostics_area *stmt_da= NULL;
> +  Diagnostics_area tmp_stmt_da(in_use->query_id, false, true);
> +  bool error;
>    Query_arena backup_arena;
>    DBUG_ENTER("TABLE::update_virtual_field");
> +  if (unlikely(in_use->is_error()))
> +  {
> +    stmt_da= in_use->get_stmt_da();
> +    in_use->set_stmt_da(&tmp_stmt_da);
> +  }
>    in_use->set_n_backup_active_arena(expr_arena, &backup_arena);
>    bitmap_clear_all(&tmp_set);
>    vf->vcol_info->expr->walk(&Item::update_vcol_processor, 0, &tmp_set);
>    vf->vcol_info->expr->save_in_field(vf, 0);
>    in_use->restore_active_arena(expr_arena, &backup_arena);
> -  DBUG_RETURN(in_use->is_error());
> +  error= in_use->is_error();
> +  if (stmt_da)
> +    in_use->set_stmt_da(stmt_da);
> +  DBUG_RETURN(error);
>  }

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


Follow ups