1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Fix mariabackup InnoDB recovered binlog position on server upgrade

Before MariaDB 10.3.5, the binlog position was stored in the TRX_SYS page,
while after it is stored in rollback segments. There is code to read the
legacy position from TRX_SYS to handle upgrades. The problem was if the
legacy position happens to compare larger than the position found in
rollback segments; in this case, the old TRX_SYS position would incorrectly
be preferred over the newer position from rollback segments.

Fixed by always preferring a position from rollback segments over a legacy
position.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
Kristian Nielsen
2023-09-22 13:10:58 +02:00
parent f8f5ed2280
commit 9fa718b1a1
6 changed files with 104 additions and 1 deletions

View File

@ -124,3 +124,22 @@ sub ib_restore_ibd_files {
ib_restore_ibd_file($tmpd, $datadir, $db, $table);
}
}
# Read the flag whether a tablespace is using full_crc32.
# Input: filehandle opened on the tablespace.
sub get_full_crc32 {
my ($TBLSPC)= @_;
my $old_pos= sysseek($TBLSPC, 0, 1);
die "tell() failed on tablespace filehandle: $!\n"
unless defined($old_pos);
sysseek($TBLSPC, 0, 0)
or die "sysseek() failed on tablespace filehandle: $!\n";
my $tblspc_hdr;
sysread($TBLSPC, $tblspc_hdr, 58)
or die "Cannot read tablespace header: $!\n";
sysseek($TBLSPC, $old_pos, 0)
or die "sysseek() failed on tablespace filehandle: $!\n";
my $full_crc32=
unpack("N", substr($tblspc_hdr, 54, 4)) & 0x10; # FIL_SPACE_FLAGS
return $full_crc32;
}