Re: pg_stat_progress_basebackup - progress reporting forpg_basebackup, in the server side - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: pg_stat_progress_basebackup - progress reporting forpg_basebackup, in the server side
Date
Msg-id 20200319023829.GA27388@alvherre.pgsql
Whole thread Raw
In response to Re: pg_stat_progress_basebackup - progress reporting forpg_basebackup, in the server side  (Amit Langote <amitlangote09@gmail.com>)
List pgsql-hackers
On 2020-Mar-19, Amit Langote wrote:

> On Thu, Mar 19, 2020 at 11:24 AM Alvaro Herrera
> <alvherre@2ndquadrant.com> wrote:
> > On 2020-Mar-19, Amit Langote wrote:
> >
> > > Magnus' idea of checking the values in pg_stat_get_progress_info() to
> > > determine whether to return NULL seems fine to me.  We will need to
> > > update the documentation of st_progress_param, because it currently
> > > says:
> > >
> > >      *  ...but the meaning of each element in the
> > >      * st_progress_param array is command-specific.
> > >      */
> > >     ProgressCommandType st_progress_command;
> > >     Oid         st_progress_command_target;
> > >     int64       st_progress_param[PGSTAT_NUM_PROGRESS_PARAM];
> > > } PgBackendStatus;
> > >
> > > If we are to define -1 in st_progress_param[] as NULL to the users,
> > > that must be mentioned here.
> >
> > Hmm, why -1?  It seems like a value that we might want to use for other
> > purposes in other params.  Maybe INT64_MIN is a better choice?
> 
> Yes, maybe.

Looking at the code involved, I think it's okay to use -1 in that
specific param and teach the SQL query to display null when it finds
that value.  We have plenty of magic numbers in the progress params, and
it's always the definition of the view that interprets them.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Corey Huinker
Date:
Subject: Re: Add A Glossary
Next
From: Michael Paquier
Date:
Subject: Re: type of some table storage params on doc