summaryrefslogtreecommitdiff
path: root/sql-bench/example
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-03-02 16:53:04 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2022-03-02 16:53:04 +0200
commit177345dadc9250387343164be0053b1952fc59c1 (patch)
tree380b4db75013cd10e6f28d97aebd7cde46c7c64b /sql-bench/example
parent24a1795d5bd5935f30372b6b1a9c1cbc0505c181 (diff)
downloadmariadb-git-177345dadc9250387343164be0053b1952fc59c1.tar.gz
MDEV-27812 Allow SET GLOBAL innodb_log_file_size
We support online log resizing by replicating the current ib_logfile0 to a new file ib_logfile101, which will eventually replace the ib_logfile0 on the first applicable log checkpoint. Unless the log is located in a persistent memory file system (PMEM), an attempt to SET GLOBAL innodb_log_file_size to less than innodb_log_buffer_size will be refused. (With PMEM, a.k.a. mmap() based log, that parameter has no meaning.) Should the server be killed while the log was being resized, both files ib_logfile0 and ib_logfile101 may exist on startup, and since commit 3b06415cb8dfc2b10d9604950f6ed945bc016425 the extra file ib_logfile101 will be removed. We will initiate checkpoint flushing by invoking buf_flush_ahead(), to let buf_flush_page_cleaner() write out pages until the buf_flush_async_lsn target has been reached. On a log checkpoint, if the new checkpoint LSN is not older than log_sys.resize_lsn (the start LSN of the ib_logfile101), we can switch files and complete the log resizing. Else, we will attempt to switch files on the next checkpoint. Log resizing can be aborted by killing the connection that is executing the SET GLOBAL statement. If the ib_logfile101 wraps around to the beginning, we must advance the log_sys.resize_lsn. In the resized log file, the sequence bit will always be written as 1 (no wrap-around). The log will be duplicated in log_t::resize_write(), invoked by mtr_t::finish_write(). When the log is being written via system calls (not PMEM), the initial log_sys.resize_lsn is the current log_sys.first_lsn, plus an integer multiple of log_sys.block_size, corresponding to the LSN at the start of the block that was written by log_sys.write_lsn. The log_sys.resize_buf will be of the same size as the log_sys.buf. During resizing, the contents of log_sys.buf and log_sys.resize_buf will be identical, except that the sequence bit of each mini-transaction will always be 1 in log_sys.resize_buf. If resizing is in progress, log_t::write_buf() will write log_sys.resize_buf to log_sys.resize_log (ib_logfile101). If the file would wrap around, the buffer will be written to log_sys.START_OFFSET and the log_sys.resize_lsn advanced accordingly. When using mmap() on /dev/shm or a PMEM mount -o dax file system, the initial log_sys.resize_lsn will be the log_sys.lsn at the time the resizing is initiated. If the log file wraps around during resizing, then the log_sys.resize_lsn will be advanced by (log_sys.resize_target - log_sys.START_OFFSET). log_t::resize_start(), log_t::resize_abort(), log_t::write_checkpoint(): Unless the log is mmap() based, acquire flush_lock and write_lock. In any case, acquire exclusive log_sys.latch to prevent race conditions. log_t::resize_rename(): Renamed from log_t::rename_resized(), and moved some code to the previous sole caller srv_start(). Thanks to Vladislav Vaintroub for helpful review comments and to Matthias Leich for testing this, in particular, testing crash recovery, multiple concurrent SET GLOBAL innodb_log_file_size and frequently killed connections.
Diffstat (limited to 'sql-bench/example')
0 files changed, 0 insertions, 0 deletions