WL#7050: InnoDB: Refactor redo log write code for better performance
One of the very performance critical function in inndob code is log_write_up_to(). This function writes to redo log files upto a certain LSN and also optionally flushes the writes to the disk. This WL is about squeezing some extra performance out of this function without any major architectural change. It attempts to re-write this code removing extra bits needed if we have multiple log groups (currently we only support one log group). It also removes an extra event which was probably never used but was always reset while holding the log_sys::mutex. Finally we remove an extra acquisition of log_sys::mutex in case where we are just doing write (no flush requested). This WL should improve the performance for any workload that is heavily contended on log_sys::mutex and for which innodb_flush_log_at_trx_commit = 2.
In log_write_up_to(): * Remove wait mode. We always wait with one exception. And that is when doing log sync from master thread. It makes that synchronous as well because that happens only once per second. * Because we only have one log group therefore we don't need two flush_events. * Remove unnecessary fields like written_to_some_lsn, written_to_all_lsn. * If only write is requested we don't have to acquire the log_sys::mutex after we release it. We currently do that only to do event handling but event handling is really only needed in case where flush is requested i.e.: a thread should be waiting on the event iff it is interested in flushing. Writes are serialized under log_sys::mutex.
Copyright (c) 2000, 2021, Oracle Corporation and/or its affiliates. All rights reserved.