1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00

MDEV-37949: Implement innodb_log_archive

The InnoDB write-ahead log file in the old innodb_log_archive=OFF
format is named ib_logfile0, pre-allocated to innodb_log_file_size and
written as a ring buffer. This is good for write performance and space
management, but unsuitable for arbitrary point-in-time recovery or for
facilitating efficient incremental backup.

innodb_log_archive=ON: A new format where InnoDB will create and
preallocate files ib_%016x.log, instead of writing a circular file
ib_logfile0. Each file will be pre-allocated to innodb_log_file_size.
Once a log fills up, we will create and pre-allocate another log file,
to which log records will be written.  Upon the completion of the first
log checkpoint in a recently created log file, the old log file will
be marked read-only, signaling that there will be no further writes to
that file, and that the file may safely be moved to long-term storage.

The file name includes the log sequence number (LSN) at file offset
12288 (log_t::START_OFFSET). Each checkpoint is identified by storing
a 64-bit big-endian offset into an optional sequence of FILE_MODIFY
records followed by a FILE_CHECKPOINT record, between 12288 and the
end of the file.

The innodb_encrypt_log format is identified by storing the encryption
information at the start of the log file. The first 64-bit value will
be 1, which is an invalid checkpoint offset. Each
innodb_log_archive=ON log must use the same encryption parameters.
Changing innodb_encrypt_log or related parameters is only possible by
setting innodb_log_archive=OFF and restarting the server, which will
permanently lose the history of the archived log.

The maximum number of log checkpoints that the innodb_log_archive=ON
file header can represent is limited to 12288/8=1536 when using
innodb_encrypt_log=OFF. If we run out of slots in a log file, each
subsequently completed checkpoint in that log file will overwrite the
last slot in the checkpoint header, until we switch to the next log.

innodb_log_recovery_start: The checkpoint LSN to start recovery from.
This will be useful when recovering from an archived log. This is useful
for restoring an incremental backup (applying InnoDB log files that were
copied since the previous restore).

innodb_log_recovery_target: The requested LSN to end recovery at.
When this is set, all persistent InnoDB tables will be read-only, and
no writes to the log are allowed. The intended purpose of this setting
is to prepare an incremental backup, as well as to allow data
retrieval as of a particular logical point of time.

Setting innodb_log_recovery_target>0 is much like setting
innodb_read_only=ON, with the exception that the data files may be
written to by crash recovery, and locking reads will conflict with any
incomplete transactions as necessary, and all transaction isolation
levels will work normally (not hard-wired to READ UNCOMMITTED).

srv_read_only_mode: When this is set (innodb_read_only=ON), also
recv_sys.rpo (innodb_log_recovery_target) will be set to the current LSN.
This ensures that it will suffice to check only one of these variables
when blocking writes to persistent tables.

The status variable innodb_lsn_archived will reflect the LSN
since when a complete InnoDB log archive is available. Its initial
value will be that of the new parameter innodb_log_archive_start.
If that variable is 0 (the default), the innodb_lsn_archived will
be recovered from the available log files. If innodb_log_archive=OFF,
innodb_lsn_archived will be adjusted to the latest checkpoint every
time a log checkpoint is executed. If innodb_log_archive=ON, the value
should not change.

SET GLOBAL innodb_log_archive=!@@GLOBAL.innodb_log_archive will take
effect as soon as possible, possibly after a log checkpoint has been
completed. The log file will be renamed between ib_logfile0 and
ib_%016x.log as appropriate.

When innodb_log_archive=ON, the setting SET GLOBAL innodb_log_file_size
will affect subsequently created log files when the file that is being
currently written is running out. If we are switching log files exactly
at the same time, then a somewhat misleading error message
"innodb_log_file_size change is already in progress" will be issued.

no_checkpoint_prepare.inc: A new file, to prepare for subsequent
inclusion of no_checkpoint_end.inc. We will invoke the server to
parse the log and to determine the latest checkpoint.

All --suite=encryption tests that use innodb_encrypt_log
will be skipped for innodb_log_archive=ON, because enabling
or disabling encryption on the log is not possible without
temporarily setting innodb_log_archive=OFF and restarting
the server. The idea is to add the following arguments to an
invocation of mysql-test/mtr:

--mysqld=--loose-innodb-log-archive \
--mysqld=--loose-innodb-log-recovery-start=12288 \
--mysqld=--loose-innodb-log-file-mmap=OFF \
--skip-test=mariabackup

Alternatively, specify --mysqld=--loose-innodb-log-file-mmap=ON
to cover both code paths.

The mariabackup test suite must be skipped when using the
innodb_log_archive=ON format, because mariadb-backup will only
support the old ib_logfile0 format (innodb_log_archive=OFF).

A number of tests would fail when the parameter
innodb_log_recovery_start=12288 is present, which is forcing
recovery to start from the beginning of the history
(the database creation). The affected tests have been adjusted with
explicit --innodb-log-recovery-start=0 to override that:

(0) Some injected corruption may be "healed" by replaying the log
from the beginning. Some tests expect an empty buffer pool after
a restart, with no page I/O due to crash recovery.
(1) Any test that sets innodb_read_only=ON would fail with an error
message that the setting prevents crash recovery, unless
innodb_log_recovery_start=0.
(2) Any test that changes innodb_undo_tablespaces would fail in crash
recovery, because crash recovery assumes that the undo tablespace ID
that is available from the undo* files corresponds with the start of
the log. This is an unforunate design bug which we cannot fix easily.

log_sys.first_lsn: The start of the current log file, to be consulted
in log_t::write_checkpoint() when renaming files.

log_sys.archived_lsn: New field: The value of innodb_lsn_archived.

log_sys.end_lsn: New field: The log_sys.get_lsn() when the latest
checkpoint was initiated. That is, the start LSN of a possibly empty
sequence of FILE_MODIFY records followed by FILE_CHECKPOINT.

log_sys.resize_target: The value of innodb_log_file_size that will be
used for creating the next archive log file once the current file (of
log_sys.file_size) fills up.

log_sys.archive: New field: The value of innodb_log_archive.

log_sys.next_checkpoint_no: Widen to uint16_t. There may be up to
12288/8=1536 checkpoints in the header.

log_sys.log: If innodb_log_archive=ON, this file handle will be kept
open also in the PMEM code path.

log_sys.resize_log: If innodb_log_archive=ON, we may have two log
files open both during normal operation and when parsing the log. This
will store the other handle (old or new file).

log_sys.resize_buf: In the memory-mapped code path, this will point
to the file resize_log when innodb_log_archive=ON.

recv_sys.log_archive: All innodb_log_archive=ON files that will be
considered in recovery.

recv_sys.was_archive: A flag indicating that an innodb_log_archive=ON
file is in innodb_log_archive=OFF format.

log_sys.is_pmem, log_t::is_mmap_writeable(): A new predicate.
If is_mmap_writeable(), we assert and guarantee buf_size == capacity().

log_t::checkpoint_age_max(): Return the maximum checkpoint age.
When innodb_log_archive=ON the limit is innodb_log_file_size larger.

log_t::archive_new_write(): Create and allocate a new log file, and
write the outstanding data to both the current and the new file, or
only to the new file, until write_checkpoint() completes the first
checkpoint in the new file. If the log file would overflow,
increase innodb_log_file_size to the next multiple of 4096 bytes.

log_t::archive_create(bool): Create and allocate an archive log file.
On POSIX, ensure that we get the exact correct file size by invoking
ftruncate() on POSIX, because os_file_set_size() would only
truncate files on Microsoft Windows.  Remember the file handle
of the current log in resize_log, so that write_checkpoint() will be
able to make it read-only.

log_t::archived_mmap_switch_prepare(): Invoke archive_create() unless
another thread already did it.

log_t::archived_mmap_switch_complete(): Switch to the buffer that was
created in log_t::archived_mmap_switch_prepare(). Remember the old
log_sys.buf in log_sys.checkpoint_buf, to be unmapped in
log_t::write_checkpoint().

buf_flush_archive_create(): Create a spare archive log file if needed.

buf_flush_page_cleaner(): Invoke buf_flush_archive_create() about
one second after a checkpoint where we switched archived log files.
This allows any writer threads to resume activity after we completed
the previous checkpoint.

log_t::write_checkpoint(): Allow an old checkpoint to be completed in
the old log file even after a new one has been created. If we are
writing the first checkpoint in a new log file, we will mark the old
log file read-only. We will also update log_sys.first_lsn unless it
was already updated in ARCHIVED_MMAP code path. In that code path,
there is the special case where log_sys.resize_buf == nullptr and
log_sys.checkpoint_buf points to log_sys.resize_log (the old log file
that is about to be made read-only). In this case, log_sys.first_lsn
will already point to the start of the current log_sys.log, even
though the switch has not been fully completed yet.
Try to preallocate the next archive file if needed, with the goal that
when we need the file it will already be ready for use.

log_t::write_checkpoint(), log_checkpoint_low(), log_checkpoint(),
buf_flush_sync_for_checkpoint(): Return the LSN on which to invoke
archive_create(), or 0 if no spare archive log file needs to be created.

log_t::header_rewrite(my_bool): Rewrite the log file header before or
after renaming the log file, and write a message about the change,
so that there will be a chance to recover in case the server is being
killed during this operation.  The recovery of the last ib_%016%.log
does tolerate also the ib_logfile0 format.

log_t::set_archive(my_bool,THD): Implement SET GLOBAL innodb_log_archive.
An error will be returned if non-archived SET GLOBAL innodb_log_file_size
(log file resizing) is in progress. Wait for checkpoint if necessary.
The current log file will be renamed to either ib_logfile0 or
ib_%016x.log, as appropriate. In SET GLOBAL innodb_log_archive=OFF,
we trigger a write-ahead of the log if necessary, to prevent overrun.

log_t::archive_rename(): Rename an archived log to ib_logfile0 on recovery
in case there had been a crash during set_archive().

log_t::archive_set_size(): A new function, to ensure that
log_sys.resize_target is set on startup.

log_checkpoint_low(): Do not prevent a checkpoint at the start of a file.
We want the first innodb_log_archive=ON file to start with a checkpoint.

log_t::create(lsn_t): Initialize last_checkpoint_lsn. Initialize the
log header as specified by log_sys.archive (innodb_log_archive).

log_write_buf(): Add the parameter max_length, the file wrap limit.

log_write_up_to(), mtr_t::commit_log_release<bool mmap=true>():
If we are switching log files, invoke buf_flush_ahead(lsn, false)
to ensure that a log checkpoint will be completed in the new file.

mtr_t::finish_writer(): Specialize for innodb_log_archive=ON.

mtr_t::commit_file(): Ensure that log archive rotation will complete.

log_t::append_prepare<log_t::ARCHIVED_MMAP>(): Special case.

log_t::append_prepare(): Remove the call to set_check_for_checkpoint()
that was duplicating logic in log_close().

log_t::get_path(): Get the name of the current log file.

log_t::get_circular_path(size_t): Get the path name of a circular file.
Replaces get_log_file_path().

log_t::get_archive_path(lsn_t): Return a name of an archived log file.

log_t::append_archive_name(): Append the archive log file name
to a path string.

log_t::checkpoint_margin(): Replaces log_checkpoint_margin().
If a new archived log file has been created, wait for the
first checkpoint in that file. Revise the formula when
log_sys.need_checkpoint needs to hold. When innodb_log_archive=ON,
we can allow the checkpoint to be older by innodb_log_file_size.

log_close(): Relax the log_sys.need_checkpoint condition
for innodb_log_archive=ON.

srv_log_rebuild_if_needed(): Never rebuild if innodb_log_archive=ON.
The setting innodb_log_file_size will affect the creation of
subsequent log files. The parameter innodb_encrypt_log cannot be
changed while the log is in the innodb_log_archive=ON format.

log_t::attach(), log_mmap(): Add the parameter log_access,
to distinguish memory-mapped or read-only access.

log_t::attach(): When disabling innodb_log_file_mmap, read
checkpoint_buf from the last innodb_log_archive=ON file.

log_t::clear_mmap(): Clear the tail of the checkpoint buffer
if is_mmap_writeable().

log_t::set_recovered(): Invoke clear_mmap(), and restore the
log buffer to the correct position.

recv_sys_t::apply(): Let log_t::clear_mmap() enable log writes.

