Re: [PATCH] add relation and block-level filtering to pg_waldump - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: [PATCH] add relation and block-level filtering to pg_waldump
Date
Msg-id CA+hUKGL0Uh7vVNCLCV4K=ZCG7nVXa1SHmqqJin9WFgRGxqNZcw@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] add relation and block-level filtering to pg_waldump  (Japin Li <japinli@hotmail.com>)
Responses Re: [PATCH] add relation and block-level filtering to pg_waldump  (Japin Li <japinli@hotmail.com>)
List pgsql-hackers
On Fri, Mar 25, 2022 at 1:43 PM Japin Li <japinli@hotmail.com> wrote:
> +       printf(_("  -x, --xid=XID          only show records with transaction ID XID\n"));
>
> I think the description of transaction ID is enough, IIUC, XID is use in core,
> which means transaction ID.

The mention of "XID" corresponds to XID on the left, like a sort of
variable.  That text is not changed by this patch.

> See: src/bin/pg_resetwal/pg_resetwal.c
>
> 1239     printf(_("  -V, --version                    output version information, then exit\n"));
> 1240     printf(_("  -x, --next-transaction-id=XID    set next transaction ID\n"));

Hmm, yeah that is inconsistent, but it seems like it is pg_resetwal.c
that is not following the notational convention there.  Other things
in pg_resetwal's --help use that 'variable' style.

> +                               if (sscanf(optarg, "%u/%u/%u",
> +                                                  &config.filter_by_relation.spcNode,
> +                                                  &config.filter_by_relation.dbNode,
> +                                                  &config.filter_by_relation.relNode) != 3 ||
> +                                       !OidIsValid(config.filter_by_relation.spcNode) ||
> +                                       !OidIsValid(config.filter_by_relation.relNode))
>
> It seems we should also check the dbNode.

This was discussed earlier: it's OK for the dbNode to be invalid (0),
because that's how shared relations like pg_database are referenced.
Like this:

$ pg_waldump pgdata/pg_wal/000000010000000000000001 --relation
1664/0/1262 --fork vm --limit 1
rmgr: Heap2       len (rec/tot):     64/  8256, tx:          0, lsn:
0/01491F20, prev 0/01491EC0, desc: VISIBLE cutoff xid 1 flags 0x03,
blkref #0: rel 1664/0/1262 fork vm blk 0 FPW, blkref #1: rel
1664/0/1262 blk 0

Thanks for looking!  I've now pushed the improvements discussed so far.



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Corruption during WAL replay
Next
From: "David G. Johnston"
Date:
Subject: Re: pg_dump new feature: exporting functions only. Bad or good idea ?