Re: Use pgstat_progress_update_multi_param instead of single param update

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Use pgstat_progress_update_multi_param instead of single param update
Date: 2021-02-21 11:13:23
Message-ID: CALj2ACVsyRxQnAJYaf=Z-AbRUAeYa6W8e4TQ3_POEnHUWeuS4g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Feb 21, 2021 at 4:18 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Sun, Feb 21, 2021 at 11:30:21AM +0530, Bharath Rupireddy wrote:
> > Attached is a patch that replaces some subsequent multiple
> > update_param calls with a single update_multi_param.
>
> Looks mostly fine to me.
>
> - if (OidIsValid(indexOid))
> - pgstat_progress_update_param(PROGRESS_CLUSTER_COMMAND,
> - PROGRESS_CLUSTER_COMMAND_CLUSTER);
> - else
> - pgstat_progress_update_param(PROGRESS_CLUSTER_COMMAND,
> - PROGRESS_CLUSTER_COMMAND_VACUUM_FULL);
> + pgstat_progress_update_param(PROGRESS_CLUSTER_COMMAND,
> + OidIsValid(indexOid) ? PROGRESS_CLUSTER_COMMAND_CLUSTER :
> + PROGRESS_CLUSTER_COMMAND_VACUUM_FULL);
> What's the point of changing this one?

While we are at it, I wanted to use a single line statement instead of
if else, just like we do it in do_analyze_rel as below.

pgstat_progress_update_param(PROGRESS_ANALYZE_PHASE,
inh ?
PROGRESS_ANALYZE_PHASE_ACQUIRE_SAMPLE_ROWS_INH :
PROGRESS_ANALYZE_PHASE_ACQUIRE_SAMPLE_ROWS);

We can ignore it if it doesn't seem a good way.

With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2021-02-21 12:03:50 Re: [HACKERS] Custom compression methods
Previous Message Michael Paquier 2021-02-21 10:47:54 Re: Use pgstat_progress_update_multi_param instead of single param update