log_file_is_zero(): Check if a log file starts with NUL bytes
(is a preallocated file).

recv_sys_t::find_checkpoint(): Find and remember the checkpoint position
in the last file when innodb_log_recovery_start points to an older file.
When innodb_log_file_mmap=OFF, restore log_sys.checkpoint_buf from
the latest log file. If the last archive log file is actually
in innodb_log_archive=OFF format despite being named ib_%016.log,
try to recover it in that format. If the circular ib_logfile0 is missing,
determine the oldest archived log file with contiguous LSN.
If innodb_log_archive=ON, refuse to start if ib_logfile0 exists.
Open non-last non-preallocated archived log file in read/write mode.

recv_sys_t::find_checkpoint_archived(): Validate each checkpoint in
the current file header, and by default aim to recover from the last
valid one. Terminate the search if the last validated checkpoint
spanned two files. If innodb_log_recovery_start has been specified,
attempt to validate it even if there is no such information stored
in the checkpoint header.

log_parse_file(): Do not invoke fil_name_process() during
recv_sys_t::find_checkpoint_archived(), when we tolerate FILE_MODIFY
records while looking for a FILE_CHECKPOINT record.

recv_scan_log(): Invoke log_t::archived_switch_recovery() upon
reaching the end of the current archived log file.

log_t::archived_switch_recovery_prepare(): Make use of
recv_sys.log_archive and open all but the last file read-only.

log_t::archived_switch_recovery(): Switch files in the pread() code path.

log_t::archived_mmap_switch_recovery_complete(): Switch files in the
memory-mapped code path.

recv_warp: A pointer wrapper for memory-mapped parsing that spans two
archive log files.

recv_sys_t::parse_mmap(): Use recv_warp for innodb_log_archive=ON.

recv_sys_t::parse(): Tweak some logic for innodb_log_archive=ON.

log_t::set_recovered_checkpoint(): Set the checkpoint on recovery.
Updates also the end_lsn.

log_t::set_recovered_lsn(): Also update flush_lock and write_lock,
to ensure that log_write_up_to() will be a no-op. Invoke
unstash_archive_file() in case there was a garbage (pre-allocated)
file at the end which was not parsed at all.

log_t::persist(): Even if the flushed_to_disk_lsn does not change,
we may want to reset the write_lsn_offset.
This commit is contained in:
Marko Mäkelä
2026-05-05 13:57:50 +03:00
parent e13d89949c
commit 3394a9d114
198 changed files with 4286 additions and 941 deletions

View File

@@ -1782,7 +1782,7 @@ copy_back()
if it exists. */
ds_tmp = ds_create(dst_dir, DS_TYPE_LOCAL);
if (!(ret = copy_or_move_file(ds_tmp, LOG_FILE_NAME, LOG_FILE_NAME,
if (!(ret = copy_or_move_file(ds_tmp, "ib_logfile0", "ib_logfile0",
dst_dir, 1))) {
goto cleanup;
}
@@ -1893,7 +1893,7 @@ copy_back()
}
/* skip the redo log (it was already copied) */
if (!strcmp(filename, LOG_FILE_NAME)) {
if (!strcmp(filename, "ib_logfile0")) {
continue;
}

View File

@@ -2683,7 +2683,7 @@ static void log_hdr_init()
MYSQL_VERSION_ID / 10000, MYSQL_VERSION_ID / 100 % 100,
MYSQL_VERSION_ID % 100);
if (log_sys.is_encrypted())
log_crypt_write_header(log_hdr_buf + LOG_HEADER_CREATOR_END);
log_crypt_write_header(log_hdr_buf + LOG_HEADER_CREATOR_END, false);
mach_write_to_4(508 + log_hdr_buf, my_crc32c(0, log_hdr_buf, 508));
mach_write_to_8(log_hdr_buf + 0x1000, log_sys.last_checkpoint_lsn);
mach_write_to_8(log_hdr_buf + 0x1008, recv_sys.lsn);
@@ -2742,7 +2742,7 @@ static bool innodb_init()
srv_log_group_home_dir= xtrabackup_target_dir;
bool ret;
const std::string ib_logfile0{get_log_file_path()};
const std::string ib_logfile0{log_sys.get_circular_path()};
os_file_delete_if_exists_func(ib_logfile0.c_str(), nullptr);
os_file_t file= os_file_create_func(ib_logfile0.c_str(),
OS_FILE_CREATE,
@@ -4922,6 +4922,8 @@ static bool backup_wait_for_commit_lsn()
lsn_t last_lsn= recv_sys.lsn;
/* read the latest checkpoint lsn */
log_sys.last_checkpoint_lsn= 0;
recv_sys.file_checkpoint= 0;
if (recv_sys.find_checkpoint() == DB_SUCCESS && log_sys.is_latest())
{
metadata_to_lsn= log_sys.last_checkpoint_lsn;
@@ -5554,6 +5556,7 @@ static bool xtrabackup_backup_func()
srv_n_purge_threads = 1;
srv_read_only_mode = TRUE;
recv_sys.rpo = LSN_MAX;
srv_operation = SRV_OPERATION_BACKUP;
log_file_op = backup_file_op;
@@ -5646,10 +5649,11 @@ fail:
/* open the log file */
memset(&stat_info, 0, sizeof(MY_STAT));
dst_log_file = ds_open(backup_datasinks.m_redo, LOG_FILE_NAME, &stat_info);
dst_log_file =
ds_open(backup_datasinks.m_redo, "ib_logfile0", &stat_info);
if (dst_log_file == NULL) {
msg("Error: failed to open the target stream for '%s'.",
LOG_FILE_NAME);
msg("Error: failed to open the target stream"
" for 'ib_logfile0'.");
goto fail;
}

View File

@@ -2,3 +2,7 @@
# (see include/innodb_encrypt_log.combinations)
--source include/have_innodb.inc
if ($MTR_COMBINATION_CRYPT)
{
--source ../suite/encryption/include/skip_innodb_log_archive.inc
}

View File

@@ -18,7 +18,7 @@ repeat(uuid(), 7)
from seq_1_to_16384;
commit;
SET GLOBAL innodb_fast_shutdown=0;
# restart
# restart: --innodb-log-recovery-start=0
set log_slow_verbosity='engine';
set long_query_time=0.0;
set @js='$analyze_output';

View File

@@ -32,6 +32,8 @@ from seq_1_to_16384;
commit;
SET GLOBAL innodb_fast_shutdown=0;
# Avoid any crash recovery that would load pages.
--let $restart_parameters=--innodb-log-recovery-start=0
source include/restart_mysqld.inc;
set log_slow_verbosity='engine';
set long_query_time=0.0;

View File

@@ -19,7 +19,7 @@ commit;
# (in the test's .opt file we've disabled buffer pool saving/loading
# and also tried to disable any background activity)
SET GLOBAL innodb_fast_shutdown=0;
# restart
# restart: --innodb-log-recovery-start=0
set @innodb_pages_read0=
(select variable_value
from information_schema.session_status

View File

@@ -28,6 +28,8 @@ commit;
--echo # (in the test's .opt file we've disabled buffer pool saving/loading
--echo # and also tried to disable any background activity)
SET GLOBAL innodb_fast_shutdown=0;
# Avoid any crash recovery that would load pages.
--let $restart_parameters=--innodb-log-recovery-start=0
--source include/restart_mysqld.inc
set @innodb_pages_read0=

View File

@@ -327,7 +327,7 @@ my %mysqld_logs;
my $opt_debug_sync_timeout= 300; # Default timeout for WAIT_FOR actions.
my $warn_seconds = 60;
my $rebootstrap_re= '--innodb[-_](?:page[-_]size|checksum[-_]algorithm|undo[-_]tablespaces|log[-_]group[-_]home[-_]dir|data[-_]home[-_]dir)|data[-_]file[-_]path|force_rebootstrap';
my $rebootstrap_re= '--innodb[-_](?:page[-_]size|checksum[-_]algorithm|undo[-_]tablespaces|log[-_](group[-_]home[-_]dir|archive)|data[-_]home[-_]dir)|data[-_]file[-_]path|force_rebootstrap';
sub testcase_timeout ($) { return $opt_testcase_timeout * 60; }
sub check_timeout ($) { return testcase_timeout($_[0]); }
@@ -3147,7 +3147,7 @@ sub mysql_install_db {
# need to be given to the bootstrap process as well as the
# server process.
foreach my $extra_opt ( @opt_extra_mysqld_opt ) {
if ($extra_opt =~ /--innodb/) {
if ($extra_opt =~ /--((loose|skip)[-_])*innodb/) {
mtr_add_arg($args, $extra_opt);
}
}

View File

@@ -38,6 +38,21 @@ binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `test`; INSERT INTO t1 VALUES (1)
binlog-000000.ibb # Xid # # COMMIT /* XID */
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_utf8mb4'InnoDB: innodb_read_only prevents crash recovery' COLLATE 'utf8mb4_uca1400_ai_ci'))
binlog-000000.ibb # Query # # COMMIT
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_utf8mb4'InnoDB: Plugin initialization aborted' COLLATE 'utf8mb4_uca1400_ai_ci'))
binlog-000000.ibb # Query # # COMMIT
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_utf8mb4'Plugin \'InnoDB\' registration as a STORAGE ENGINE failed' COLLATE 'utf8mb4_uca1400_ai_ci'))
binlog-000000.ibb # Query # # COMMIT
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_utf8mb4'unknown option \'--innodb-invalid-option\'' COLLATE 'utf8mb4_uca1400_ai_ci'))
binlog-000000.ibb # Query # # COMMIT
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_utf8mb4'\\[ERROR\\] Aborting' COLLATE 'utf8mb4_uca1400_ai_ci'))
binlog-000000.ibb # Query # # COMMIT
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `test`; INSERT INTO t1 VALUES (2)
binlog-000000.ibb # Query # # use `test`; INSERT INTO t1 VALUES (3)
binlog-000000.ibb # Xid # # COMMIT /* XID */

View File

@@ -12,6 +12,7 @@ INSERT INTO t1 VALUES (1);
--let $no_checkpoint_flush= 1
--let no_checkpoint_kill= 1
--source ../../suite/innodb/include/no_checkpoint_prepare.inc
--source ../../suite/innodb/include/no_checkpoint_start.inc
--let $file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $pos= query_get_value(SHOW MASTER STATUS, Position, 1)

View File

