[MDEV-15614] Item_direct_view created in statement memory and rolled back Created: 2018-03-21  Updated: 2018-03-21

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Oleksandr Byelkin Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-15492 Subquery crash similar to MDEV-10050 Closed

 Description   

There is following hack:

      // in PS use own arena or data will be freed after prepare
      if (register_tree_change &&
          thd->stmt_arena->is_stmt_prepare_or_first_stmt_execute())
        arena= thd->activate_stmt_arena_if_needed(&backup);

Which create rolled back view reference items but in persistent memory.

It used (for example) by semijoin expression constructor:

  /*
      Create Item_func_eq. Note that
      1. this is done on the statement, not execution, arena
      2. if it's a PS then this happens only once - on the first execution.
         On following re-executions, the item will be fix_field-ed normally.
      3. Thus it should be created as if it was fix_field'ed, in particular
         all pointers to items in the execution arena should be protected
         with thd->change_item_tree
    */
    Item_func_eq *item_eq=
      new Item_func_eq(subq_pred->left_expr_orig, subq_lex->ref_pointer_array[0]);
    if (!item_eq)
      DBUG_RETURN(TRUE);
    if (subq_pred->left_expr_orig != subq_pred->left_expr)
      thd->change_item_tree(item_eq->arguments(), subq_pred->left_expr);
    item_eq->in_equality_no= 0;
    sj_nest->sj_on_expr= and_items(sj_nest->sj_on_expr, item_eq);

where right part of equality will never rolled back correctly but just will use persistent Item.

This rolling back was made by historically and is not needed any more so can be removed.


Generated at Thu Feb 08 08:22:43 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.