Re: Postgresql13_beta1 (could not rename temporary statistics file) Windows 64bits

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Postgresql13_beta1 (could not rename temporary statistics file) Windows 64bits
Date: 2020-06-15 02:53:28
Message-ID: 20200615025328.GR14879@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jun 12, 2020 at 03:15:52PM -0300, Ranier Vilela wrote:
> Posgres13_beta1, is consistently writing to the logs, "could not rename
> temporary statistics file".
> When analyzing the source that writes the log, I simplified the part that
> writes the logs a little.

What windows version and compiler ?

Please show the full CSV log for this event, and not an excerpt.
Preferably with several lines of "context" for the stats process PID, with
log_min_messages=debug or debug2 and log_error_verbosity=verbose, so that you
get the file location where it's erroring, if you don't already know that.

https://wiki.postgresql.org/wiki/Guide_to_reporting_problems

> 1. I changed from if else if to if
> 2. For the user, better to have more errors recorded, which can help in
> discovering the problem
> 3. Errors are independent of each other
> 4. If I can't release tmpfile, there's no way to delete it (unlink)
> 5. If I can rename, there is no need to delete it (unlink) tmpfile.
>
> Attached is the patch that proposes these changes.
> Now, the problem has not been solved.

It sounds like you haven't yet found the problem, right ? These are all
unrelated changes which are confusing the problem report and discussion.
And introducing behavior regressions, like renaming files with write errors on
top of known good files.

I think you'll want to 1) identify where the problem is occuring, and attach a
debugger there.

2) figure out when the problem was introduced. If this problem doesn't happen
under v12:

git log --cherry-pick -p origin/REL_12_STABLE...origin/REL_13_STABLE -- src/backend/postmaster/pgstat.c
or just:
git log -p origin/REL_12_STABLE.. src/backend/postmaster/pgstat.c

You could try git-bisecting between v12..v13, but there's only 30 commits which
touched pgstat.c (assuming that's where the ERROR is being thrown).

Do you have a special value of stats_temp_directory?
Or a symlink or junction at pg_stat_tmp ?

> 1. statfile, is it really closed or does it not exist in the directory?
> There is no way to rename a file, which is open and in use.
> 2. Why delete (pgstat_stat_filename), if permanent is true:
> const char * statfile = permanent? PGSTAT_STAT_PERMANENT_FILENAME:
> pgstat_stat_filename;
> statfile is PGSTAT_STAT_PERMANENT_FILENAME and not pgstat_stat_filename

You can find answers to a lot of questions in the git history. In this case,
70d756970 and 187492b6c.

--
Justin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2020-06-15 03:11:02 Re: create database with template doesn't copy database ACL
Previous Message Tom Lane 2020-06-15 02:30:25 Re: valgrind versus pg_atomic_init()