@@ -32,6 +32,7 @@ while ($i < $pre_count) {
--let $no_checkpoint_flush= 1
--let $no_checkpoint_kill= 1
--source ../../suite/innodb/include/no_checkpoint_prepare.inc
--source ../../suite/innodb/include/no_checkpoint_start.inc
--let $file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $pos= query_get_value(SHOW MASTER STATUS, Position, 1)

View File

@@ -30,6 +30,31 @@ binlog-000000.ibb # Annotate_rows # # INSERT INTO t1 VALUES (2, REPEAT('2', 2000
binlog-000000.ibb # Table_map # # table_id: # (test.t1)
binlog-000000.ibb # Write_rows_v1 # # table_id: # flags: STMT_END_F
binlog-000000.ibb # Xid # # COMMIT /* XID */
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Annotate_rows # # INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_utf8mb4'InnoDB: innodb_read_only prevents crash recovery' COLLATE 'utf8mb4_uca1400_ai_ci'))
binlog-000000.ibb # Table_map # # table_id: # (mtr.test_suppressions)
binlog-000000.ibb # Write_rows_v1 # # table_id: # flags: STMT_END_F
binlog-000000.ibb # Query # # COMMIT
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Annotate_rows # # INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_utf8mb4'InnoDB: Plugin initialization aborted' COLLATE 'utf8mb4_uca1400_ai_ci'))
binlog-000000.ibb # Table_map # # table_id: # (mtr.test_suppressions)
binlog-000000.ibb # Write_rows_v1 # # table_id: # flags: STMT_END_F
binlog-000000.ibb # Query # # COMMIT
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Annotate_rows # # INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_utf8mb4'Plugin \'InnoDB\' registration as a STORAGE ENGINE failed' COLLATE 'utf8mb4_uca1400_ai_ci'))
binlog-000000.ibb # Table_map # # table_id: # (mtr.test_suppressions)
binlog-000000.ibb # Write_rows_v1 # # table_id: # flags: STMT_END_F
binlog-000000.ibb # Query # # COMMIT
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Annotate_rows # # INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_utf8mb4'unknown option \'--innodb-invalid-option\'' COLLATE 'utf8mb4_uca1400_ai_ci'))
binlog-000000.ibb # Table_map # # table_id: # (mtr.test_suppressions)
binlog-000000.ibb # Write_rows_v1 # # table_id: # flags: STMT_END_F
binlog-000000.ibb # Query # # COMMIT
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Annotate_rows # # INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_utf8mb4'\\[ERROR\\] Aborting' COLLATE 'utf8mb4_uca1400_ai_ci'))
binlog-000000.ibb # Table_map # # table_id: # (mtr.test_suppressions)
binlog-000000.ibb # Write_rows_v1 # # table_id: # flags: STMT_END_F
binlog-000000.ibb # Query # # COMMIT
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
binlog-000001.ibb # Gtid # # BEGIN GTID #-#-#

View File

@@ -27,6 +27,7 @@ INSERT INTO t1 VALUES (2, REPEAT('2', 200000));
--let $no_checkpoint_flush= 1
--let no_checkpoint_kill= 1
--source ../../suite/innodb/include/no_checkpoint_prepare.inc
--source ../../suite/innodb/include/no_checkpoint_start.inc
# Then fill up rest of binlog-000000.ibb, and some but not all of

View File

@@ -0,0 +1,12 @@
--disable_query_log
SET STATEMENT sql_log_bin=0 FOR
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed\\.");
SET STATEMENT sql_log_bin=0 FOR
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
SET STATEMENT sql_log_bin=0 FOR
call mtr.add_suppression("InnoDB: ib_0.*\\.log does not match innodb_encrypt_log");
--enable_query_log
if (`SELECT COUNT(*)=0 FROM information_schema.global_variables where variable_name='innodb_log_archive' and variable_value='OFF'`)
{
--skip Test requires innodb_log_archive=OFF
}

View File

@@ -82,7 +82,7 @@ set global innodb_buf_flush_list_now = 1;
# restart
FOUND 1 /InnoDB: Encrypted page \[page id: space=[1-9]*, page number=3\] in file .*test.t1.ibd looks corrupted/ in mysqld.1.err
select * from t1;
ERROR 42000: Unknown storage engine 'InnoDB'
Got one of the listed errors
# shutdown server
# remove datadir
# xtrabackup move back

View File

@@ -32,10 +32,10 @@ foobar 1
foobar 2
# Restart server with keysbad3.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keysbad3.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keysbad3.txt --innodb-log-recovery-start=0
SELECT * FROM t1;
ERROR HY000: Table `test`.`t1` is corrupted. Please drop the table and recreate.
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keysbad3.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keysbad3.txt --innodb-log-recovery-start=0
DROP TABLE t1;
# Start server with keys3.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys3.txt
@@ -44,7 +44,7 @@ CREATE TABLE t2 (c VARCHAR(8), id int not null primary key, b int, key(b)) ENGIN
INSERT INTO t2 VALUES ('foobar',1,2);
# Restart server with keys2.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt --innodb-log-recovery-start=0
SELECT * FROM t2;
ERROR HY000: Table `test`.`t2` is corrupted. Please drop the table and recreate.
SELECT * FROM t2 where id = 1;

View File

@@ -13,7 +13,7 @@ call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space="
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB
ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
# restart: --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys3.txt
# restart: --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys3.txt --innodb-log-recovery-start=0
SELECT * FROM t1;
ERROR HY000: Table `test`.`t1` is corrupted. Please drop the table and recreate.
SHOW WARNINGS;
@@ -40,7 +40,7 @@ Level Code Message
FLUSH TABLES t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
# restart: --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys3.txt
# restart: --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys3.txt --innodb-log-recovery-start=0
ALTER TABLE t1 DISCARD TABLESPACE;
ERROR HY000: Table `test`.`t1` is corrupted. Please drop the table and recreate.
DROP TABLE t1;

View File

@@ -22,7 +22,7 @@ backup: t1
UNLOCK TABLES;
ALTER TABLE t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
# restart
# restart: --innodb-log-recovery-start=0
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW CREATE TABLE t1;

View File

@@ -16,7 +16,7 @@ insert into t1 values (1, repeat('secret',6000));
insert into t2 values (1, repeat('secret',6000));
insert into t3 values (1, repeat('secret',6000));
# Restart mysqld --file-key-management-filename=keys3.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys3.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys3.txt --innodb-log-recovery-start=0
select count(*) from t1 FORCE INDEX (b) where b like 'secret%';
ERROR HY000: Table `test`.`t1` is corrupted. Please drop the table and recreate.
select count(*) from t2 FORCE INDEX (b) where b like 'secret%';

View File

@@ -23,7 +23,7 @@ CREATE TABLE `t1` (
) ENGINE=InnoDB;
insert into t1 values (1,2,'maria','db','encryption');
alter table t1 encrypted='yes' `encryption_key_id`=1;
# restart: --innodb-encrypt-tables=OFF
# restart: --innodb-encrypt-tables=OFF --innodb-log-recovery-start=0
select * from t1;
ERROR HY000: Table `test`.`t1` is corrupted. Please drop the table and recreate.
select * from t5;

View File

@@ -18,7 +18,7 @@ INSERT INTO t3 select * from t1;
COMMIT;
# Backup tables before corrupting
# Corrupt tables
# restart
# restart: --innodb-log-recovery-start=0
SELECT * FROM t1;
ERROR HY000: Table `test`.`t1` is corrupted. Please drop the table and recreate.
SELECT * FROM t2;

View File

@@ -26,7 +26,7 @@ INSERT INTO t2 SELECT * FROM t1;
INSERT INTO t3 SELECT * FROM t1;
# Restart server with keys3.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys3.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys3.txt --innodb-log-recovery-start=0
set global innodb_encryption_rotate_key_age = 1;
use test;
CREATE TABLE t4(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=1;

View File

@@ -49,7 +49,7 @@ select variable_value > 0 from information_schema.global_status
where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED';
variable_value > 0
1
# restart: --innodb-encrypt-tables=OFF
# restart: --innodb-encrypt-tables=OFF --innodb-log-recovery-start=0
set global innodb_compression_algorithm = 1;
alter table innodb_normal engine=innodb page_compressed=DEFAULT;
show create table innodb_normal;

View File

@@ -8,7 +8,7 @@ WHERE NAME LIKE '%encrypt%';
SELECT @encryption_threads_running;
@encryption_threads_running
4
# restart: --innodb-read-only=1 --innodb-encrypt-tables=1
# restart: --innodb-read-only=1 --innodb-encrypt-tables=1 --innodb-log-recovery-start=0
SET GLOBAL innodb_encryption_threads=4;
SET @encryption_threads_running=0;
SELECT COUNT(*) INTO @encryption_threads_running

View File

@@ -20,6 +20,13 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /InnoDB: Upgrade after a crash is not supported. This redo log was created before MariaDB 10\.2\.2, and we did not find a valid checkpoint/ in mysqld.1.err
# empty redo log from before MariaDB 10.2.2
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-recovery-target=12345
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
COUNT(*)
0
FOUND 1 /InnoDB: cannot fulfill innodb_log_recovery_target=12345!=/ in mysqld.1.err
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'

View File

@@ -1,4 +1,5 @@
--source include/have_innodb.inc
--source include/skip_innodb_log_archive.inc # innodb_encrypt_log
--source include/have_sequence.inc
--source include/have_file_key_management_plugin.inc

View File

@@ -1,4 +1,5 @@
--source include/have_innodb.inc
--source ../../suite/innodb/include/no_checkpoint_prepare.inc
--source include/have_file_key_management_plugin.inc
--disable_query_log
@@ -18,6 +19,7 @@ CREATE TABLE t1(a BIGINT PRIMARY KEY) ENGINE=InnoDB, ENCRYPTED=YES;
INSERT INTO t1 VALUES(1);
# Force a redo log checkpoint.
let $restart_noprint=2;
let $restart_parameters=--innodb-log-recovery-start=0;
--source include/restart_mysqld.inc
--source ../../suite/innodb/include/no_checkpoint_start.inc
CREATE TABLE t2(a BIGINT PRIMARY KEY) ENGINE=InnoDB, ENCRYPTED=YES;
@@ -58,7 +60,7 @@ SELECT * FROM t1;
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t[1].ibd looks corrupted; key_version=");
call mtr.add_suppression("Table .*t1.* is corrupted. Please drop the table and recreate.");
--enable_query_log
let $restart_parameters=--innodb_force_recovery=1 --skip-innodb-buffer-pool-load-at-startup;
let $restart_parameters=--innodb-log-recovery-start=0 --innodb_force_recovery=1 --skip-innodb-buffer-pool-load-at-startup;
--source include/restart_mysqld.inc
--error ER_TABLE_CORRUPT

View File

@@ -1,4 +1,5 @@
-- source include/have_innodb.inc
-- source include/skip_innodb_log_archive.inc # innodb_encrypt_log
-- source include/have_debug.inc
-- source include/innodb_undo_tablespaces.inc
-- source include/not_embedded.inc

View File

@@ -1,7 +1,9 @@
--source include/have_innodb.inc
--source ../../suite/innodb/include/skip_innodb_log_archive.inc #mariadb-backup
--source include/have_debug.inc
--source include/not_embedded.inc
--source include/have_file_key_management_plugin.inc
--source ../../suite/innodb/include/no_checkpoint_prepare.inc
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t[12]\\.ibd looks corrupted");
call mtr.add_suppression("InnoDB: Unable to apply log to corrupted page ");
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
@@ -233,7 +235,7 @@ let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN=InnoDB: Encrypted page \\[page id: space=[1-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted;
--source include/search_pattern_in_file.inc
--error ER_UNKNOWN_STORAGE_ENGINE
--error ER_UNKNOWN_STORAGE_ENGINE,ER_TABLE_CORRUPT
select * from t1;
--source ../../mariabackup/include/restart_and_restore.inc

View File

@@ -1,4 +1,5 @@
-- source include/have_innodb.inc
-- source include/skip_innodb_log_archive.inc # innodb_encrypt_log
-- source include/innodb_undo_tablespaces.inc
-- source include/have_file_key_management_plugin.inc

View File

@@ -1,4 +1,5 @@
-- source include/have_innodb.inc
-- source include/skip_innodb_log_archive.inc # innodb_encrypt_log
-- source include/have_partition.inc
-- source include/have_example_key_management_plugin.inc

View File

@@ -1,4 +1,5 @@
--source include/have_innodb.inc
--source ../../suite/innodb/include/no_checkpoint_prepare.inc
--source include/have_example_key_management_plugin.inc
let $restart_noprint=2;
# embedded does not support restart

View File

@@ -7,6 +7,7 @@
# Require InnoDB
-- source include/have_innodb.inc
-- source include/have_file_key_management_plugin.inc
-- source include/skip_innodb_log_archive.inc # depends on innodb_log_archive=OFF checkpoint logic
-- source include/innodb_page_size_small.inc
-- source include/innodb_checksum_algorithm.inc
-- source include/maybe_debug.inc

View File

@@ -42,7 +42,7 @@ SELECT * FROM t1;
--echo
--echo # Restart server with keysbad3.txt
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keysbad3.txt
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keysbad3.txt --innodb-log-recovery-start=0
-- source include/restart_mysqld.inc
--disable_warnings
@@ -50,7 +50,7 @@ SELECT * FROM t1;
SELECT * FROM t1;
--enable_warnings
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keysbad3.txt
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keysbad3.txt --innodb-log-recovery-start=0
-- source include/restart_mysqld.inc
--replace_regex /key_id [1-9][0-9]*/\1 /
@@ -71,7 +71,7 @@ INSERT INTO t2 VALUES ('foobar',1,2);
--echo
--echo # Restart server with keys2.txt
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt --innodb-log-recovery-start=0
-- source include/restart_mysqld.inc
--disable_warnings

View File

@@ -29,7 +29,7 @@ CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB
ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
--let $restart_parameters=--plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt
--let $restart_parameters=--plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt --innodb-log-recovery-start=0
--source include/restart_mysqld.inc
--error ER_TABLE_CORRUPT
@@ -60,7 +60,7 @@ ib_backup_tablespaces("test", "t1");
EOF
UNLOCK TABLES;
--let $restart_parameters=--plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt
--let $restart_parameters=--plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt --innodb-log-recovery-start=0
--source include/restart_mysqld.inc
--error ER_TABLE_CORRUPT

View File

@@ -65,6 +65,7 @@ EOF
--write_line "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
--let $restart_parameters=--innodb-log-recovery-start=0
--source include/restart_mysqld.inc
--error ER_GET_ERRMSG

View File

@@ -25,7 +25,7 @@ insert into t2 values (1, repeat('secret',6000));
insert into t3 values (1, repeat('secret',6000));
--echo # Restart mysqld --file-key-management-filename=keys3.txt
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt --innodb-log-recovery-start=0
-- source include/restart_mysqld.inc
--error ER_TABLE_CORRUPT

View File

@@ -41,7 +41,7 @@ CREATE TABLE `t1` (
insert into t1 values (1,2,'maria','db','encryption');
alter table t1 encrypted='yes' `encryption_key_id`=1;
--let $restart_parameters=--innodb-encrypt-tables=OFF
--let $restart_parameters=--innodb-encrypt-tables=OFF --innodb-log-recovery-start=0
--source include/restart_mysqld.inc
--error ER_TABLE_CORRUPT

View File

@@ -68,7 +68,9 @@ print FILE pack("H*", "c001cafedeadb017");
close FILE or die "close";
EOF
--let $restart_parameters=--innodb-log-recovery-start=0
--source include/start_mysqld.inc
--let $restart_parameters=
--error ER_TABLE_CORRUPT
SELECT * FROM t1;

View File

@@ -1,4 +1,5 @@
-- source include/have_innodb.inc
-- source include/skip_innodb_log_archive.inc # innodb_encrypt_log
-- source include/have_file_key_management_plugin.inc
# not embedded because of restarts
-- source include/not_embedded.inc

View File

@@ -39,7 +39,7 @@ INSERT INTO t3 SELECT * FROM t1;
--echo
--echo # Restart server with keys3.txt
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys3.txt --innodb-log-recovery-start=0
-- source include/restart_mysqld.inc
set global innodb_encryption_rotate_key_age = 1;

View File

@@ -42,7 +42,7 @@ FLUSH TABLES innodb_dynamic FOR EXPORT; UNLOCK TABLES;
select variable_value > 0 from information_schema.global_status
where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED';
--let $restart_parameters=--innodb-encrypt-tables=OFF
--let $restart_parameters=--innodb-encrypt-tables=OFF --innodb-log-recovery-start=0
--source include/restart_mysqld.inc
# zlib

View File

@@ -1,4 +1,5 @@
-- source include/have_innodb.inc
-- source include/skip_innodb_log_archive.inc # innodb_encrypt_log
-- source include/not_embedded.inc
-- source include/have_file_key_management_plugin.inc

View File

@@ -38,7 +38,7 @@ SELECT @encryption_threads_running;
# MDEV-11835: InnoDB: Failing assertion: free_slot != NULL on
# restarting server with encryption and read-only
#
--let $restart_parameters= --innodb-read-only=1 --innodb-encrypt-tables=1
--let $restart_parameters= --innodb-read-only=1 --innodb-encrypt-tables=1 --innodb-log-recovery-start=0
--source include/restart_mysqld.inc
# Server read-only mode

View File

@@ -1,4 +1,5 @@
-- source include/have_innodb.inc
--source ../../suite/innodb/include/no_checkpoint_prepare.inc
-- source include/have_file_key_management_plugin.inc
# embedded does not support restart
-- source include/not_embedded.inc

View File

@@ -1,4 +1,5 @@
-- source include/have_innodb.inc
--source ../../suite/innodb/include/no_checkpoint_prepare.inc
-- source include/have_file_key_management_plugin.inc
# embedded does not support restart
-- source include/not_embedded.inc

View File

@@ -1,4 +1,5 @@
--source include/have_innodb.inc
--source include/skip_innodb_log_archive.inc # innodb_encrypt_log
--source include/have_example_key_management_plugin.inc
--source include/have_debug.inc
--source include/not_embedded.inc

View File

@@ -1,4 +1,5 @@
-- source include/have_innodb.inc
-- source include/skip_innodb_log_archive.inc # innodb_encrypt_log
-- source include/not_embedded.inc
-- source filekeys_plugin.inc

View File

@@ -1,3 +1,4 @@
--source include/skip_innodb_log_archive.inc # innodb_encrypt_log
--let $no_cleanup=1
--source ../../innodb/t/log_corruption.test

View File

@@ -1,4 +1,5 @@
-- source include/have_innodb.inc
-- source include/skip_innodb_log_archive.inc # innodb_encrypt_log
-- source include/have_example_key_management_plugin.inc
-- source include/not_embedded.inc
# This test is too slow for valgrind and causes innodb semaphores to time out

View File

@@ -2,6 +2,7 @@
#
#
-- source include/have_innodb.inc
-- source include/skip_innodb_log_archive.inc # innodb_encrypt_log
-- source include/have_example_key_management_plugin.inc
-- source include/innodb_undo_tablespaces.inc

View File

@@ -1,4 +1,5 @@
-- source include/have_innodb.inc
-- source include/skip_innodb_log_archive.inc # innodb_encrypt_log
-- source include/have_example_key_management_plugin.inc
-- source include/not_valgrind.inc
-- source include/not_embedded.inc

View File

@@ -1,4 +1,5 @@
-- source include/have_innodb.inc
-- source include/skip_innodb_log_archive.inc # innodb_encrypt_log
-- source include/have_example_key_management_plugin.inc
-- source include/not_embedded.inc
# We can't run this test under valgrind as it 'takes forever'

View File

@@ -3,6 +3,7 @@
#
--source include/have_innodb.inc
--source include/skip_innodb_log_archive.inc # innodb_encrypt_log
--source include/have_file_key_management_plugin.inc
--source include/innodb_undo_tablespaces.inc

View File

@@ -1,4 +1,5 @@
-- source include/have_innodb.inc
-- source include/skip_innodb_log_archive.inc # innodb_encrypt_log
-- source include/have_file_key_management_plugin.inc
# test uses restart
-- source include/not_embedded.inc

View File

@@ -1,5 +1,6 @@
--source include/have_debug.inc
--source include/have_innodb.inc
--source include/skip_innodb_log_archive.inc # innodb_encrypt_log
--source include/have_sequence.inc
--source filekeys_plugin.inc

View File

@@ -4,32 +4,32 @@
if (!$no_checkpoint_kill) {
--source include/kill_mysqld.inc
}
--error 2
--exec $MYSQLD_CMD --innodb --innodb-read-only --innodb-log-recovery-start=0 --innodb-invalid-option --innodb-page-size=$INNODB_PAGE_SIZE --innodb-buffer-pool-size=21m
perl;
my $cp = $ENV{CHECKPOINT_LSN};
$cp =~ s/^InnoDB\t\t//;
my $log = "$ENV{MYSQLD_DATADIR}ib_logfile0";
open(LOG, "<$log") || die "Unable to open $log";
seek(LOG, 4096, 0) || die "Unable to seek $log";
die unless read(LOG, $_, 8) == 8;
my ($cp1hi,$cp1lo) = unpack("NN", $_);
seek(LOG, 8192, 0) || die "Unable to seek $log";
die unless read(LOG, $_, 8) == 8;
my ($cp2hi,$cp2lo) = unpack("NN", $_);
close(LOG);
my $cp1 = $cp1hi << 32 | $cp1lo;
my $cp2 = $cp2hi << 32 | $cp2lo;
open(OUT, ">$ENV{MYSQLTEST_VARDIR}/log/check.txt") || die;
if ($cp1 > $cp || $cp2 > $cp) {
print OUT "--source include/start_mysqld.inc\n"
unless $ENV{no_checkpoint_kill};
print OUT "$ENV{CLEANUP_IF_CHECKPOINT}\n";
print OUT "--skip Extra checkpoint 1 after $cp ($cp1,$cp2)\n";
my $cp=0;
my $search_file= "$ENV{MYSQLTEST_VARDIR}/log/mysqld.1.err";
open(FILE, '<', $search_file) || die("Can't open file $search_file: $!");
while(<FILE>)
{
if (/^CURRENT_TEST:/)
{
$cp=0;
}
elsif (!$cp && /\[Warning\] innodb_read_only prevents crash recovery between (\d+) and/o)
{
$cp=$1;
}
}
close(FILE);
open(OUT, ">$ENV{MYSQLTEST_VARDIR}/log/check.txt") || die;
if ($cp != $ENV{CHECKPOINT_LSN})
{
print OUT "--source include/start_mysqld.inc\n";
print OUT "$ENV{CLEANUP_IF_CHECKPOINT}\n";
print OUT "--skip Unexpected checkpoint $cp != $ENV{CHECKPOINT_LSN}\n";
}
close(OUT);
EOF

View File

@@ -0,0 +1,8 @@
--disable_query_log
call mtr.add_suppression("InnoDB: innodb_read_only prevents crash recovery");
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
call mtr.add_suppression("unknown option '--innodb-invalid-option'");
call mtr.add_suppression("\\[ERROR\\] Aborting");
let $INNODB_PAGE_SIZE=`SELECT @@GLOBAL.innodb_page_size`;
--enable_query_log

View File

@@ -0,0 +1,4 @@
if (`SELECT @@GLOBAL.innodb_log_archive`)
{
--skip Test requires innodb_log_archive=OFF
}

View File

@@ -36,7 +36,7 @@ test.tz check status OK
test.tdd check status OK
test.tp check status OK
test.ti check status OK
# restart: --innodb-read-only
# restart: --innodb-read-only --innodb-log-recovery-start=0
CHECK TABLE tr,tc,td,tz,tdd,tp,ti;
Table Op Msg_type Msg_text
test.tr check status OK

View File

@@ -119,7 +119,7 @@ t1 CREATE TABLE `t1` (
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
# restart: --innodb-read-only
# restart: --innodb-read-only --innodb-log-recovery-start=0
FTS_INDEX_1.ibd
FTS_INDEX_2.ibd
FTS_INDEX_3.ibd

View File

@@ -16,7 +16,7 @@ connection default;
disconnect con1;
# Corrupt FIL_PAGE_TYPE in bug16720368.ibd,
# and recompute innodb_checksum_algorithm=crc32
# restart: --innodb-flush-method=O_DIRECT
# restart: --innodb-flush-method=O_DIRECT --innodb-log-recovery-start=0
SELECT @@innodb_doublewrite;
@@innodb_doublewrite
OFF
@@ -26,7 +26,7 @@ INSERT INTO bug16720368 VALUES(1);
ERROR HY000: Table `test`.`bug16720368` is corrupted. Please drop the table and recreate.
INSERT INTO bug16720368_1 VALUES(1);
# Shut down the server to uncorrupt the data.
# restart
# restart: --innodb-log-recovery-start=0
INSERT INTO bug16720368 VALUES(9,1);
SELECT COUNT(*) FROM bug16720368;
COUNT(*)
@@ -53,9 +53,9 @@ connection default;
# Kill the server
disconnect con1;
# Attempt to start without an *.ibd file.
# restart
# restart: --innodb-log-recovery-start=0
FOUND 1 /\[ERROR\] InnoDB: Tablespace [0-9]+ was not found at .*test.bug16735660.ibd/ in mysqld.1.err
# restart
# restart: --innodb-log-recovery-start=0
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM bug16735660;
a

View File

@@ -6,7 +6,7 @@ CREATE TABLE t(a SERIAL)ENGINE=InnoDB;
CREATE TABLE `x..d` (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
CREATE TABLE t1(a SERIAL)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1),(2),(3);
# restart
# restart: --innodb-log-recovery-start=0
SELECT * FROM t;
ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
ALTER TABLE t ADD INDEX (a), ALGORITHM=INPLACE;

View File

@@ -90,7 +90,7 @@ test.t10_1 check note Auto_increment will be checked on each open until CHECK TA
test.t10_1 check status OK
test.t10_1b check note Auto_increment will be checked on each open until CHECK TABLE FOR UPGRADE is executed
test.t10_1b check status OK
# restart: --innodb-read-only --read-only
# restart: --innodb-read-only --read-only --innodb-log-recovery-start=0
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b;
Table Op Msg_type Msg_text
test.t1 check status OK
@@ -119,7 +119,7 @@ test.t10_1 check note Auto_increment will be checked on each open until CHECK TA
test.t10_1 check status OK
test.t10_1b check note Auto_increment will be checked on each open until CHECK TABLE FOR UPGRADE is executed
test.t10_1b check status OK
# restart: --innodb-read-only
# restart: --innodb-read-only --innodb-log-recovery-start=0
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b;
Table Op Msg_type Msg_text
test.t1 check status OK

View File

@@ -1,14 +1,27 @@
CREATE TABLE t1(a BIGINT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t1(a BIGINT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0;
INSERT INTO t1 VALUES(1);
SET GLOBAL innodb_max_purge_lag_wait=0, innodb_log_checkpoint_now=ON;
connect stop_purge,localhost,root;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
CREATE TABLE t2(a BIGINT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(2);
SET GLOBAL innodb_flush_log_at_trx_commit=1;
INSERT INTO t2 VALUES(1);
# Kill the server
disconnect stop_purge;
SELECT * FROM t2;
Got one of the listed errors
SELECT * FROM t2;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND 1 /InnoDB: cannot fulfill innodb_log_recovery_target.*/ in mysqld.1.err
DELETE FROM t1;
Got one of the listed errors
DELETE FROM t2;
Got one of the listed errors
# Corrupt the pages
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND 1 /InnoDB: Page \[page id: space=[1-9][0-9]*, page number=3\] log sequence number 1311768467463790320 is in the future!/ in mysqld.1.err
SELECT * FROM t1;
a
1
@@ -18,6 +31,7 @@ a
CHECK TABLE t2;
Table Op Msg_type Msg_text
test.t2 check status OK
FOUND 1 /InnoDB: Page \[page id: space=[1-9][0-9]*, page number=3\] log sequence number 1311768467463790320 is in the future!.*/ in mysqld.1.err
DROP TABLE t1, t2;
CREATE TABLE t1(pk SERIAL) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2),(3);
@@ -31,6 +45,9 @@ DELETE FROM t1 WHERE pk=3;
disconnect con1;
# Corrupt the page
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND 1 /InnoDB: Did not find innodb_log_recovery_start=\d+ .*/ in mysqld.1.err
SELECT * FROM t1;
pk
1
2

View File

@@ -23,7 +23,7 @@ commit work;
# Test Begin: Test if recovery works if 1st page and 2nd page
# of system tablespace is full of zeroes.
SET GLOBAL innodb_fast_shutdown = 0;
# restart: --debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0
# restart: --debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0 --innodb-log-recovery-start=0
begin;
insert into t1 values (6, repeat('%', 400));
SET GLOBAL innodb_max_dirty_pages_pct_lwm=0, innodb_max_dirty_pages_pct=0;
@@ -36,7 +36,7 @@ set global innodb_fil_make_page_dirty_debug = 0;
# Kill the server
# Make the 1st page (page_no=0) and 2nd page (page_no=1)
# of the system tablespace all zeroes.
# restart
# restart: --innodb-log-recovery-start=0
FOUND 1 /InnoDB: Recovered page \[page id: space=0, page number=0\]/ in mysqld.1.err
FOUND 1 /InnoDB: Recovered page \[page id: space=0, page number=1\]/ in mysqld.1.err
check table t1;
@@ -53,7 +53,7 @@ f1 f2
# ---------------------------------------------------------------
# Test Begin: Test if recovery works if 1st page of
# system tablespace is corrupted and 2nd page as corrupted.
# restart: --debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0
# restart: --innodb-log-recovery-start=0 --debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0
begin;
insert into t1 values (6, repeat('%', 400));
# Make the first page dirty for system tablespace
@@ -65,7 +65,7 @@ set global innodb_fil_make_page_dirty_debug = 0;
set global innodb_buf_flush_list_now = 1;
# Kill the server
# Corrupt the 1st page (page_no=0) and 2nd page of the system tablespace.
# restart
# restart: --innodb-log-recovery-start=0
FOUND 2 /InnoDB: Recovered page \[page id: space=0, page number=0\]/ in mysqld.1.err
FOUND 2 /InnoDB: Recovered page \[page id: space=0, page number=1\]/ in mysqld.1.err
check table t1;
@@ -85,10 +85,10 @@ drop table t1;
# MDEV-12600 crash during install_db with innodb_page_size=32K
# and ibdata1=3M
#
# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/doublewrite --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/doublewrite --innodb-undo-tablespaces=0 --innodb-data-file-path=ibdata1:1M;ibdata2:1M:autoextend
# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/doublewrite --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/doublewrite --innodb-undo-tablespaces=0 --innodb-log-recovery-start=0 --innodb-data-file-path=ibdata1:1M;ibdata2:1M: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: Cannot create doublewrite buffer/ in mysqld.1.err
# restart
# restart: --innodb-log-recovery-start=0

View File

@@ -26,7 +26,7 @@ KEY `fk_crewRoleAssigned_roleCode` (`role_code`),
CONSTRAINT `fk_crewRoleAssigned_crewId` FOREIGN KEY (`crew_id`) REFERENCES `repro`.`crew` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_crewRoleAssigned_pilotId` FOREIGN KEY (`crew_id`) REFERENCES `repro`.`pilot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB COMMENT="This is a comment about tables";
# restart: --innodb-read-only
# restart: --innodb-read-only --innodb-log-recovery-start=0
ALTER TABLE `repro`.`crew_role_assigned` COMMENT = 'innodb_read_only';
ERROR HY000: Table 'crew_role_assigned' is read only
SHOW CREATE TABLE `repro`.`crew_role_assigned`;
@@ -58,7 +58,7 @@ crew_role_assigned CREATE TABLE `crew_role_assigned` (
CONSTRAINT `fk_crewRoleAssigned_crewId` FOREIGN KEY (`crew_id`) REFERENCES `crew` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_crewRoleAssigned_pilotId` FOREIGN KEY (`crew_id`) REFERENCES `pilot` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci COMMENT='This is a new comment about tables'
# restart: --innodb-read-only
# restart: --innodb-read-only --innodb-log-recovery-start=0
SHOW CREATE TABLE `repro`.`crew_role_assigned`;
Table Create Table
crew_role_assigned CREATE TABLE `crew_role_assigned` (

View File

@@ -1,6 +1,27 @@
--- innodb-wl5522.result
+++ innodb-wl5522,strict_crc32.result~
@@ -131,8 +131,7 @@
@@ -1,9 +1,6 @@
call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT\\.");
call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it");
call mtr.add_suppression("InnoDB: Cannot save statistics for table `test`\\.`t1` because the \\.ibd file is missing");
-call mtr.add_suppression("InnoDB: cannot fulfill innodb_log_recovery_target=102345<");
-call mtr.add_suppression("InnoDB: Plugin initialization aborted");
-call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed\\.");
FLUSH TABLES;
CREATE TABLE t1
(a INT AUTO_INCREMENT PRIMARY KEY,
@@ -37,10 +34,6 @@
t1.ibd
t2.frm
t2.ibd
-# restart: --innodb-log-recovery-target=102345
-FOUND 1 /InnoDB: cannot fulfill innodb_log_recovery_target=102345</ in mysqld.1.err
-FLUSH TABLE t1, t2 FOR EXPORT;
-Got one of the listed errors
# restart
FLUSH TABLE t1, t2 FOR EXPORT;
# List before copying files
@@ -138,8 +131,7 @@
ALTER TABLE t2 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x1; .cfg file uses ROW_FORMAT=COMPACT)
ALTER TABLE t2 IMPORT TABLESPACE;
@@ -8,5 +29,5 @@
-Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t2.cfg', will attempt to import without schema verification
+ERROR HY000: Schema mismatch (Expected FSP_SPACE_FLAGS=0x*, .ibd file contains 0x*.)
DROP TABLE t2;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
@@innodb_file_per_table

View File

@@ -1,6 +1,9 @@
call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT\\.");
call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it");
call mtr.add_suppression("InnoDB: Cannot save statistics for table `test`\\.`t1` because the \\.ibd file is missing");
call mtr.add_suppression("InnoDB: cannot fulfill innodb_log_recovery_target=102345<");
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed\\.");
FLUSH TABLES;
CREATE TABLE t1
(a INT AUTO_INCREMENT PRIMARY KEY,
@@ -34,6 +37,10 @@ t1.frm
t1.ibd
t2.frm
t2.ibd
# restart: --innodb-log-recovery-target=102345
FOUND 1 /InnoDB: cannot fulfill innodb_log_recovery_target=102345</ in mysqld.1.err
FLUSH TABLE t1, t2 FOR EXPORT;
Got one of the listed errors
# restart
FLUSH TABLE t1, t2 FOR EXPORT;
# List before copying files

View File

@@ -7,7 +7,7 @@ INSERT INTO t1 (b) VALUES ('corrupt me');
# Corrupt the table
Munged a string.
Munged a string.
# restart
# restart: --innodb-log-recovery-start=0
# Now t1 is corrupted but we should not crash
SELECT * FROM t1;
Got one of the listed errors

View File

@@ -3,6 +3,13 @@ create table t2(f1 int primary key, f2 int, index idx(f2))engine=innodb;
insert into t1 values(1, 2);
insert into t2 values(1, 2);
SET GLOBAL innodb_fast_shutdown = 0;
# restart: --innodb-log-recovery-target=20480
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
COUNT(*)
0
FOUND 1 /InnoDB: cannot fulfill innodb_log_recovery_target=20480<.*/ in mysqld.1.err
# restart: --innodb-force-recovery=4
select variable_name,variable_value from information_schema.global_status
WHERE variable_name LIKE 'innodb_buffer_pool_%_requests';

View File

@@ -63,6 +63,7 @@ INNODB_LOG_WRITES
INNODB_LSN_CURRENT
INNODB_LSN_FLUSHED
INNODB_LSN_LAST_CHECKPOINT
INNODB_LSN_ARCHIVED
INNODB_MASTER_THREAD_ACTIVE_LOOPS
INNODB_MASTER_THREAD_IDLE_LOOPS
INNODB_MAX_TRX_ID

View File

@@ -0,0 +1,83 @@
call mtr.add_suppression("InnoDB: No matching file found for innodb_log_recovery_start=12288");
call mtr.add_suppression("InnoDB: innodb_read_only prevents crash recovery between 18446744073705357279 and 18446744073705357311");
call mtr.add_suppression("InnoDB: Did not find any checkpoint after LSN=18446744073701175296");
call mtr.add_suppression("InnoDB: cannot fulfill innodb_log_recovery_target=18446744073705357290<18446744073705357306");
call mtr.add_suppression("InnoDB: innodb_log_archive=ON but .*ib_logfile0 exists");
call mtr.add_suppression("InnoDB: Renaming ib_ffffffffff803000\\.log to ib_logfile0");
call mtr.add_suppression("InnoDB: ignoring .*ib_ffffffffffc00000\\.log");
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
# restart: --innodb-read-only --innodb-log-recovery-start=12288
SELECT variable_name, variable_value FROM information_schema.global_status
WHERE variable_name LIKE 'INNODB_LSN%';
variable_name variable_value
FOUND 1 /InnoDB: No matching file found for innodb_log_recovery_start=12288/ in mysqld.1.err
# restart: --innodb-read-only --innodb-log-recovery-start=18446744073705357279
SELECT variable_name, variable_value FROM information_schema.global_status
WHERE variable_name LIKE 'INNODB_LSN%';
variable_name variable_value
FOUND 1 /InnoDB: innodb_read_only prevents crash recovery between 18446744073705357279 and 18446744073705357311/ in mysqld.1.err
# restart: --innodb-read-only --innodb-log-recovery-start=18446744073705357311
SELECT variable_name, variable_value FROM information_schema.global_status
WHERE variable_name LIKE 'INNODB_LSN%';
variable_name variable_value
# restart: --innodb-log-recovery-start=0 --innodb-log-recovery-target=18446744073705357290
FOUND 1 /InnoDB: Did not find any checkpoint after LSN=18446744073701175296/ in mysqld.1.err
# restart: --innodb-log-recovery-start=0 --innodb-log-recovery-target=18446744073705357290
FOUND 2 /InnoDB: Did not find any checkpoint after LSN=18446744073701175296/ in mysqld.1.err
FOUND 1 /InnoDB: End of log at LSN=18446744073705357295/ in mysqld.1.err
FOUND 1 /InnoDB: cannot fulfill innodb_log_recovery_target=18446744073705357290<18446744073705357306/ in mysqld.1.err
# restart: --innodb-log-recovery-start=0 --innodb-read-only --innodb-log-archive
FOUND 1 /InnoDB: innodb_log_archive=ON but .*ib_logfile0 exists/ in mysqld.1.err
# restart: --innodb-log-recovery-start=0 --innodb-read-only --skip-innodb-log-archive
FOUND 2 /InnoDB: innodb_read_only prevents crash recovery between 18446744073705357279 and 18446744073705357311/ in mysqld.1.err
# restart: --innodb-log-recovery-start=0 --innodb-log-recovery-target=18446744073705357295
SELECT variable_name, variable_value FROM information_schema.global_status
WHERE variable_name LIKE 'INNODB_LSN%';
variable_name variable_value
INNODB_LSN_CURRENT 18446744073705357295
INNODB_LSN_FLUSHED 18446744073705357295
INNODB_LSN_LAST_CHECKPOINT 18446744073705357279
INNODB_LSN_ARCHIVED 18446744073705357279
FOUND 1 /InnoDB: Renaming .*ffffffffff803000\.log to ib_logfile0/ in mysqld.1.err
CREATE TABLE t0 (a INT PRIMARY KEY) ENGINE=InnoDB;
ERROR HY000: Can't create table `test`.`t0` (errno: 165 "Table is read only")
RENAME TABLE mysql.innodb_table_stats TO mysql.intabdb_noble_stats;
ERROR HY000: Error on rename of './mysql/innodb_table_stats' to './mysql/intabdb_noble_stats' (errno: 165 "Table is read only")
DROP TABLE mysql.innodb_index_stats;
ERROR HY000: Table 'innodb_index_stats' is read only
ALTER TABLE mysql.innodb_table_stats ROW_FORMAT=COMPACT, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Running in read-only mode. Try ALGORITHM=COPY
TRUNCATE TABLE mysql.innodb_table_stats;
ERROR HY000: Table 'innodb_table_stats' is read only
# restart: --innodb-log-recovery-start=0 --innodb-log-recovery-target=18446744073705357290
SELECT variable_name, variable_value FROM information_schema.global_status
WHERE variable_name LIKE 'INNODB_LSN%';
variable_name variable_value
INNODB_LSN_CURRENT 18446744073705357295
INNODB_LSN_FLUSHED 18446744073705357295
INNODB_LSN_LAST_CHECKPOINT 18446744073705357279
INNODB_LSN_ARCHIVED 18446744073705357279
# restart: --innodb-log-recovery-start=18446744073705357279
SELECT variable_name, variable_value FROM information_schema.global_status
WHERE variable_name LIKE 'INNODB_LSN%';
variable_name variable_value
INNODB_LSN_CURRENT 18446744073705357295
INNODB_LSN_FLUSHED 18446744073705357295
INNODB_LSN_LAST_CHECKPOINT 18446744073705357279
INNODB_LSN_ARCHIVED 18446744073705357279
# restart: --innodb-log-recovery-start=0 --innodb-log-buffer-size=5m
SELECT variable_name, variable_value FROM information_schema.global_status
WHERE variable_name LIKE 'INNODB_LSN%';
variable_name variable_value
INNODB_LSN_CURRENT 18446744073705357310
INNODB_LSN_FLUSHED 18446744073705357310
INNODB_LSN_LAST_CHECKPOINT 18446744073705357279
INNODB_LSN_ARCHIVED 18446744073705357279
# restart: --innodb-log-recovery-start=0
SELECT variable_name, variable_value FROM information_schema.global_status
WHERE variable_name = 'INNODB_LSN_ARCHIVED';
variable_name variable_value
INNODB_LSN_ARCHIVED 18446744073705357279
FOUND 1 /InnoDB: ignoring .*ffffffffffc00000\.log/ in mysqld.1.err
# restart: --innodb-log-recovery-start=0

View File

@@ -20,6 +20,13 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /InnoDB: Upgrade after a crash is not supported. This redo log was created before MariaDB 10\.2\.2, and we did not find a valid checkpoint/ in mysqld.1.err
# empty redo log from before MariaDB 10.2.2
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-recovery-target=12345
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
COUNT(*)
0
FOUND 1 /InnoDB: cannot fulfill innodb_log_recovery_target=12345!=/ in mysqld.1.err
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=4m
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'

View File

@@ -240,7 +240,9 @@ 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
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
# 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
FOUND 1 /redo log file '.*ib_[?03]*\.log' 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

View File

@@ -1,7 +1,7 @@
call mtr.add_suppression("InnoDB: Header page consists of zero bytes in datafile:");
FLUSH TABLES;
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
# restart
# restart: --innodb-log-recovery-start=0
CREATE TABLE t3(a INT PRIMARY KEY) ENGINE=InnoDB;
BEGIN;
INSERT INTO t3 VALUES (33101),(347);
@@ -12,14 +12,14 @@ COMMIT;
# Kill the server
# Fault 0 (no real fault): Orphan file with duplicate space_id.
# Fault 1: Two dirty files with the same space_id.
# restart
# restart: --innodb-log-recovery-start=0
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /InnoDB: Ignoring data file '.*t2.ibd' with space ID \d+. Another data file called .*t1.ibd exists with the same space ID/ in mysqld.1.err
# Fault 4: Missing data file
# restart
# restart: --innodb-log-recovery-start=0
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
@@ -27,12 +27,12 @@ ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /InnoDB: Tablespace \d+ was not found at .*t[12].ibd.
.*InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace/ in mysqld.1.err
# Fault 5: Wrong type of data file
# restart
# restart: --innodb-log-recovery-start=0
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
# restart
# restart: --innodb-log-recovery-start=0
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
@@ -40,7 +40,7 @@ ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
NOT FOUND /\[Note\] InnoDB: Cannot read first page of .*t2.ibd/ in mysqld.1.err
FOUND 1 /.*\[ERROR\] InnoDB: Cannot apply log to \[page id: space=[1-9][0-9]*, page number=3\] of corrupted file './test/t2\.ibd'/ in mysqld.1.err
# Fault 2: Wrong space_id in a dirty file, and a missing file.
# restart
# restart: --innodb-log-recovery-start=0
SELECT * FROM t2;
a
9
@@ -81,7 +81,7 @@ RENAME TABLE u5 TO u6;
INSERT INTO u6 VALUES(2);
# Kill the server
# Fault 6: All-zero data file and innodb_force_recovery
# restart: --innodb-force-recovery=1
# restart: --innodb-force-recovery=1 --innodb-log-recovery-start=0
DROP TABLE u1,u2,u3,u6;
# List of files:
db.opt

View File

@@ -1,3 +1,9 @@
call mtr.add_suppression("InnoDB: innodb_log_archive_start=1234567 is after innodb_log_recovery_start=12345");
call mtr.add_suppression("InnoDB: innodb_log_archive=ON but .*/ib_logfile0 exists");
call mtr.add_suppression("InnoDB: No matching file found for innodb_log_recovery_start=");
call mtr.add_suppression("InnoDB: File .*/ib_logfile0 was not found");
call mtr.add_suppression("InnoDB: innodb_log_archive_start=\\d+ is after innodb_log_recovery_start=\\d+");
call mtr.add_suppression("InnoDB: Did not find innodb_log_recovery_start=\\d+ ");
SET GLOBAL innodb_log_file_size=4194304;
SHOW VARIABLES LIKE 'innodb_log_file_size';
Variable_name Value
@@ -11,7 +17,7 @@ a INT PRIMARY KEY AUTO_INCREMENT,
b CHAR(255) NOT NULL)
ENGINE=INNODB;
INSERT INTO t SELECT NULL, REPEAT('a', 255) FROM seq_1_to_20000;
# restart: --innodb-log-file-size=4194304
# restart: --innodb-log-file-size=4194304 --skip-innodb-log-archive
SELECT COUNT(*) FROM t;
COUNT(*)
20000
@@ -28,8 +34,19 @@ Got one of the listed errors
connect con1,localhost,root;
SET GLOBAL innodb_log_file_size=7340032;
connection default;
SET GLOBAL innodb_log_archive=ON;
SET GLOBAL innodb_log_archive=OFF;
KILL QUERY @id;
connection con1;
SET GLOBAL innodb_log_archive=ON, innodb_log_file_size=10485760;
SELECT @@GLOBAL.innodb_log_file_size!=10485760;
@@GLOBAL.innodb_log_file_size!=10485760
1
SET GLOBAL innodb_log_file_size=104857600;
SELECT @@GLOBAL.innodb_log_file_size<=10485760;
@@GLOBAL.innodb_log_file_size<=10485760
1
SET GLOBAL innodb_log_checkpoint_now=ON, innodb_log_archive=OFF;
connection default;
SET GLOBAL innodb_log_file_size=5242880;
connection con1;
@@ -45,6 +62,14 @@ global_value
connection con1;
disconnect con1;
connection default;
# restart: --innodb-log-recovery-start=12345 --innodb-log-archive-start=1234567
$check_no_innodb;
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /InnoDB: innodb_log_archive_start=1234567 is after innodb_log_recovery_start=12345/ in mysqld.1.err
# restart: --innodb-log-archive --innodb-log-file-size=4g
$check_no_innodb;
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /InnoDB: innodb_log_archive=ON but .*/ib_logfile0 exists/ in mysqld.1.err
# restart
SELECT * FROM t WHERE a<10;
a b
@@ -61,6 +86,23 @@ SELECT COUNT(*),LENGTH(b) FROM t GROUP BY b;
COUNT(*) LENGTH(b)
9 0
19991 255
SET GLOBAL innodb_log_archive=ON;
# restart: --innodb-log-recovery-start=12290
$check_no_innodb;
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /InnoDB: No matching file found for innodb_log_recovery_start=12290/ in mysqld.1.err
# restart: with restart_parameters
$check_no_innodb;
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
NOT FOUND /InnoDB: File .*/ib_logfile0 as not found/ in mysqld.1.err
FOUND 2 /InnoDB: innodb_log_archive_start=\d+ is after innodb_log_recovery_start=\d+/ in mysqld.1.err
# restart: with restart_parameters
$check_no_innodb;
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
# restart: with restart_parameters
SET GLOBAL innodb_log_archive=OFF;
FOUND 1 /InnoDB: setting innodb_log_archive=0 at innodb_log_recovery_start=.*/ in mysqld.1.err
FOUND 1 /InnoDB: setting innodb_log_archive=1 at innodb_log_recovery_start=.*/ in mysqld.1.err
SHOW VARIABLES LIKE 'innodb_log_file_size';
Variable_name Value
innodb_log_file_size 5242880

View File

@@ -2,7 +2,7 @@ call mtr.add_suppression("InnoDB: The change buffer is corrupted");
#
# MDEV-24412 InnoDB: Upgrade after a crash is not supported
#
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-force-recovery=5 --innodb-log-file-size=4m
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --skip-innodb-log-archive --innodb-force-recovery=5 --innodb-log-file-size=4m
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');

View File

@@ -1,7 +1,7 @@
call mtr.add_suppression("InnoDB: The change buffer is corrupted");
call mtr.add_suppression("InnoDB: Tablespace size stored in header is 768 pages, but the sum of data file sizes is 384 pages");
call mtr.add_suppression("InnoDB: adjusting FSP_SPACE_FLAGS of file");
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-force-recovery=5 --innodb-log-file-size=4m --innodb_page_size=32k --innodb_buffer_pool_size=11M
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_upgrade --skip-innodb-log-archive --innodb-force-recovery=5 --innodb-log-file-size=4m --innodb_page_size=32k --innodb_buffer_pool_size=11M
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');

View File

@@ -33,7 +33,7 @@ a
1
20
UPDATE t SET a=3 WHERE a=1;
# restart: --innodb-read-only
# restart: --innodb-read-only --innodb-log-recovery-start=0
SET GLOBAL innodb_status_output= @@GLOBAL.innodb_status_output;
# Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED.
# In earlier versions, this would return the last committed version

View File

@@ -25,7 +25,7 @@ SELECT * FROM t;
a
1
UPDATE t SET a=3 WHERE a=1;
# restart: --innodb-read-only
# restart: --innodb-read-only --innodb-log-recovery-start=0
# Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED.
# In earlier versions, this would return the last committed version
# (empty table)!

View File

@@ -1,4 +1,7 @@
call mtr.add_suppression("InnoDB: In RENAME TABLE table `test`.`t4` is referenced in foreign key constraints which are not compatible with the new table definition.");
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
call mtr.add_suppression("InnoDB: cannot fulfill innodb_log_recovery_target=20480<");
CREATE DATABASE test_jfg;
CREATE DATABASE test_jfg2;
CREATE TABLE test_jfg.test (a int unsigned PRIMARY KEY) ENGINE=InnoDB;
@@ -8,6 +11,13 @@ FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES WHERE filename LIKE '%test%';
path
./test_jfg2/test.ibd
DROP DATABASE test_jfg;
# restart: --innodb-log-recovery-target=20480
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
COUNT(*)
0
FOUND 1 /InnoDB: cannot fulfill innodb_log_recovery_target=20480</ in mysqld.1.err
# restart
DROP DATABASE test_jfg2;
CREATE DATABASE abc_def;

View File

@@ -25,7 +25,7 @@ c varchar(150), index k1(c(99), b(56)), index k2(b(5), c(10))) engine=InnoDB
row_format=redundant;
insert into t3 values(444, 'dddd', 'bbbbb', 'aaaaa');
insert into t3 values(555, 'eeee', 'ccccc', 'aaaaa');
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-data-file-path=ibdata1:1M:autoextend --innodb_undo_directory=MYSQLTEST_VARDIR/tmp/undo_dir --innodb-undo-tablespaces=0 --innodb-stats-persistent=0 --innodb-read-only
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-data-file-path=ibdata1:1M:autoextend --innodb_undo_directory=MYSQLTEST_VARDIR/tmp/undo_dir --innodb-undo-tablespaces=0 --innodb-stats-persistent=0 --innodb-read-only --innodb-log-recovery-start=0
SELECT COUNT(*) FROM t1;
COUNT(*)
4096
@@ -41,14 +41,14 @@ TRUNCATE TABLE t2;
ERROR HY000: Table 't2' is read only
TRUNCATE TABLE t3;
ERROR HY000: Table 't3' is read only
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-data-file-path=ibdata1:1M:autoextend --innodb_undo_directory=MYSQLTEST_VARDIR/tmp/undo_dir --innodb-undo-tablespaces=0 --innodb-stats-persistent=0 --skip-innodb-fast-shutdown
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-data-file-path=ibdata1:1M:autoextend --innodb_undo_directory=MYSQLTEST_VARDIR/tmp/undo_dir --innodb-undo-tablespaces=0 --innodb-stats-persistent=0 --skip-innodb-fast-shutdown --innodb-log-recovery-start=0
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
TRUNCATE TABLE t3;
corrupted SYS_TABLES.MIX_LEN for test/t1
corrupted SYS_TABLES.MIX_LEN for test/t2
corrupted SYS_TABLES.MIX_LEN for test/t3
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-data-file-path=ibdata1:1M:autoextend --innodb_undo_directory=MYSQLTEST_VARDIR/tmp/undo_dir --innodb-undo-tablespaces=0 --innodb-stats-persistent=0 --skip-innodb-fast-shutdown
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/row_format_redundant --innodb-data-file-path=ibdata1:1M:autoextend --innodb_undo_directory=MYSQLTEST_VARDIR/tmp/undo_dir --innodb-undo-tablespaces=0 --innodb-stats-persistent=0 --skip-innodb-fast-shutdown --innodb-log-recovery-start=0
TRUNCATE TABLE t1;
ERROR 42S02: Table 'test.t1' doesn't exist in engine
TRUNCATE TABLE t2;

View File

@@ -17,7 +17,7 @@ SET GLOBAL innodb_fast_shutdown=0;
SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0;
NAME FILE_SIZE
innodb_system 79691776
# restart
# restart: --innodb-log-recovery-start=0
SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0;
NAME FILE_SIZE
innodb_system 12582912

View File

@@ -2,6 +2,7 @@ call mtr.add_suppression("InnoDB: Cannot shrink the system tablespace");
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
call mtr.add_suppression("Plugin 'InnoDB' init function returned error");
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
call mtr.add_suppression("InnoDB: A copy of page \\[page id: space=0, page number=.*\\] in the doublewrite buffer slot .* is beyond the end");
SET GLOBAL INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG=2;
SET GLOBAL INNODB_FILE_PER_TABLE= 0;
Warnings:

View File

@@ -2,6 +2,7 @@ call mtr.add_suppression("InnoDB: Cannot shrink the system tablespace");
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
call mtr.add_suppression("Plugin 'InnoDB' init function returned error");
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
call mtr.add_suppression("InnoDB: A copy of page \\[page id: space=0, page number=.*\\] in the doublewrite buffer slot .* is beyond the end");
SET GLOBAL innodb_fast_shutdown=0;
# restart
SET GLOBAL INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG=2;

View File

@@ -130,7 +130,7 @@ call populate_t1();
ERROR HY000: The table 't1' is full
drop procedure populate_t1;
# test read-only mode
# restart: --innodb-read-only
# restart: --innodb-read-only --innodb-log-recovery-start=0
# files in MYSQL_DATA_DIR
select * from t1;
ERROR 42S02: Table 'test.t1' doesn't exist
@@ -140,7 +140,7 @@ create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine = innodb
ERROR HY000: Can't create table `test`.`t1` (errno: 165 "Table is read only")
SET GLOBAL innodb_encrypt_tables=DEFAULT;
# test various bad start-up parameters
FOUND 2 /InnoDB: Unable to create temporary file/ in mysqld.1.err
FOUND 1 /InnoDB: Unable to create temporary file/ in mysqld.1.err
# restart: --innodb_data_file_path=ibdata1:12M:autoextend --innodb_temp_data_file_path=ibdata1:12M:autoextend
FOUND 1 /innodb_temporary and innodb_system file names seem to be the same/ in mysqld.1.err
SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb'

View File

@@ -10,7 +10,7 @@ t CREATE TABLE `t` (
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
UNIQUE KEY `a` (`a`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
# restart
# restart: --innodb-log-recovery-start=0
SELECT * FROM t;
ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
TRUNCATE TABLE t;

View File

@@ -1,5 +1,5 @@
SET GLOBAL innodb_fast_shutdown=0;
# restart: --innodb_undo_tablespaces=2
# restart: --innodb_undo_tablespaces=2 --innodb-log-recovery-start=0
SET GLOBAL innodb_undo_log_truncate = 0;
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Page_Size Zip_Size Path
@@ -39,5 +39,5 @@ SET GLOBAL innodb_max_purge_lag_wait=0;
SET GLOBAL innodb_max_undo_log_size=DEFAULT;
SET GLOBAL innodb_max_purge_lag_wait=0;
set global innodb_fast_shutdown=0;
# restart
# restart: --innodb-log-recovery-start=0
drop table t1, t2;

View File

@@ -1,5 +1,5 @@
SET GLOBAL innodb_fast_shutdown=0;
# restart: --innodb_undo_tablespaces=2
# restart: --innodb_undo_tablespaces=2 --innodb-log-recovery-start=0
SET GLOBAL innodb_undo_log_truncate = 1;
create table t1(keyc int primary key, c char(100)) engine = innodb;
begin;

View File

@@ -27,7 +27,7 @@ undo004
XA COMMIT 'zombie';
# case 2: Successful innodb_undo_tablespace upgrade
SET GLOBAL innodb_fast_shutdown=0;
# restart: --innodb_undo_tablespaces=2
# restart: --innodb_undo_tablespaces=2 --innodb-log-recovery-start=0
# Display 2 undo tablespaces
SELECT @@global.innodb_undo_tablespaces;
@@global.innodb_undo_tablespaces
@@ -38,14 +38,14 @@ undo002
DROP TABLE t1;
InnoDB 0 transactions not purged
# case 3: Reduce the innodb_undo_tablespace to 0
# restart: --innodb_undo_tablespaces=0
# restart: --innodb_undo_tablespaces=0 --innodb-log-recovery-start=0
# Display 0 undo tablespace
SELECT @@global.innodb_undo_tablespaces;
@@global.innodb_undo_tablespaces
0
# Shouldn't list any undo log tablespaces
# case 4: Change undo tablespace when force_recovery < 5
# restart: --innodb_undo_tablespaces=2 --innodb_force_recovery=4
# restart: --innodb_undo_tablespaces=2 --innodb_force_recovery=4 --innodb-log-recovery-start=0
# Display 2 undo tablespace
SELECT @@global.innodb_undo_tablespaces;
@@global.innodb_undo_tablespaces
@@ -54,7 +54,7 @@ SELECT @@global.innodb_undo_tablespaces;
undo001
undo002
# case 5: Fail to change undo tablespace when force_recovery > 4
# restart: --innodb_undo_tablespaces=4 --innodb_force_recovery=5
# restart: --innodb_undo_tablespaces=4 --innodb_force_recovery=5 --innodb-log-recovery-start=0
# Display 2 undo tablespace
SELECT @@global.innodb_undo_tablespaces;
@@global.innodb_undo_tablespaces
@@ -67,22 +67,22 @@ undo002
# system tablespace in buf_dblwr_t::init_or_load_pages()
#
SET GLOBAL innodb_fast_shutdown=0;
# restart: --innodb_undo_tablespaces=4
# restart: --innodb_undo_tablespaces=4 --innodb-log-recovery-start=0
# Should list 4 undo log tablespaces
undo001
undo002
undo003
undo004
set global innodb_fast_shutdown=0;
# restart: --innodb_read_only=1
# restart: --innodb_read_only=1 --innodb-log-recovery-start=0
set global innodb_fast_shutdown=0;
# restart: --innodb-data-file-path=ibdata1:1M:autoextend --innodb_undo_directory=MYSQLTEST_VARDIR/tmp/undo_dir --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/bugdir --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/bugdir --innodb_undo_tablespaces=3
# restart: --innodb-data-file-path=ibdata1:1M:autoextend --innodb_undo_directory=MYSQLTEST_VARDIR/tmp/undo_dir --innodb-log-recovery-start=0 --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/bugdir --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/bugdir --innodb_undo_tablespaces=3
# Should list 3 undo log tablespaces
undo001
undo002
undo003
set global innodb_fast_shutdown=0;
# restart: --innodb-data-file-path=ibdata1:1M:autoextend --innodb_undo_directory=MYSQLTEST_VARDIR/tmp/undo_dir --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/bugdir_1 --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/bugdir_1 --innodb_undo_tablespaces=0
# restart: --innodb-data-file-path=ibdata1:1M:autoextend --innodb_undo_directory=MYSQLTEST_VARDIR/tmp/undo_dir --innodb-log-recovery-start=0 --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/bugdir_1 --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/bugdir_1 --innodb_undo_tablespaces=0
# Shouldn't list 0 undo log tablespaces
set global innodb_fast_shutdown=0;
# restart
# restart: --innodb-log-recovery-start=0

View File

@@ -7,33 +7,33 @@ call mtr.add_suppression("Plugin 'InnoDB' init function returned error");
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
set global innodb_fast_shutdown=0;
# case 1: Abort after resetting TRX_SYS page rollback segments
# restart: --innodb_undo_tablespaces=4 --debug_dbug=+d,after_rseg_reset_abort
# restart: --innodb_undo_tablespaces=4
# restart: --innodb-log-recovery-start=0 --innodb_undo_tablespaces=4 --debug_dbug=+d,after_rseg_reset_abort
# restart: --innodb-log-recovery-start=0 --innodb_undo_tablespaces=4
# Should list 4 undo log tablespaces
undo001
undo002
undo003
undo004
# case 2: Abort after deleting the old undo tablespaces
# restart: --innodb_undo_tablespaces=2 --debug_dbug=+d,after_deleting_old_undo_abort
# restart: --innodb_undo_tablespaces=2
# restart: --innodb-log-recovery-start=0 --innodb_undo_tablespaces=2 --debug_dbug=+d,after_deleting_old_undo_abort
# restart: --innodb-log-recovery-start=0 --innodb_undo_tablespaces=2
# Should list 2 undo log tablespaces
undo001
undo002
# case 3: Abort after successfully deleting the old undo tablespace
# restart: --innodb_undo_tablespaces=3 --debug_dbug=+d,after_deleting_old_undo_success
# restart: --innodb_undo_tablespaces=3
# restart: --innodb-log-recovery-start=0 --innodb_undo_tablespaces=3 --debug_dbug=+d,after_deleting_old_undo_success
# restart: --innodb-log-recovery-start=0 --innodb_undo_tablespaces=3
# Should list 3 undo log tablespaces
undo001
undo002
undo003
# restart: --innodb_undo_tablespaces=4
# restart: --innodb-log-recovery-start=0 --innodb_undo_tablespaces=4
# Should list 4 undo log tablespaces
undo001
undo002
undo003
undo004
# restart: --innodb_undo_tablespaces=2
# restart: --innodb-log-recovery-start=0 --innodb_undo_tablespaces=2
# Should list 2 undo log tablespaces
undo001
undo002

View File

@@ -99,7 +99,7 @@ convert_to_mariadb_101("$dd/test/ti.ibd", $ps);
convert_to_mariadb_101("$ENV{MYSQL_TMP_DIR}/test/tdd.ibd", $ps);
EOF
--let $restart_parameters=--innodb-read-only
--let $restart_parameters=--innodb-read-only --innodb-log-recovery-start=0
--source include/start_mysqld.inc
CHECK TABLE tr,tc,td,tz,tdd,tp,ti;
--source include/shutdown_mysqld.inc

View File

@@ -73,7 +73,7 @@ SELECT * FROM t1 WHERE MATCH(b,c) AGAINST ('column');
SHOW CREATE TABLE t1;
CHECK TABLE t1;
--let $restart_parameters= --innodb-read-only
--let $restart_parameters= --innodb-read-only --innodb-log-recovery-start=0
--source include/restart_mysqld.inc
--replace_regex /FTS_[0-9a-f]*_[0-9a-f]*/FTS/

View File

@@ -3,6 +3,7 @@
-- source include/not_embedded.inc
-- source include/no_valgrind_without_big.inc
-- source include/innodb_checksum_algorithm.inc
--source include/no_checkpoint_prepare.inc
let MYSQLD_DATADIR=`select @@datadir`;
let PAGE_SIZE=`select @@innodb_page_size`;
@@ -77,9 +78,9 @@ syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n";
close(FILE) || die "Unable to close $file";
EOF
-- let $restart_parameters=--innodb-flush-method=O_DIRECT
-- let $restart_parameters=--innodb-flush-method=O_DIRECT --innodb-log-recovery-start=0
-- source include/start_mysqld.inc
-- let $restart_parameters=
-- let $restart_parameters=--innodb-log-recovery-start=0
SELECT @@innodb_doublewrite;
--error ER_TABLE_CORRUPT
@@ -161,6 +162,7 @@ XA END 'x';
XA PREPARE 'x';
--connection default
--let CLEANUP_IF_CHECKPOINT=XA ROLLBACK 'x';DROP TABLE bug16735660;
--source ../include/no_checkpoint_end.inc
-- disconnect con1

View File

@@ -32,6 +32,7 @@ INSERT INTO t1 VALUES(1),(2),(3);
--remove_file $MYSQLD_DATADIR/test/t.ibd
--remove_file $MYSQLD_DATADIR/test/x@002e@002ed.ibd
--let $restart_parameters=--innodb-log-recovery-start=0
--source include/start_mysqld.inc
# The table does exist, only the tablespace does not exist.

View File

@@ -120,13 +120,13 @@ ALTER TABLE t10_1b IMPORT TABLESPACE;
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b;
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b FOR UPGRADE;
--let $restart_parameters=--innodb-read-only --read-only
--let $restart_parameters=--innodb-read-only --read-only --innodb-log-recovery-start=0
--source include/restart_mysqld.inc
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b;
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b FOR UPGRADE;
--let $restart_parameters=--innodb-read-only
--let $restart_parameters=--innodb-read-only --innodb-log-recovery-start=0
--source include/restart_mysqld.inc
CHECK TABLE t1, t1b, t1t, t1z, t5_7, t5_7b, t10_1, t10_1b;

View File

@@ -1,4 +1,5 @@
--source include/have_innodb.inc
--source include/no_checkpoint_prepare.inc
--disable_query_log
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
@@ -13,23 +14,60 @@ call mtr.add_suppression("InnoDB: Your database may be corrupt");
call mtr.add_suppression("InnoDB: MySQL-8\\.0 tablespace in .*test/t2\\.ibd");
call mtr.add_suppression("InnoDB: Restart in MySQL for migration/recovery\\.");
call mtr.add_suppression("Fewer engines are enabled now than were before the crash");
call mtr.add_suppression("InnoDB: Did not find innodb_log_recovery_start=");
call mtr.add_suppression("InnoDB: cannot fulfill innodb_log_recovery_target=");
# only issued for innodb_log_archive=OFF
call mtr.add_suppression("InnoDB: innodb_log_recovery_start=\\d+ is after innodb_log_recovery_target");
--enable_query_log
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
let ALGO=`select @@innodb_checksum_algorithm`;
CREATE TABLE t1(a BIGINT PRIMARY KEY) ENGINE=InnoDB;
let $before=`SELECT variable_value FROM information_schema.global_status
WHERE variable_name='innodb_lsn_current'`;
CREATE TABLE t1(a BIGINT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0;
INSERT INTO t1 VALUES(1);
# Force a redo log checkpoint.
let $restart_noprint=2;
--source include/restart_mysqld.inc
SET GLOBAL innodb_max_purge_lag_wait=0, innodb_log_checkpoint_now=ON;
--source ../include/no_checkpoint_start.inc
let $archived=`SELECT variable_value FROM information_schema.global_status
WHERE variable_name='innodb_lsn_archived'`;
connect stop_purge,localhost,root;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
CREATE TABLE t2(a BIGINT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(2);
SET GLOBAL innodb_flush_log_at_trx_commit=1;
let $after=`SELECT variable_value FROM information_schema.global_status
WHERE variable_name='innodb_lsn_current'`;
INSERT INTO t2 VALUES(1);
let $future=`SELECT variable_value+999999 FROM information_schema.global_status
WHERE variable_name='innodb_lsn_current'`;
--let CLEANUP_IF_CHECKPOINT=DROP TABLE t1,t2;
--source ../include/no_checkpoint_end.inc
disconnect stop_purge;
--let $restart_parameters=--innodb-log-recovery-target=$before --innodb-log-recovery-start=0
--source include/start_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE,ER_NO_SUCH_TABLE_IN_ENGINE
SELECT * FROM t2;
--let $restart_parameters=--innodb-log-recovery-target=$after --innodb-log-recovery-start=$before
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t2;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN=InnoDB: cannot fulfill innodb_log_recovery_target.*;
--source include/search_pattern_in_file.inc
--let $restart_parameters=--innodb-log-recovery-target=$before --innodb-log-recovery-start=$archived
--source include/restart_mysqld.inc
--error ER_OPEN_AS_READONLY,ER_UNKNOWN_STORAGE_ENGINE
DELETE FROM t1;
--error ER_OPEN_AS_READONLY,ER_NO_SUCH_TABLE_IN_ENGINE,ER_UNKNOWN_STORAGE_ENGINE
DELETE FROM t2;
--source include/shutdown_mysqld.inc
--echo # Corrupt the pages
@@ -76,11 +114,7 @@ EOF
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN=InnoDB: Page \\[page id: space=[1-9][0-9]*, page number=3\\] log sequence number 1311768467463790320 is in the future!;
--source include/search_pattern_in_file.inc
let $restart_parameters=--innodb_force_recovery=1;
let $restart_parameters=--innodb_force_recovery=1 --innodb-log-recovery-start=0;
--source include/restart_mysqld.inc
--error 0,ER_NO_SUCH_TABLE_IN_ENGINE
@@ -88,6 +122,9 @@ SELECT * FROM t1;
SELECT * FROM t2;
CHECK TABLE t2;
let SEARCH_PATTERN=InnoDB: Page \\[page id: space=[1-9][0-9]*, page number=3\\] log sequence number 1311768467463790320 is in the future!.*;
--source include/search_pattern_in_file.inc
DROP TABLE t1, t2;
# MDEV-21572 buf_page_get_gen() should apply buffered page
@@ -137,6 +174,13 @@ sysseek(FILE, $ps * 3, SEEK_SET) or die "seek";
syswrite(FILE, $page);
close FILE or die "close";
EOF
--let $restart_parameters=--innodb-log-recovery-start=$future
--source include/start_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN=InnoDB: Did not find innodb_log_recovery_start=\d+ .*;
--source include/search_pattern_in_file.inc
--let $restart_parameters=
--source include/restart_mysqld.inc
SELECT * FROM t1;
DROP TABLE t1;

View File

@@ -5,6 +5,8 @@
--source include/innodb_page_size.inc
--source include/not_embedded.inc
--source include/skip_innodb_log_archive.inc
--source include/no_checkpoint_prepare.inc
--disable_query_log
call mtr.add_suppression("InnoDB: Data file .* uses page size .* but the innodb_page_size start-up parameter is");
@@ -19,7 +21,7 @@ call mtr.add_suppression("InnoDB: Inconsistent tablespace ID in .*t1\\.ibd");
call mtr.add_suppression("\\[Warning\\] Found 1 prepared XA transactions");
call mtr.add_suppression("InnoDB: Header page consists of zero bytes in datafile:");
call mtr.add_suppression("InnoDB: Page \\[page id: space=[1-9][0-9]*, page number=3\\] log sequence number 18446744073709551615 is in the future!");
call mtr.add_suppression("InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the ib_logfile0");
call mtr.add_suppression("InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespaces but not the log");
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
--enable_query_log

View File

@@ -7,6 +7,7 @@
--source include/innodb_page_size.inc
--source include/have_debug.inc
--source include/not_embedded.inc
--source include/no_checkpoint_prepare.inc
--disable_query_log
call mtr.add_suppression("InnoDB: Data file .* uses page size .* but the innodb_page_size start-up parameter is");
call mtr.add_suppression("InnoDB: adjusting FSP_SPACE_FLAGS");
@@ -45,7 +46,7 @@ commit work;
# Slow shutdown and restart to make sure ibuf merge is finished
SET GLOBAL innodb_fast_shutdown = 0;
let $shutdown_timeout=;
let $restart_parameters=--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0;
let $restart_parameters=--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0 --innodb-log-recovery-start=0;
--source include/restart_mysqld.inc
--source ../include/no_checkpoint_start.inc
begin;
@@ -84,7 +85,7 @@ print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'});
close FILE;
EOF
let $restart_parameters=;
let $restart_parameters=--innodb-log-recovery-start=0;
--source include/start_mysqld.inc
let SEARCH_PATTERN=InnoDB: Recovered page \\[page id: space=0, page number=0\\];
@@ -101,7 +102,7 @@ select f1, f2 from t1;
--echo # Test Begin: Test if recovery works if 1st page of
--echo # system tablespace is corrupted and 2nd page as corrupted.
let $restart_parameters=--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0;
let $restart_parameters=--innodb-log-recovery-start=0 --debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0;
--source include/restart_mysqld.inc
--source ../include/no_checkpoint_start.inc
begin;
@@ -132,7 +133,7 @@ print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}/2);
close FILE;
EOF
let $restart_parameters=;
let $restart_parameters=--innodb-log-recovery-start=0;
--source include/start_mysqld.inc
let SEARCH_PATTERN=InnoDB: Recovered page \\[page id: space=0, page number=0\\];
@@ -159,7 +160,7 @@ WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
--let $ibp=--innodb-log-group-home-dir=$bugdir --innodb-data-home-dir=$bugdir
--let $ibp=$ibp --innodb-undo-tablespaces=0
--let $ibp=$ibp --innodb-undo-tablespaces=0 --innodb-log-recovery-start=0
--let $ibp=$ibp --innodb-data-file-path=ibdata1:1M;ibdata2:1M:autoextend
--let $restart_parameters= $ibp
@@ -167,10 +168,9 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED');
eval $check_no_innodb;
--let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot create doublewrite buffer
--source include/search_pattern_in_file.inc
--let $restart_parameters=
--let $restart_parameters=--innodb-log-recovery-start=0
--source include/restart_mysqld.inc
--remove_file $bugdir/ibdata1
--remove_file $bugdir/ibdata2
--remove_file $bugdir/ib_logfile0
--rmdir $bugdir

Some files were not shown because too many files have changed in this diff Show More