← Back to team overview

maria-developers team mailing list archive

Re: c5ce597f06a: MDEV-31043 ER_KEY_NOT_FOUND upon concurrent ALTER and transaction

 

Hi, Nikita,

On May 04, Nikita Malyavin wrote:
> See my new commit b804bcbc6

You forgot to address the following:

>      if (do_commit)
>      {
> -      // do not set STMT_END for last event to leave table open in altering thd
> -      error= binlog_flush_pending_rows_event(thd, false, true, binlog, &cache);
> -      if (is_ending_transaction)
> +      /*
> +        If the cache wasn't reinited to write, then it remains empty after
> +        the last write.
> +      */
> +      if (cache.cache_log.type != READ_CACHE && !error)

this is a confusing new condition. are you trying to avoid locking a
mutex for an empty cache? If yes, you can check my_b_bytes_in_cache(),
that'd be more clear.

>        {
>          mysql_mutex_lock(binlog->get_log_lock());
>          error= binlog->write_cache(thd, &cache.cache_log);
>          mysql_mutex_unlock(binlog->get_log_lock());
>        }
> -      else
> -        cache.store_prev_position();
>      }
> -    else if (!is_ending_transaction)
> +    else if (!commit) // rollback
> +    {
>        cache.restore_prev_position();
> +    }
> +    else

add // trans engine, end of statement

> +    {
> +      DBUG_ASSERT(!is_ending_transaction);
> +      cache.store_prev_position();
> +    }

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


Follow ups

References