mirror of
https://github.com/MariaDB/server.git
synced 2025-02-12 00:15:35 +01:00
![Marko Mäkelä](/assets/img/avatar_default.png)
As part of commit 685d958e38
(MDEV-14425)
the parameter innodb_log_write_ahead_size was removed, because it was
thought that determining the physical block size would be a sufficient
replacement.
However, we can only determine the physical block size on Linux or
Microsoft Windows. On some file systems, the physical block size
is not relevant. For example, XFS uses a block size of 4096 bytes
even if the underlying block size may be smaller.
On Linux, we failed to determine the physical block size if
innodb_log_file_buffered=OFF was not requested or possible.
This will be fixed.
log_sys.write_size: The value of the reintroduced parameter
innodb_log_write_ahead_size. To keep it simple, this is read-only
and a power of two between 512 and 4096 bytes, so that the previous
alignment guarantees are fulfilled. This will replace the previous
log_sys.get_block_size().
log_sys.block_size, log_t::get_block_size(): Remove.
log_t::set_block_size(): Ensure that write_size will not be less
than the physical block size. There is no point to invoke this
function with 512 or less, because that is the minimum value of
write_size.
innodb_params_adjust(): Add some disabled code for adjusting
the minimum value and default value of innodb_log_write_ahead_size
to reflect the log_sys.write_size.
log_t::set_recovered(): Mark the recovery completed. This is the
place to adjust some things if we want to allow write_size>4096.
log_t::resize_write_buf(): Refer to write_size.
log_t::resize_start(): Refer to write_size instead of get_block_size().
log_write_buf(): Simplify some arithmetics and remove a goto.
log_t::write_buf(): Refer to write_size. If we are writing less than
that, do not switch buffers, but keep writing to the same buffer.
Move some code to improve the locality of reference.
recv_scan_log(): Refer to write_size instead of get_block_size().
os_file_create_func(): For type==OS_LOG_FILE on Linux, always invoke
os_file_log_maybe_unbuffered(), so that log_sys.set_block_size() will
be invoked even if we are not attempting to use O_DIRECT.
recv_sys_t::find_checkpoint(): Read the entire log header
in a single 12 KiB request into log_sys.buf.
Tested with:
./mtr --loose-innodb-log-write-ahead-size=4096
./mtr --loose-innodb-log-write-ahead-size=2048
317 lines
11 KiB
Text
317 lines
11 KiB
Text
# Testcase for the following bugs
|
|
# Bug#16691130 - ASSERT WHEN INNODB_LOG_GROUP_HOME_DIR DOES NOT EXIST
|
|
# Bug#16418661 - CHANGING NAME IN FOR INNODB_DATA_FILE_PATH SHOULD NOT SUCCEED WITH LOG FILES
|
|
# Start mysqld without the possibility to create innodb_undo_tablespaces
|
|
# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
|
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
|
FOUND 1 /\[ERROR\] InnoDB: Could not create undo tablespace '.*undo002'/ in mysqld.1.err
|
|
# Remove undo001,undo002,ibdata1,ibdata2,ib_logfile101
|
|
# Start mysqld with non existent innodb_log_group_home_dir
|
|
# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend --innodb_log_group_home_dir=/path/to/non-existent/
|
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
|
FOUND 1 /Cannot create /path/to/non-existent/ib_logfile101/ in mysqld.1.err
|
|
# Successfully let InnoDB create tablespaces
|
|
# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
|
|
SELECT COUNT(*) `1` FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine='innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
1
|
|
1
|
|
# Backup tmp/logfile/*
|
|
# 1. With ibdata2, Without ibdata1
|
|
# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
|
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
|
FOUND 1 /The data file '.*ibdata1' was not found but one of the other data files '.*ibdata2' exists/ in mysqld.1.err
|
|
bak_ib_logfile0
|
|
bak_ibdata1
|
|
bak_ibdata2
|
|
bak_undo001
|
|
bak_undo002
|
|
bak_undo003
|
|
ib_buffer_pool
|
|
ib_logfile0
|
|
ibdata2
|
|
undo001
|
|
undo002
|
|
undo003
|
|
# 2. With ibdata1, without ibdata2
|
|
# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
|
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
|
FOUND 1 /InnoDB: Tablespace size stored in header is \d+ pages, but the sum of data file sizes is \d+ pages/ in mysqld.1.err
|
|
FOUND 1 /InnoDB: Cannot start InnoDB. The tail of the system tablespace is missing/ in mysqld.1.err
|
|
bak_ib_logfile0
|
|
bak_ibdata1
|
|
bak_ibdata2
|
|
bak_undo001
|
|
bak_undo002
|
|
bak_undo003
|
|
ib_buffer_pool
|
|
ib_logfile0
|
|
ibdata1
|
|
ibdata2
|
|
undo001
|
|
undo002
|
|
undo003
|
|
# 3. Without ibdata1 & ibdata2
|
|
bak_ib_logfile0
|
|
bak_ibdata1
|
|
bak_ibdata2
|
|
bak_undo001
|
|
bak_undo002
|
|
bak_undo003
|
|
ib_buffer_pool
|
|
ib_logfile0
|
|
undo001
|
|
undo002
|
|
undo003
|
|
# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
|
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
|
FOUND 1 /InnoDB: undo tablespace .*undo001.* exists\. Creating system tablespace with existing undo tablespaces is not supported\. Please delete all undo tablespaces before creating new system tablespace\./ in mysqld.1.err
|
|
bak_ib_logfile0
|
|
bak_ibdata1
|
|
bak_ibdata2
|
|
bak_undo001
|
|
bak_undo002
|
|
bak_undo003
|
|
ib_buffer_pool
|
|
ib_logfile0
|
|
undo001
|
|
undo002
|
|
undo003
|
|
# 4. Without ibdata*, ib_logfile* and with undo00*
|
|
bak_ib_logfile0
|
|
bak_ibdata1
|
|
bak_ibdata2
|
|
bak_undo001
|
|
bak_undo002
|
|
bak_undo003
|
|
ib_buffer_pool
|
|
undo001
|
|
undo002
|
|
undo003
|
|
# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
|
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
|
bak_ib_logfile0
|
|
bak_ibdata1
|
|
bak_ibdata2
|
|
bak_undo001
|
|
bak_undo002
|
|
bak_undo003
|
|
ib_buffer_pool
|
|
undo001
|
|
undo002
|
|
undo003
|
|
# 5. Without ibdata*,ib_logfile* files & Without undo002
|
|
bak_ib_logfile0
|
|
bak_ibdata1
|
|
bak_ibdata2
|
|
bak_undo001
|
|
bak_undo002
|
|
bak_undo003
|
|
ib_buffer_pool
|
|
undo001
|
|
undo003
|
|
# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
|
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
|
bak_ib_logfile0
|
|
bak_ibdata1
|
|
bak_ibdata2
|
|
bak_undo001
|
|
bak_undo002
|
|
bak_undo003
|
|
ib_buffer_pool
|
|
undo001
|
|
undo003
|
|
# 6. Without ibdata*,ib_logfile* files & Without undo001, undo002
|
|
bak_ib_logfile0
|
|
bak_ibdata1
|
|
bak_ibdata2
|
|
bak_undo001
|
|
bak_undo002
|
|
bak_undo003
|
|
ib_buffer_pool
|
|
undo003
|
|
# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
|
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
|
FOUND 1 /undo tablespace .*undo003.* exists\. Creating system tablespace with existing undo tablespaces is not supported\. Please delete all undo tablespaces before creating new system tablespace\./ in mysqld.1.err
|
|
bak_ib_logfile0
|
|
bak_ibdata1
|
|
bak_ibdata2
|
|
bak_undo001
|
|
bak_undo002
|
|
bak_undo003
|
|
ib_buffer_pool
|
|
undo003
|
|
# 7. With ibdata files & Without undo002
|
|
bak_ib_logfile0
|
|
bak_ibdata1
|
|
bak_ibdata2
|
|
bak_undo001
|
|
bak_undo002
|
|
bak_undo003
|
|
ib_buffer_pool
|
|
ib_logfile0
|
|
ibdata1
|
|
ibdata2
|
|
undo001
|
|
undo003
|
|
# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
|
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
|
FOUND 1 /InnoDB: Failed to open the undo tablespace/ in mysqld.1.err
|
|
bak_ib_logfile0
|
|
bak_ibdata1
|
|
bak_ibdata2
|
|
bak_undo001
|
|
bak_undo002
|
|
bak_undo003
|
|
ib_buffer_pool
|
|
ib_logfile0
|
|
ibdata1
|
|
ibdata2
|
|
undo001
|
|
undo003
|
|
# 8. With ibdata files & Without undo001, undo002
|
|
bak_ib_logfile0
|
|
bak_ibdata1
|
|
bak_ibdata2
|
|
bak_undo001
|
|
bak_undo002
|
|
bak_undo003
|
|
ib_buffer_pool
|
|
ib_logfile0
|
|
ibdata1
|
|
ibdata2
|
|
undo003
|
|
# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
|
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
|
FOUND 2 /InnoDB: Failed to open the undo tablespace/ in mysqld.1.err
|
|
bak_ib_logfile0
|
|
bak_ibdata1
|
|
bak_ibdata2
|
|
bak_undo001
|
|
bak_undo002
|
|
bak_undo003
|
|
ib_buffer_pool
|
|
ib_logfile0
|
|
ibdata1
|
|
ibdata2
|
|
undo003
|
|
# 9. Without ibdata*, without undo*
|
|
bak_ib_logfile0
|
|
bak_ibdata1
|
|
bak_ibdata2
|
|
bak_undo001
|
|
bak_undo002
|
|
bak_undo003
|
|
ib_buffer_pool
|
|
ib_logfile0
|
|
# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
|
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
|
FOUND 1 /redo log file .*ib_logfile0.* exists\. Creating system tablespace with existing redo log file is not recommended\. Please delete redo log file before creating new system tablespace\./ in mysqld.1.err
|
|
bak_ib_logfile0
|
|
bak_ibdata1
|
|
bak_ibdata2
|
|
bak_undo001
|
|
bak_undo002
|
|
bak_undo003
|
|
ib_buffer_pool
|
|
ib_logfile0
|
|
# 10. With ibdata*, without ib_logfile0
|
|
# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
|
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
|
bak_ib_logfile0
|
|
bak_ibdata1
|
|
bak_ibdata2
|
|
bak_undo001
|
|
bak_undo002
|
|
bak_undo003
|
|
ib_buffer_pool
|
|
ibdata1
|
|
ibdata2
|
|
undo001
|
|
undo002
|
|
undo003
|
|
# 11. With ibdata*
|
|
bak_ib_logfile0
|
|
bak_ibdata1
|
|
bak_ibdata2
|
|
bak_undo001
|
|
bak_undo002
|
|
bak_undo003
|
|
ib_buffer_pool
|
|
ib_logfile0
|
|
ibdata1
|
|
ibdata2
|
|
undo001
|
|
undo002
|
|
undo003
|
|
# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
|
|
SELECT COUNT(*) `1` FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine='innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
1
|
|
1
|
|
# restart: --innodb-log-write-ahead-size=513
|
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
|
# restart: --innodb-log-write-ahead-size=4095
|
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
|
# restart: --innodb-log-write-ahead-size=10000
|
|
SELECT @@innodb_log_write_ahead_size;
|
|
@@innodb_log_write_ahead_size
|
|
4096
|
|
# Cleanup
|
|
bak_ib_logfile0
|
|
bak_ibdata1
|
|
bak_ibdata2
|
|
bak_undo001
|
|
bak_undo002
|
|
bak_undo003
|
|
ib_buffer_pool
|
|
ib_logfile0
|
|
ibdata1
|
|
ibdata2
|
|
undo001
|
|
undo002
|
|
undo003
|