Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion storage/innobase/srv/srv0start.cc
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ static dberr_t srv_undo_tablespace_read_encryption(pfs_os_file_t fh,

if (found && recv_key->lsn >= page_lsn) {
// Condition 1: Use key from redo if available and appropriate
encryption_success = use_dumped_tablespace_keys
encryption_success = (use_dumped_tablespace_keys && !srv_backup_mode)
? load_key_from_dump()
: set_encryption(recv_key->ptr, recv_key->iv);
} else if (is_enc) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#
# Stable reproduction: assertion failure in xb_set_encryption() during
# backup with --transition-key when undo encryption keys exist in redo log.
#
# Strategy:
# 1. Force a checkpoint to establish a clean baseline on disk.
# 2. Freeze page cleaner and checkpoint so the undo page stays unflushed.
# 3. Rotate master key — writes a new undo encryption key entry to redo log
# while the on-disk undo page retains the pre-rotation LSN.
# 4. Start backup with --transition-key (sets use_dumped_tablespace_keys=true).
#
# This guarantees recv_find_encryption_key() returns found=true with
# recv_key->lsn > page_lsn, entering the buggy Condition 1 branch.
#

require_server_version_higher_than 8.4.0
require_debug_server

KEYRING_TYPE="component"
. inc/keyring_common.sh
. inc/keyring_file.sh
configure_server_with_component

mysql -e "CREATE TABLE t (a INT) ENCRYPTION='y'" test
mysql -e "INSERT INTO t VALUES (1)" test

# Force checkpoint, then freeze page cleaner and checkpoint.
# Rotate master key AFTER freezing so the undo page is not flushed to disk.
mysql test <<EOF
SET GLOBAL innodb_log_checkpoint_now = 1;
SET GLOBAL innodb_page_cleaner_disabled_debug = 1;
SET GLOBAL innodb_checkpoint_disabled = 1;
ALTER INSTANCE ROTATE INNODB MASTER KEY;
EOF

xtrabackup --backup --transition-key=123 --target-dir=$topdir/backup
xtrabackup --prepare --transition-key=123 --target-dir=$topdir/backup