diff options
author | Monty <monty@mariadb.org> | 2019-03-25 15:57:00 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2019-04-01 19:47:24 +0300 |
commit | adb70162144857f898cb532ad7dda3f2705ada02 (patch) | |
tree | 4d0d4212b4b10a19e6baf22158c99113b4cf1b7a /mysys/mf_iocache.c | |
parent | e3bffd579f4a1bf8e08dc714971729faeb371f63 (diff) | |
download | mariadb-git-adb70162144857f898cb532ad7dda3f2705ada02.tar.gz |
MDEV-19117 Don't keep binary log index file locked during show binary logs
On some systems with 10,000+ binlogs, show binary logs could block
log rotation for more than 10 seconds.
This patch fixes this by first caching all binary log names and
releases all mutexes while calculating the sizes of the binary logs.
Other things:
- Ensure that reinit_io_cache() sets end_of_file when moving to read_cache.
This ensures that external changes of the underlying file is known to
the cache.
- get_binlog_list() is made more efficent and show_binlogs() is changed
to call get_binlog_list()
Reviewed by Andrei Elkin
Diffstat (limited to 'mysys/mf_iocache.c')
-rw-r--r-- | mysys/mf_iocache.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index 3794d2fe4dc..b1f67375903 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -496,10 +496,17 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type, { /* If we change from WRITE_CACHE to READ_CACHE, assume that everything - after the current positions should be ignored + after the current positions should be ignored. In other cases we + update end_of_file as it may have changed since last init. */ - if (info->type == WRITE_CACHE && type == READ_CACHE) - info->end_of_file=my_b_tell(info); + if (type == READ_CACHE) + { + if (info->type == WRITE_CACHE) + info->end_of_file= my_b_tell(info); + else + info->end_of_file= mysql_file_seek(info->file, 0L, MY_SEEK_END, + MYF(0)); + } /* flush cache if we want to reuse it */ if (!clear_cache && my_b_flush_io_cache(info,1)) DBUG_RETURN(1); |