Re: Error with index on unlogged table - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Error with index on unlogged table
Date
Msg-id CAB7nPqRcY5=zN83OmLRTAfa0PQ6Ui-yXzJoJr5G_hty9bgVF2Q@mail.gmail.com
Whole thread Raw
In response to Re: Error with index on unlogged table  (Andres Freund <andres@anarazel.de>)
Responses Re: Error with index on unlogged table  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On Wed, Dec 9, 2015 at 9:07 PM, Andres Freund <andres@anarazel.de> wrote:
> On 2015-12-09 21:03:47 +0900, Michael Paquier wrote:
>> Oh, OK. I didn't read though your lines correctly. So you basically
>> mean that we would look at the init files that are on disk, and check
>> if they are empty. If they are, we simply use XLogReadBufferExtended
>> to fetch the INIT_FORKNUM content and fill in another buffer for the
>> MAIN_FORKNUM. More or less right?
>
> We would not just do so if they're empty, we would just generally copy the file
> via shared buffers, instead of copy_file(). But we'd get the file size
> from the filesystem (which is fine, we make sure it is correct during
> replay).

So, this suggestion is basically implementing the reverse operation of
GetRelationPath() to be able to rebuild a RelFileNode from scratch and
then look at the shared buffers needed. Isn't it a bit brittle for
back-branches? RelFileNode stuff is available easily through records
when replaying individually FPIs, but not really in this code path.
-- 
Michael



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: pg_hba_lookup function to get all matching pg_hba.conf entries
Next
From: amul sul
Date:
Subject: Re: Passing initially_valid values instead of !skip_validation to StoreRelCheck() in AddRelationNewConstraints()