Re: Latest version of Hot Standby patch: unexpected error querying standby - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Latest version of Hot Standby patch: unexpected error querying standby
Date
Msg-id 4960C9D0.3070607@enterprisedb.com
Whole thread Raw
In response to Re: Latest version of Hot Standby patch: unexpected error querying standby  (Simon Riggs <simon@2ndQuadrant.com>)
Responses Re: Latest version of Hot Standby patch: unexpected error querying standby  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
List pgsql-hackers
Simon Riggs wrote:
> On Sun, 2009-01-04 at 22:18 +1300, Mark Kirkwood wrote:
>>>>> bench=# select now(),count(*) from history;
>>>>> ERROR:  could not open relation base/16384/16394: No such file or
>>>>> directory
>>>>>     
> 
>> I'm guessing something tied up with the fact that history has no rows
>> to 
>> start with...
> 
> Good guess, thanks. I can recreate the error now, though not by
> following the actions in the order you mentioned. I guess the files
> hadn't applied fully before you ran the test.
> 
> The problem I can re-create looks like this:
> 
> 1. Create standby set-up, with both primary and standby active
> 2. Create new table on primary, but don't add data; wait for apply
> 3. Attempt to access new table on standby, throws ERROR as shown
> 4. Add 1 row on primary; wait for apply
> 5. Attempt to access new table on standby, no ERROR
> 
> It looks to me like WAL for CREATE TABLE doesn't actually create a file,
> we just rely on the ability of mdextend() to create the file if required
> during recovery.
> 
> So it looks to me like either an outstanding error with current system,
> or a new error introduced with recent-ish md/smgr changes. Second
> opinion please Heikki, if you are available?

Hmm, that's odd. Table creation calls RelationCreateStorage, which calls 
smgrcreate and writes the WAL record. smgr_redo certainly does call 
smgrcreate.

I can reproduce that too with CVS HEAD, so it's clearly a bug. I 
probably introduced it with the recent smgr changes; I'll try to hunt it 
down.

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Latest version of Hot Standby patch: unexpected error querying standby
Next
From: Heikki Linnakangas
Date:
Subject: Re: Latest version of Hot Standby patch: unexpected error querying standby