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 individual extend 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


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to