HS and clog - Mailing list pgsql-hackers

From Andres Freund
Subject HS and clog
Date
Msg-id 20130330182006.GJ28736@alap2.anarazel.de
Whole thread Raw
Responses Re: HS and clog  (Simon Riggs <simon@2ndQuadrant.com>)
Re: HS and clog  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-hackers
Hi,

During the investigation of
http://archives.postgresql.org/message-id/CAL_0b1t%3DWuM6roO8dki%3Dw8DhH8P8whhohbPjReymmQUrOcNT2A%40mail.gmail.com
I noticed that during HS we do the following in RecordKnownAssignedTransactionIds:if (TransactionIdFollows(xid,
latestObservedXid)){   TransactionId next_expected_xid;
 
    /*     * Extend clog and subtrans like we do in GetNewTransactionId() during     * normal operation using
individualextend steps. Typical case     * requires almost no activity.     */    next_expected_xid =
latestObservedXid;   TransactionIdAdvance(next_expected_xid);    while
(TransactionIdPrecedesOrEquals(next_expected_xid,xid))    {        ExtendCLOG(next_expected_xid);
ExtendSUBTRANS(next_expected_xid);
        TransactionIdAdvance(next_expected_xid);    }

Extending subtrans is fine, that's required since its truncated after
restart and because its not really WAL logged, but extending CLOG? Thats
strange, isn't it, since clog is actually WAL logged, so all required
pages will be zeroed from their wal records anyway.
The commit introducing HS changed ExtendCLOG to do/* Zero the page and make an XLOG entry about it
*/ZeroCLOGPage(pageno,!InRecovery);
 
to make that even work during recovery.

Imo this shouldn't be needed.

Simon, do you remember why you added that?  It makes me uneasy doing
something like that only during HS but not during normal crash
recovery/disabled HS.

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Satoshi Nagayasu
Date:
Subject: Re: By now, why PostgreSQL 9.2 don't support SSDs?
Next
From: Stephen Frost
Date:
Subject: Re: Hash Join cost estimates