Re: pg_waldump stucks with options --follow or -f and --stats or -z

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_waldump stucks with options --follow or -f and --stats or -z
Date: 2021-11-26 10:17:30
Message-ID: CALj2ACX+mjtiP-wfEA3wZXmqAPxTC8GBO_=E7J5Cf9Y4BwxK3w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 26, 2021 at 11:50 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Sat, Nov 20, 2021 at 11:46:35AM +0530, Bharath Rupireddy wrote:
> > Thanks. Here's the v3 patch, a much simpler one. Please review it.
>
> + pqsignal(SIGINT, SignalHandlerForTermination);
> + pqsignal(SIGTERM, SignalHandlerForTermination);
> + pqsignal(SIGQUIT, SignalHandlerForTermination);
> FWIW, I think that we should do this stuff only on SIGINT. I would
> imagine that this behavior becomes handy mainly when one wishes to
> Ctrl+C the terminal running pg_waldump but still get some
> information.

Done.

> XLogDumpCountRecord(&config, &stats, xlogreader_state);
> + stats.endptr = xlogreader_state->currRecPtr;
> Isn't what you are looking for here EndRecPtr rather than currRecPtr,
> to track the end of the last record read?

You are right.

> + When <option>--follow</option> is used with <option>--stats</option> and
> + the <application>pg_waldump</application> is terminated or interrupted
> + with signal <systemitem>SIGINT</systemitem> or <systemitem>SIGTERM</systemitem>
> + or <systemitem>SIGQUIT</systemitem>, the summary statistics computed
> + as of the termination will be displayed.
> This description is not completely correct, as the set of stats would
> show up only by using --stats, in non-quiet mode. Rather than
> describing this behavior at the end of the docs, I think that it would
> be better to add a new paragraph in the description of --stats.

Done.

PSA v4 patch.

Regards,
Bharath Rupireddy.

Attachment Content-Type Size
v4-0001-pg_waldump-emit-stats-while-terminating.patch application/octet-stream 4.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marcos Pegoraro 2021-11-26 12:17:55 Re: pg_upgrade and publication/subscription problem
Previous Message Julien Rouhaud 2021-11-26 09:23:12 Re: Inconsistent results from seqscan and gist indexscan