Re: make the stats collector shutdown without writing the statsfiles if the immediate shutdown is requested.

From: Masahiro Ikeda <ikedamsh(at)oss(dot)nttdata(dot)com>
To: Zhihong Yu <zyu(at)yugabyte(dot)com>
Cc: kuroda(dot)hayato(at)fujitsu(dot)com, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: make the stats collector shutdown without writing the statsfiles if the immediate shutdown is requested.
Date: 2021-03-17 00:27:24
Message-ID: c5d405deecfe82442ef7f4cd9028c65d@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021-03-17 08:25, Zhihong Yu wrote:
> Hi,

Thanks for your comments!

> + * Simple signal handler for processes HAVE NOT yet touched or DO NOT
>
> I think there should be a 'which' between processes and HAVE. It seems
> the words in Capital letters should be in lower case.
>
> + * Simple signal handler for processes have touched shared memory to
> + * exit quickly.
>
> Add 'which' between processes and have.

OK, I fixed them.

> unlink(fname);
> +
> + elog(DEBUG2, "removing stats file \"%s\"", fname);
>
> It seems the return value from unlink should be checked and reflected
> in the debug message.

There are related codes that show log and call unlink() in slru.c and
pgstat.c.

```
pgstat_write_db_statsfile(PgStat_StatDBEntry *dbentry, bool permanent)
{
// some code
elog(DEBUG2, "removing temporary stats file \"%s\"", statfile);
unlink(statfile)
}
```

I fixed it in the same way instead of checking the return value because
IIUC, it's unimportant if an error has occurred. The log shows that just
to try
removing it. Though?

Regards,
--
Masahiro Ikeda
NTT DATA CORPORATION

Attachment Content-Type Size
v3-0001-pgstat_avoid_writing_on_sigquit.patch text/x-diff 6.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2021-03-17 01:31:39 Re: A new function to wait for the backend exit after termination
Previous Message Tom Lane 2021-03-16 23:36:10 Getting better results from valgrind leak tracking