Michael Widenius via developers <developers@lists.mariadb.org> writes:

> MDEV-31273: Refactor MYSQL_BIN_LOG::write_cache()

>>    if (likely(length > LOG_EVENT_HEADER_LEN))

<snip>

> The above can be replaced with:
>
>     if (my_b_read(cache, header, LOG_EVENT_HEAD_LENGTH))
>       goto error_in_read;

Agree, that's better, done.

> If needed, you can als find out how much data left to read from IO_CACHE:
>
> left_data_to_read= (cache->end_of_file - my_b_tell(cache))

Yes, used that instead.

>     /* Write the rest of the event. */
>>     while (ev_len > 0)
>>     {
>>       if (length == 0)
>>           length= my_b_fill(cache);
>>         if (!length)
>>           goto error_in_read;
>>
>
> ->
>      while (ev_len > 0)
>      {
>        if (length == 0)
>        {
>          if (!(length= my_b_fill(cache)));
>            goto error_in_read;
>        }

Done.

> uint chunk= std::min(ev_len, (uint)length);
>
> I would have prefer to have MY_MIN() used (like the rest of the code).

Done.

Thanks for review, good that you spottet the simplification of simply using
my_b_read().

 - Kristian.
_______________________________________________
developers mailing list -- developers@lists.mariadb.org
To unsubscribe send an email to developers-le...@lists.mariadb.org

Reply via email to