v5-0001-pg_amcheck-continuing-to-fix-portability-problems.patch
application/octet-stream
Filename: v5-0001-pg_amcheck-continuing-to-fix-portability-problems.patch
Type: application/octet-stream
Part: 0
Message:
Re: pg_amcheck contrib application
Patch
Format: format-patch
Series: patch v5-0001
Subject: pg_amcheck: continuing to fix portability problems
| File | + | − |
|---|---|---|
| src/bin/pg_amcheck/t/004_verify_heapam.pl | 11 | 9 |
From 41a0b3155b27b8fa989ee53f1bcbc2faf867af6f Mon Sep 17 00:00:00 2001
From: Mark Dilger <mark.dilger@enterprisedb.com>
Date: Fri, 12 Mar 2021 22:30:48 -0800
Subject: [PATCH v5] pg_amcheck: continuing to fix portability problems
Fixing a problem in the tests depending on Q/q perl pack codes, but
they don't work on all versions of perl.
---
src/bin/pg_amcheck/t/004_verify_heapam.pl | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/bin/pg_amcheck/t/004_verify_heapam.pl b/src/bin/pg_amcheck/t/004_verify_heapam.pl
index 4cb34a0e01..6cff3b9343 100644
--- a/src/bin/pg_amcheck/t/004_verify_heapam.pl
+++ b/src/bin/pg_amcheck/t/004_verify_heapam.pl
@@ -57,7 +57,6 @@ use Test::More;
# L = "Unsigned 32-bit Long",
# S = "Unsigned 16-bit Short",
# C = "Unsigned 8-bit Octet",
-# q = "signed 64-bit quadword"
#
# Each tuple in our table has a layout as follows:
#
@@ -71,7 +70,7 @@ use Test::More;
# xx xx t_infomask: xx offset = 20 S
# xx t_hoff: x offset = 22 C
# xx t_bits: x offset = 23 C
-# xx xx xx xx xx xx xx xx 'a': xxxxxxxx offset = 24 q
+# xx xx xx xx xx xx xx xx 'a': xxxxxxxx offset = 24 LL
# xx xx xx xx xx xx xx xx 'b': xxxxxxxx offset = 32 CCCCCCCC
# xx xx xx xx xx xx xx xx 'c': xxxxxxxx offset = 40 CCllLL
# xx xx xx xx xx xx xx xx : xxxxxxxx ...continued
@@ -81,7 +80,7 @@ use Test::More;
# it is convenient enough to do it this way. We define packing code
# constants here, where they can be compared easily against the layout.
-use constant HEAPTUPLE_PACK_CODE => 'LLLSSSSSCCqCCCCCCCCCCllLL';
+use constant HEAPTUPLE_PACK_CODE => 'LLLSSSSSCCLLCCCCCCCCCCllLL';
use constant HEAPTUPLE_PACK_LENGTH => 58; # Total size
# Read a tuple of our table from a heap page.
@@ -112,7 +111,8 @@ sub read_tuple
t_infomask => shift,
t_hoff => shift,
t_bits => shift,
- a => shift,
+ a_1 => shift,
+ a_2 => shift,
b_header => shift,
b_body1 => shift,
b_body2 => shift,
@@ -156,7 +156,8 @@ sub write_tuple
$tup->{t_infomask},
$tup->{t_hoff},
$tup->{t_bits},
- $tup->{a},
+ $tup->{a_1},
+ $tup->{a_2},
$tup->{b_header},
$tup->{b_body1},
$tup->{b_body2},
@@ -227,7 +228,7 @@ use constant ROWCOUNT => 16;
$node->safe_psql('postgres', qq(
INSERT INTO public.test (a, b, c)
VALUES (
- 12345678,
+ 0,
'abcdefg',
repeat('w', 10000)
);
@@ -275,13 +276,14 @@ for (my $tupidx = 0; $tupidx < ROWCOUNT; $tupidx++)
my $tup = read_tuple($file, $offset);
# Sanity-check that the data appears on the page where we expect.
- my $a = $tup->{a};
+ my $a_1 = $tup->{a_1};
+ my $a_2 = $tup->{a_2};
my $b = $tup->{b};
- if ($a ne '12345678' || $b ne 'abcdefg')
+ if ($a_1 ne '0' || $a_2 ne '0' || $b ne 'abcdefg')
{
close($file); # ignore errors on close; we're exiting anyway
$node->clean_node;
- plan skip_all => qq(Page layout differs from our expectations: expected (12345678, "abcdefg"), got ($a, "$b"));
+ plan skip_all => qq(Page layout differs from our expectations: expected (0, 0, "abcdefg"), got ($a_1, $a_2, "$b"));
exit;
}
--
2.21.1 (Apple Git-122.3)