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-20 04:33:27
Message-ID: CALj2ACVzUGsO9yo-Sf_QkQ3yX-5QzA4TySK+Eg0QyuY+ez_0=g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 18, 2021 at 2:03 PM Bharath Rupireddy
<bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
>
> On Thu, Nov 18, 2021 at 1:51 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> >
> > On Thu, Nov 18, 2021 at 01:32:08PM +0530, Bharath Rupireddy wrote:
> > > Hm. So, the pg_waldump can have handlers for SIGINT, SIGTERM, SIGQUIT
> > > and then it should emit the computed stats in those handlers the
> > > comobinations - "-s/-f/-z" and "-s/-e/-f/-z". I'm okay with this
> > > behaviour. Michael Paquier had suggested the same upthread. If okay, I
> > > will work on that patch.
> >
> > While on it, I am pretty sure that we should add in the stats report
> > the start and end LSNs matching with the reports. If you use --follow
> > and the call is interrupted, we would not really know to which part of
> > the WAL stream a report applies to without this information, likely in
> > the shape of an extra header.
>
> Currently, the SIGINT, SIGTERM, SIGQUIT interruptions will cause the pg_waldump process with --follow option to get killed. And it is a good idea to specify the range of LSNs (start and end) upto which the stats are computed. Maybe as another printf message at the end of the stats report, after the "Total" section or at the beginning of the stats report. Something like "summary of the statistics computed from << LSN >> to <<LSN>> are:", see [1].

Here's the v2 patch with the above changes i.e. pg_waldump now eimits
the computed stats at the time of termination. Please review it.

Regards,
Bharath Rupireddy.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2021-11-20 05:18:23 Re: XLogReadRecord() error in XlogReadTwoPhaseData()
Previous Message Mark Dilger 2021-11-20 00:45:50 Re: Non-superuser subscription owners