This is an automated email from the ASF dual-hosted git repository.

tuhaihe pushed a commit to branch REL_2_STABLE
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit c83305f2b95e8951e5cc8e4fc6b18421ec312cce
Author: reshke <[email protected]>
AuthorDate: Tue Sep 22 13:36:10 2026 +0300

    Backport fixup: relax magic number check in 039_end_of_wal split case
    
    Cloudberry writes an extra distributed-commit WAL record after every
    statement, so the insert LSN that advance_to_record_splitting_zone()
    calibrates ends up 8 bytes further away from the page boundary than in
    upstream.  Consequently the bytes of the synthetic record header that
    spill over to the next page overwrite xlp_magic with bytes of xl_prev
    (BEEF) instead of the zeroed xl_info/xl_rmid (0000).  Any invalid magic
    number still proves that the page header is validated before the record
    header, so accept any 4-hex magic there.
---
 src/test/recovery/t/039_end_of_wal.pl | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/test/recovery/t/039_end_of_wal.pl 
b/src/test/recovery/t/039_end_of_wal.pl
index 1d1d883be6a..8d652354dd9 100644
--- a/src/test/recovery/t/039_end_of_wal.pl
+++ b/src/test/recovery/t/039_end_of_wal.pl
@@ -448,7 +448,16 @@ write_wal($node, $TLI, $end_lsn,
        build_record_header(2 * 1024 * 1024 * 1024, 0, 0xdeadbeef));
 $log_size = -s $node->logfile;
 $node->start;
-ok($node->log_contains("invalid magic number 0000 ", $log_size),
+# The bytes of the split record header that spill over to the new page
+# overwrite xlp_magic.  In upstream the spill-over is the xl_info/xl_rmid
+# padding bytes, which are zero here, but Cloudberry writes an extra
+# distributed-commit WAL record after every statement, so the calibrated
+# insert LSN ends up 8 bytes further and the xl_prev bytes land on
+# xlp_magic instead.  Accept any magic number here; the point of the
+# test is that the page header is validated first.
+ok( $node->log_contains(
+               "invalid magic number [0-9A-F]{4} in log segment",
+               $log_size),
        "xlp_magic zero (split record header)");
 
 # And we'll also check xlp_pageaddr before any header checks.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to