diff options
| author | Tom Lane | 2023-05-19 21:24:48 +0000 |
|---|---|---|
| committer | Tom Lane | 2023-05-19 21:24:48 +0000 |
| commit | 0245f8db36f375326c2bae0c3420d3c77714e72d (patch) | |
| tree | 7ce91f23658a05ea24be4703fb06cdc6b56248f7 /contrib/amcheck | |
| parent | df6b19fbbc20d830de91d9bea68715a39635b568 (diff) | |
Pre-beta mechanical code beautification.
Run pgindent, pgperltidy, and reformat-dat-files.
This set of diffs is a bit larger than typical. We've updated to
pg_bsd_indent 2.1.2, which properly indents variable declarations that
have multi-line initialization expressions (the continuation lines are
now indented one tab stop). We've also updated to perltidy version
20230309 and changed some of its settings, which reduces its desire to
add whitespace to lines to make assignments etc. line up. Going
forward, that should make for fewer random-seeming changes to existing
code.
Discussion: https://postgr.es/m/20230428092545.qfb3y5wcu4cm75ur@alvherre.pgsql
Diffstat (limited to 'contrib/amcheck')
| -rw-r--r-- | contrib/amcheck/t/001_verify_heapam.pl | 4 | ||||
| -rw-r--r-- | contrib/amcheck/t/003_cic_2pc.pl | 21 | ||||
| -rw-r--r-- | contrib/amcheck/verify_heapam.c | 34 |
3 files changed, 33 insertions, 26 deletions
diff --git a/contrib/amcheck/t/001_verify_heapam.pl b/contrib/amcheck/t/001_verify_heapam.pl index 1aedebe4307..46d5b53181e 100644 --- a/contrib/amcheck/t/001_verify_heapam.pl +++ b/contrib/amcheck/t/001_verify_heapam.pl @@ -81,7 +81,7 @@ sub relation_filepath my ($relname) = @_; my $pgdata = $node->data_dir; - my $rel = $node->safe_psql('postgres', + my $rel = $node->safe_psql('postgres', qq(SELECT pg_relation_filepath('$relname'))); die "path not found for relation $relname" unless defined $rel; return "$pgdata/$rel"; @@ -267,7 +267,7 @@ sub check_all_options_uncorrupted for my $endblock (qw(NULL 0)) { my $opts = - "on_error_stop := $stop, " + "on_error_stop := $stop, " . "check_toast := $check_toast, " . "skip := $skip, " . "startblock := $startblock, " diff --git a/contrib/amcheck/t/003_cic_2pc.pl b/contrib/amcheck/t/003_cic_2pc.pl index 5323ed11ae9..3279a2505a3 100644 --- a/contrib/amcheck/t/003_cic_2pc.pl +++ b/contrib/amcheck/t/003_cic_2pc.pl @@ -38,30 +38,35 @@ $node->safe_psql('postgres', q(CREATE TABLE tbl(i int))); my $main_h = $node->background_psql('postgres'); -$main_h->query_safe(q( +$main_h->query_safe( + q( BEGIN; INSERT INTO tbl VALUES(0); )); my $cic_h = $node->background_psql('postgres'); -$cic_h->query_until(qr/start/, q( +$cic_h->query_until( + qr/start/, q( \echo start CREATE INDEX CONCURRENTLY idx ON tbl(i); )); -$main_h->query_safe(q( +$main_h->query_safe( + q( PREPARE TRANSACTION 'a'; )); -$main_h->query_safe(q( +$main_h->query_safe( + q( BEGIN; INSERT INTO tbl VALUES(0); )); $node->safe_psql('postgres', q(COMMIT PREPARED 'a';)); -$main_h->query_safe(q( +$main_h->query_safe( + q( PREPARE TRANSACTION 'b'; BEGIN; INSERT INTO tbl VALUES(0); @@ -69,7 +74,8 @@ INSERT INTO tbl VALUES(0); $node->safe_psql('postgres', q(COMMIT PREPARED 'b';)); -$main_h->query_safe(q( +$main_h->query_safe( + q( PREPARE TRANSACTION 'c'; COMMIT PREPARED 'c'; )); @@ -97,7 +103,8 @@ PREPARE TRANSACTION 'persists_forever'; $node->restart; my $reindex_h = $node->background_psql('postgres'); -$reindex_h->query_until(qr/start/, q( +$reindex_h->query_until( + qr/start/, q( \echo start DROP INDEX CONCURRENTLY idx; CREATE INDEX CONCURRENTLY idx ON tbl(i); diff --git a/contrib/amcheck/verify_heapam.c b/contrib/amcheck/verify_heapam.c index 34d73ad442f..97f3253522b 100644 --- a/contrib/amcheck/verify_heapam.c +++ b/contrib/amcheck/verify_heapam.c @@ -407,7 +407,7 @@ verify_heapam(PG_FUNCTION_ARGS) OffsetNumber successor[MaxOffsetNumber]; bool lp_valid[MaxOffsetNumber]; bool xmin_commit_status_ok[MaxOffsetNumber]; - XidCommitStatus xmin_commit_status[MaxOffsetNumber]; + XidCommitStatus xmin_commit_status[MaxOffsetNumber]; CHECK_FOR_INTERRUPTS(); @@ -444,7 +444,7 @@ verify_heapam(PG_FUNCTION_ARGS) for (ctx.offnum = FirstOffsetNumber; ctx.offnum <= maxoff; ctx.offnum = OffsetNumberNext(ctx.offnum)) { - BlockNumber nextblkno; + BlockNumber nextblkno; OffsetNumber nextoffnum; successor[ctx.offnum] = InvalidOffsetNumber; @@ -484,9 +484,9 @@ verify_heapam(PG_FUNCTION_ARGS) /* * Since we've checked that this redirect points to a line - * pointer between FirstOffsetNumber and maxoff, it should - * now be safe to fetch the referenced line pointer. We expect - * it to be LP_NORMAL; if not, that's corruption. + * pointer between FirstOffsetNumber and maxoff, it should now + * be safe to fetch the referenced line pointer. We expect it + * to be LP_NORMAL; if not, that's corruption. */ rditem = PageGetItemId(ctx.page, rdoffnum); if (!ItemIdIsUsed(rditem)) @@ -610,8 +610,8 @@ verify_heapam(PG_FUNCTION_ARGS) { /* * We should not have set successor[ctx.offnum] to a value - * other than InvalidOffsetNumber unless that line pointer - * is LP_NORMAL. + * other than InvalidOffsetNumber unless that line pointer is + * LP_NORMAL. */ Assert(ItemIdIsNormal(next_lp)); @@ -642,8 +642,8 @@ verify_heapam(PG_FUNCTION_ARGS) } /* - * If the next line pointer is a redirect, or if it's a tuple - * but the XMAX of this tuple doesn't match the XMIN of the next + * If the next line pointer is a redirect, or if it's a tuple but + * the XMAX of this tuple doesn't match the XMIN of the next * tuple, then the two aren't part of the same update chain and * there is nothing more to do. */ @@ -667,8 +667,8 @@ verify_heapam(PG_FUNCTION_ARGS) } /* - * This tuple and the tuple to which it points seem to be part - * of an update chain. + * This tuple and the tuple to which it points seem to be part of + * an update chain. */ predecessor[nextoffnum] = ctx.offnum; @@ -721,8 +721,8 @@ verify_heapam(PG_FUNCTION_ARGS) } /* - * If the current tuple's xmin is aborted but the successor tuple's - * xmin is in-progress or committed, that's corruption. + * If the current tuple's xmin is aborted but the successor + * tuple's xmin is in-progress or committed, that's corruption. */ if (xmin_commit_status_ok[ctx.offnum] && xmin_commit_status[ctx.offnum] == XID_ABORTED && @@ -1025,7 +1025,7 @@ check_tuple_visibility(HeapCheckContext *ctx, bool *xmin_commit_status_ok, HeapTupleHeader tuphdr = ctx->tuphdr; ctx->tuple_could_be_pruned = true; /* have not yet proven otherwise */ - *xmin_commit_status_ok = false; /* have not yet proven otherwise */ + *xmin_commit_status_ok = false; /* have not yet proven otherwise */ /* If xmin is normal, it should be within valid range */ xmin = HeapTupleHeaderGetXmin(tuphdr); @@ -1837,7 +1837,7 @@ check_tuple(HeapCheckContext *ctx, bool *xmin_commit_status_ok, * therefore cannot check it. */ if (!check_tuple_visibility(ctx, xmin_commit_status_ok, - xmin_commit_status)) + xmin_commit_status)) return; /* @@ -1897,8 +1897,8 @@ FullTransactionIdFromXidAndCtx(TransactionId xid, const HeapCheckContext *ctx) diff = (int32) (ctx->next_xid - xid); /* - * In cases of corruption we might see a 32bit xid that is before epoch - * 0. We can't represent that as a 64bit xid, due to 64bit xids being + * In cases of corruption we might see a 32bit xid that is before epoch 0. + * We can't represent that as a 64bit xid, due to 64bit xids being * unsigned integers, without the modulo arithmetic of 32bit xid. There's * no really nice way to deal with that, but it works ok enough to use * FirstNormalFullTransactionId in that case, as a freshly initdb'd |
