Bug #109121 add my_b_bytes_in_cache in IO_CACHE_binlog_cache_storage::next before my_b_fill
Submitted: 17 Nov 2022 11:31 Modified: 19 Dec 2022 12:50
Reporter: bin wang (OCA) Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Utilities: Binlog Events Severity:S3 (Non-critical)
Version:Ver 8.0 OS:Any
Assigned to: CPU Architecture:Any

[17 Nov 2022 11:31] bin wang
Description:
In  IO_CACHE_binlog_cache_storage::next 
my_b_fill(&m_io_cache) will be called , no matter m_io_cache is all used or not
 when m_io_cache is not all used, my_b_bytes_in_cache(&m_io_cache)is not 0, not call my_b_fill(&m_io_cache) will be better.

How to repeat:
add  
if (my_b_bytes_in_cache(&m_io_cache) == 0) my_b_fill(&m_io_cache);

Suggested fix:
bool IO_CACHE_binlog_cache_storage::next(unsigned char **buffer,
                                         my_off_t *length) {
--  my_b_fill(&m_io_cache);
++  if (my_b_bytes_in_cache(&m_io_cache) == 0) my_b_fill(&m_io_cache);

  *buffer = m_io_cache.read_pos;
  *length = my_b_bytes_in_cache(&m_io_cache);

  m_io_cache.read_pos = m_io_cache.read_end;

  return m_io_cache.error;
}
[17 Nov 2022 11:32] bin wang
suggested add  patch

Attachment: binlog_ostream.patch (application/octet-stream, text), 480 bytes.

[17 Nov 2022 13:08] MySQL Verification Team
Hi Mr. wang,

Thank you for your bug report.

We fully understand the logic behind your patch, but we do have one small problem with it. We do have problem of adding code that will always return false or true, for the condition.

So far, nobody of us and nobody of our customers has managed to reach the situation in which  m_io_cache is all used up.

Would you, please, be so kind and give us a test case where this cache is all used up, while it setting is at the recommended levels.

Many thanks in advance.
[17 Nov 2022 13:10] MySQL Verification Team
Also, 

You have chosen a category of "MySQL Utilities", while this code evidently belongs to the server.
[18 Dec 2022 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".