From: Jeff Davis <pgsql@j-davis.com>
To: pgsql-bugs@postgresql.org
Subject: Probable bug with CreateFakeRelcacheEntry
Date: Mon, 10 Sep 2012 18:33:59 -0700
Message-ID: <1347327239.4161.20.camel@sussancws0025> (raw)
I haven't produced a real problem in a small test case (yet), but I
convinced myself that it's wrong enough to be called a bug.
If you add the following assertion to BufferAlloc:
Assert(relpersistence == RELPERSISTENCE_PERMANENT ||
relpersistence == RELPERSISTENCE_UNLOGGED ||
relpersistence == RELPERSISTENCE_TEMP);
(which seems like a reasonable assertion to me), then do:
create table foo(i int);
insert into foo values(1);
vacuum foo;
vacuum foo;
insert into foo values(2);
Then do an immediate shutdown, then restart, you hit the assertion.
The problem is using CreateFakeRelcacheEntry, which has the following
comment:
Only the fields related to physical storage, like rd_rel, are
initialized, so the fake entry is only usable in low-level
operations like ReadBuffer().
That doesn't seem right, because ReadBuffer needs relpersistence set.
One of the consequences is that you can get buffers with the wrong flags
set; in particular, missing BM_PERMANENT, which seems like it could be a
serious problem.
Are there other areas where we might have similar problems?
Regards,
Jeff Davis
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-bugs@postgresql.org
Cc: pgsql@j-davis.com
Subject: Re: Probable bug with CreateFakeRelcacheEntry
In-Reply-To: <1347327239.4161.20.camel@sussancws0025>
References: <1347327239.4161.20.camel@sussancws0025>
* 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