mariadb/extra/mariabackup
Marko Mäkelä a23414dd32 MDEV-27939 Log buffer wrap-around errors on PMEM
When the log is stored in persistent memory, log_sys.buf[] is
a ring buffer that directly maps to the circular ib_logfile0 file.

There were several errors that could occur in the special case
when a log record ends exactly at the end of the log file and the
next record would start at log_sys.buf[log_sys.START_OFFSET].

mariabackup.huge_lsn,strict_full_crc32: Write the first record
at the very end of the circular file, to reproduce the failure
scenarios.

recv_sys_t::parse(): On PMEM, wrap the end offset of the record
from log_sys.file_size to log_sys.START_OFFSET if needed.
Otherwise, both InnoDB recovery and mariadb-backup would try
to parse the next record from an invalid address.

filename_to_spacename(): Remove an assumption about the format
of file names. While the server currently writes file names like
./databasename/tablename.ibd we might want to stop writing the
redundant ./ prefix in the future. The test mariabackup.huge_lsn
is generating such file names.

xtrabackup_copy_logfile(): Correctly copy a record that ends at
the very end of the log_sys.buf[].

The errors in mariadb-backup were reproduced with the test
mariabackup.huge_lsn,strict_full_crc32 and an additional patch
to use the start checkpoint of the test:

diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 27dce5fa17d..e17a1692d6f 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -1796,7 +1796,8 @@ dberr_t recv_sys_t::find_checkpoint()
         continue;
       }

-      if (checkpoint_lsn >= log_sys.next_checkpoint_lsn)
+      if (checkpoint_lsn >= log_sys.next_checkpoint_lsn &&
+          checkpoint_lsn != 0x1000fffffe10)
       {
         log_sys.next_checkpoint_lsn= checkpoint_lsn;
         log_sys.next_checkpoint_no= field == log_t::CHECKPOINT_1;
2022-02-25 15:50:09 +02:00
..
quicklz
backup_copy.cc MDEV-14425 Improve the redo log for concurrency 2022-01-21 16:03:47 +02:00
backup_copy.h
backup_debug.h
backup_mysql.cc mariabackup: rename encryption_plugin -> xb_plugin 2021-10-27 15:55:14 +02:00
backup_mysql.h
backup_wsrep.h
changed_page_bitmap.cc MDEV-14425 Improve the redo log for concurrency 2022-01-21 16:03:47 +02:00
changed_page_bitmap.h MDEV-14425 Improve the redo log for concurrency 2022-01-21 16:03:47 +02:00
CMakeLists.txt MDEV-14425 Improve the redo log for concurrency 2022-01-21 16:03:47 +02:00
common.h
datasink.cc
datasink.h
ds_buffer.cc
ds_buffer.h
ds_compress.cc Merge 10.4 into 10.5 2021-11-09 08:50:33 +02:00
ds_compress.h
ds_local.cc
ds_local.h
ds_stdout.cc
ds_stdout.h
ds_tmpfile.cc
ds_tmpfile.h
ds_xbstream.cc Merge 10.4 into 10.5 2021-09-24 08:42:23 +03:00
ds_xbstream.h
fil_cur.cc
fil_cur.h
innobackupex.cc
innobackupex.h
read_filt.cc
read_filt.h
write_filt.cc
write_filt.h
wsrep.cc
xb_plugin.cc MDEV-14425 Improve the redo log for concurrency 2022-01-21 16:03:47 +02:00
xb_plugin.h mariabackup: rename encryption_plugin -> xb_plugin 2021-10-27 15:55:14 +02:00
xb_regex.h
xbcloud.cc
xbstream.cc Merge 10.4 into 10.5 2021-11-29 11:16:20 +02:00
xbstream.h
xbstream_read.cc
xbstream_write.cc
xtrabackup.cc MDEV-27939 Log buffer wrap-around errors on PMEM 2022-02-25 15:50:09 +02:00
xtrabackup.h MDEV-14425 Improve the redo log for concurrency 2022-01-21 16:03:47 +02:00