Commit 505c1c55 authored by Kristian Nielsen's avatar Kristian Nielsen

MDEV-34705: Binlog in Engine: Fix losing last part of event group > trx cache in-memory buffer

Signed-off-by: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
parent 7537854b
......@@ -4150,6 +4150,22 @@ void fsp_binlog_write_cache(IO_CACHE *cache, size_t main_size, mtr_t *mtr)
*/
size_t remain= my_b_tell(cache);
ut_ad(remain > main_size);
if (cache->pos_in_file > 0) {
/*
ToDo: A limitation in mysys IO_CACHE. If I change (reinit_io_cache())
the cache from WRITE_CACHE to READ_CACHE without seeking out of the
current buffer, then the cache will not be flushed to disk (which is
good for small cache that fits completely in buffer). But then if I
later my_b_seek() or reinit_io_cache() it again and seek out of the
current buffer, the buffered data will not be flushed to the file
because the cache is now a READ_CACHE! The result is that the end of the
cache will be lost if the cache doesn't fit in memory.
So for now, have to do this somewhat in-elegant conditional flush
myself.
*/
flush_io_cache(cache);
}
/* Start with the GTID event, which is put at the end of the IO_CACHE. */
my_bool res= reinit_io_cache(cache, READ_CACHE, main_size, 0, 0);
ut_a(!res /* ToDo: Error handling. */);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment