From 9136bf9a60e94ac12fe60942642427d5ea2252ef Mon Sep 17 00:00:00 2001 From: Alexander Olekhnovich Date: Tue, 14 May 2024 15:18:15 +0200 Subject: [PATCH] Fix error taking a backup using PXB 8.0.35 Latest versions of PXB support only one type of stream and it should be specified using `=`. This fix makes it work for both 8.0.30 and recent versions. Also decreased expected value of bytes read in the test for the backup, it seems the default compression algorithm produces smaller file. Fixed counting of restored files: qpress files are not supported anymore. Default files use zstd format and end with .ztd.xbcrypt. --- .github/workflows/tests.yaml | 4 ++++ myhoard/basebackup_operation.py | 3 +-- myhoard/basebackup_restore_operation.py | 2 +- test/test_basebackup_operation.py | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index d33ab9b..bec0d7b 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -95,6 +95,10 @@ jobs: percona-version: "8.0.32-26-1.focal" python-version: "3.11" ubuntu-version: "20.04" + - mysql-version: "8.0.35" + percona-version: "8.0.35-30-1.focal" + python-version: "3.11" + ubuntu-version: "20.04" steps: - id: checkout-code diff --git a/myhoard/basebackup_operation.py b/myhoard/basebackup_operation.py index 252d3c6..efb3183 100644 --- a/myhoard/basebackup_operation.py +++ b/myhoard/basebackup_operation.py @@ -134,8 +134,7 @@ def create_backup(self): encryption_key_file.name, "--no-version-check", f"--parallel={self.copy_threads}", - "--stream", - "xbstream", + "--stream=xbstream", "--target-dir", self.temp_dir, "--extra-lsndir", diff --git a/myhoard/basebackup_restore_operation.py b/myhoard/basebackup_restore_operation.py index 0c19dd5..fda72eb 100644 --- a/myhoard/basebackup_restore_operation.py +++ b/myhoard/basebackup_restore_operation.py @@ -327,7 +327,7 @@ def _process_xbstream_output_line(self, line: str, _stream_name: str) -> None: self.log.info("xbstream: %r", line) def _process_xbstream_output_line_new_file(self, line): - if not line.endswith(".qp.xbcrypt"): + if not line.endswith(".xbcrypt"): return False self.current_file = line diff --git a/test/test_basebackup_operation.py b/test/test_basebackup_operation.py index 807fcac..94c9522 100644 --- a/test/test_basebackup_operation.py +++ b/test/test_basebackup_operation.py @@ -92,8 +92,8 @@ def stream_handler(stream): assert op.binlog_info["file_name"] == master_status["File"] assert op.binlog_info["file_position"] == master_status["Position"] - # Even almost empty backup is a few megs due to standard files that are always included - assert bytes_read[0] > 2 * 1024 * 1024 + # Even almost empty backup is at least 1.5 megs due to standard files that are always included + assert bytes_read[0] > 1.5 * 1024 * 1024 def test_stream_handler_error_is_propagated(mysql_master):