From: Andres Freund <andres@anarazel.de>
To: Martijn van Oosterhout <kleptog@svana.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Fujii Masao <masao.fujii@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: WAL logging problem in 9.4.3?
Date: Fri, 3 Jul 2015 19:21:21 +0200
Message-ID: <20150703172121.GL3291@awork2.anarazel.de> (raw)
In-Reply-To: <20150703171426.GA2841@svana.org>
References: <20150702220524.GA9392@svana.org>
<20150702222102.GG30708@awork2.anarazel.de>
<20150703052048.GA20285@svana.org>
<CAHGQGwEXta1tMF6o-FcDcjMgCF=jnZLj3v3EoePvsEN4aexJnA@mail.gmail.com>
<20150703060137.GB20285@svana.org>
<CAHGQGwFtOMv5h8eKX6zf+9_0UxpcTsyH9xAnyv6KdGH4BonLiw@mail.gmail.com>
<28320.1435935120@sss.pgh.pa.us>
<CAHGQGwGzxAyKLUm+z2n43-ee6u976jLmQAz=pPBVzSueD3CAig@mail.gmail.com>
<10146.1435942436@sss.pgh.pa.us>
<20150703171426.GA2841@svana.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
On 2015-07-03 19:14:26 +0200, Martijn van Oosterhout wrote:
> Am I missing something. ISTM that if the truncate record was simply not
> logged at all everything would work fine. The whole point is that the
> table was created in this transaction and so if it exists the table on
> disk must be the correct representation.
That'd not work either. Consider:
BEGIN;
CREATE TABLE ...
INSERT;
TRUNCATE;
INSERT;
COMMIT;
If you replay that without a truncation wal record the second INSERT
will try to add stuff to already occupied space. And they can have
different lengths and stuff, so you cannot just ignore that fact.
> The broken index is just one symptom.
Agreed. I think the problem is something else though. Namely that we
reuse the relfilenode for heap_truncate_one_rel(). That's just entirely
broken afaics. We need to allocate a new relfilenode and write stuff
into that. Then we can forgo WAL logging the truncation record.
> If you insert a row before commit then after replay the tuple should be there still.
The insert would be WAL logged. COPY skips wal logging tho.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: andres@anarazel.de, kleptog@svana.org, tgl@sss.pgh.pa.us, masao.fujii@gmail.com
Subject: Re: WAL logging problem in 9.4.3?
In-Reply-To: <20150703172121.GL3291@awork2.anarazel.de>
* 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