pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: ***SPAM***  Re: WARNING: could not open statistics file "pg_stat_tmp/global.stat": Operation not permitted
2+ messages / 2 participants
[nested] [flat]

* Re: ***SPAM***  Re: WARNING: could not open statistics file "pg_stat_tmp/global.stat": Operation not permitted
@ 2022-09-09 04:08 Perry Smith <pedz@easesoftware.com>
  2022-09-09 04:12 ` Re: ***SPAM*** Re: WARNING: could not open statistics file "pg_stat_tmp/global.stat": Operation not permitted Mladen Gogala <gogala.mladen@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Perry Smith @ 2022-09-09 04:08 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-general list <pgsql-general@lists.postgresql.org>


> On Sep 8, 2022, at 10:43 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 
> Perry Smith <pedz@easesoftware.com> writes:
>> From within the container, files which I assume are created by
>> PostgreSQL are ending up being owned by root rather than Postgres.
> 
> If it looks that way from *inside* the container, that's not good
> --- wouldn't that prevent Postgres from reading the files?
> 
>> The reason I’m sending this note to the general list is to ask how bad
>> is this error?  Some “solutions” are to make the pg_stat_tmp directory
>> internal to the image and that somehow resolves the issue but I don’t
>> think anyone really understands why and things like that bother me.  But
>> I’m also curious if that appears to be a viable solution.  The result
>> will be that when the Postgres is stopped and the container exited, the
>> next time Postgres starts back up, the pg_stat_tmp directory will be
>> gone.  Is that ok?
> 
> pg_stat_tmp exists specifically because it holds only temporary files,
> cf
> 
> https://www.postgresql.org/docs/devel/storage-file-layout.html
> 
> It's explicitly cleared out during server start.
> 
> The only reason to put it outside the data directory is to make it
> *less* persistent than the rest of PG's files, say by putting it
> on a RAM disk.  You sound like you've set it up to be *more*
> persistent (ie outside the container not inside), which surely is
> exactly backwards.

The data directory is outside so it is persistent.  The pg_stat_tmp is inside the data directory.  This is how whoever builds the “official” Postgres images set things up.

If the right solution is to not make it part of the data directory, I can change that.  One of the solutions explains how which solves the Postgres issue but still leaves open the question of how and why do some of the files get owned by root (which probably is a Docker or a Linux issue).







^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: ***SPAM*** Re: WARNING: could not open statistics file "pg_stat_tmp/global.stat": Operation not permitted
  2022-09-09 04:08 Re: ***SPAM***  Re: WARNING: could not open statistics file "pg_stat_tmp/global.stat": Operation not permitted Perry Smith <pedz@easesoftware.com>
@ 2022-09-09 04:12 ` Mladen Gogala <gogala.mladen@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Mladen Gogala @ 2022-09-09 04:12 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 9/9/22 00:08, Perry Smith wrote:
> The data directory is outside so it is persistent.  The pg_stat_tmp is inside the data directory.

Ah, that's the reason. Docker daemon runs as root so if you do binding 
mount, files will be owned by root. You may want to use normal Docker 
volume and not an external directory.

-- 
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2022-09-09 04:12 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-09-09 04:08 Re: ***SPAM***  Re: WARNING: could not open statistics file "pg_stat_tmp/global.stat": Operation not permitted Perry Smith <pedz@easesoftware.com>
2022-09-09 04:12 ` Re: ***SPAM*** Re: WARNING: could not open statistics file "pg_stat_tmp/global.stat": Operation not permitted Mladen Gogala <gogala.mladen@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox