Re: please update ps display for recovery checkpoint

Justin Pryzby <pryzby@telsasoft.com>

From: Justin Pryzby <pryzby@telsasoft.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: "Bossart, Nathan" <bossartn@amazon.com>, Fujii Masao <masao.fujii@oss.nttdata.com>, "k.jamison@fujitsu.com" <k.jamison@fujitsu.com>, Thomas Munro <thomas.munro@gmail.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2020-12-11T04:02:10Z
Lists: 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",



Commits

  1. Provide recovery_init_sync_method=syncfs.

  2. Add some checkpoint/restartpoint status to ps display