Re: [PATCH] add relation and block-level filtering to pg_waldump

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Japin Li <japinli(at)hotmail(dot)com>
Cc: David Christensen <david(dot)christensen(at)crunchydata(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] add relation and block-level filtering to pg_waldump
Date: 2022-03-25 00:55:04
Message-ID: CA+hUKGL0Uh7vVNCLCV4K=ZCG7nVXa1SHmqqJin9WFgRGxqNZcw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 25, 2022 at 1:43 PM Japin Li <japinli(at)hotmail(dot)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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2022-03-25 01:02:29 Re: pg_dump new feature: exporting functions only. Bad or good idea ?
Previous Message Tom Lane 2022-03-25 00:45:07 Re: Corruption during WAL replay