Re: please update ps display for recovery checkpoint - Mailing list pgsql-hackers

From Justin Pryzby
Subject Re: please update ps display for recovery checkpoint
Date
Msg-id 20201211040210.GZ24052@telsasoft.com
Whole thread Raw
In response to Re: please update ps display for recovery checkpoint  (Michael Paquier <michael@paquier.xyz>)
Responses Re: please update ps display for recovery checkpoint
List pgsql-hackers
Isn't the sense of "reset" inverted ?

I think maybe you mean to do set_ps_display(""); in the "if reset".

On Fri, Dec 11, 2020 at 12:54:22PM +0900, Michael Paquier wrote:
> +update_checkpoint_display(int flags, bool restartpoint, bool reset)
> +{
> +    if (reset)
> +    {
> +        char activitymsg[128];
> +
> +        snprintf(activitymsg, sizeof(activitymsg), "performing %s%s%s",
> +                 (flags & CHECKPOINT_END_OF_RECOVERY) ? "end-of-recovery " : "",
> +                 (flags & CHECKPOINT_IS_SHUTDOWN) ? "shutdown " : "",
> +                 restartpoint ? "restartpoint" : "checkpoint");
> +        set_ps_display(activitymsg);
> +    }
> +    else
> +        set_ps_display("");
> +}
> +
> +
>  /*
>   * Perform a checkpoint --- either during shutdown, or on-the-fly
>   *
> @@ -8905,6 +8937,9 @@ CreateCheckPoint(int flags)
>      if (log_checkpoints)
>          LogCheckpointStart(flags, false);
>  
> +    /* Update the process title */
> +    update_checkpoint_display(flags, false, false);
> +
>      TRACE_POSTGRESQL_CHECKPOINT_START(flags);
>  
>      /*
> @@ -9120,6 +9155,9 @@ CreateCheckPoint(int flags)
>      /* Real work is done, but log and update stats before releasing lock. */
>      LogCheckpointEnd(false);
>  
> +    /* Reset the process title */
> +    update_checkpoint_display(flags, false, true);
> +
>      TRACE_POSTGRESQL_CHECKPOINT_DONE(CheckpointStats.ckpt_bufs_written,
>                                       NBuffers,
>                                       CheckpointStats.ckpt_segs_added,
> @@ -9374,6 +9412,9 @@ CreateRestartPoint(int flags)
>      if (log_checkpoints)
>          LogCheckpointStart(flags, true);
>  
> +    /* Update the process title */
> +    update_checkpoint_display(flags, true, false);
> +
>      CheckPointGuts(lastCheckPoint.redo, flags);
>  
>      /*
> @@ -9492,6 +9533,9 @@ CreateRestartPoint(int flags)
>      /* Real work is done, but log and update before releasing lock. */
>      LogCheckpointEnd(true);
>  
> +    /* Reset the process title */
> +    update_checkpoint_display(flags, true, true);
> +
>      xtime = GetLatestXTime();
>      ereport((log_checkpoints ? LOG : DEBUG2),
>              (errmsg("recovery restart point at %X/%X",



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: please update ps display for recovery checkpoint
Next
From: Michael Paquier
Date:
Subject: Re: please update ps display for recovery checkpoint