From: Tom Lane <tgl@sss.pgh.pa.us>
To: Olga Vingurt <olga.vingurt@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: pg_restore fails due to foreign key violation
Date: Mon, 10 Dec 2018 12:33:13 -0500
Message-ID: <28278.1544463193@sss.pgh.pa.us> (raw)
In-Reply-To: <CAOkHHZKZ_HGw56OiBAN9s9ZT8o42rH4vriCHPOeYAYdp=jwsfQ@mail.gmail.com>
References: <CAOkHHZKZ_HGw56OiBAN9s9ZT8o42rH4vriCHPOeYAYdp=jwsfQ@mail.gmail.com>
Olga Vingurt <olga.vingurt@gmail.com> writes:
> The only question left is how we got into corrupted data state.
> In the event logs (PorstgeSQL is runnign on Wondows Server) we found error
> which looks relevant:
> ERROR: could not truncate file "base/12373/17254" to 19 blocks: Permission denied
> CONTEXT: automatic vacuum of table "postgres.public.<table_name>"
Hm. In theory, that truncation failure in itself shouldn't have caused a
problem --- autovacuum is just trying to remove some empty pages, and if
they don't get removed, they'd still be empty. However, there's a problem
if the pages are empty because we just deleted some recently-dead tuples,
because the state of the pages on-disk might be different from what it
is in-memory. In that case the truncation failure effectively results in
those pages reverting to some prior state, possibly bringing dead tuples
"back to life". We've been poking at that problem off and on for awhile;
the most recent thread is here:
https://www.postgresql.org/message-id/flat/5BBC590AE8DF4ED1A170E4D48F1B53AC%40tunaPC
Assuming that that is the issue (which is unproven, but seems probable)
then your report makes the third report we've seen of this failure mode
in about a decade --- and it's been there, in principle, much longer than
that. Nobody's thought of a fix that isn't either very unpleasant for
performance (eg, "uselessly" writing out pages we're about to truncate
away) or bad for robustness (eg, PANIC'ing on truncate failure). So
while it's certainly bad news when it happens, I'm not sure that any
fix is going to get committed soon.
In the short term, what you need to do is figure out what caused the
permission failure. The general belief among pgsql-hackers is that
shoddy antivirus products tend to cause this, but I don't know details.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, olga.vingurt@gmail.com
Subject: Re: pg_restore fails due to foreign key violation
In-Reply-To: <28278.1544463193@sss.pgh.pa.us>
References: <CAOkHHZKZ_HGw56OiBAN9s9ZT8o42rH4vriCHPOeYAYdp=jwsfQ@mail.gmail.com> <28278.1544463193@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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