standalone backend PANICs during recovery - Mailing list pgsql-hackers

From Bernd Helmle
Subject standalone backend PANICs during recovery
Date
Msg-id 00F0B2CEF6D0CEF8A90119D4@eje.credativ.lan
Whole thread Raw
Responses Re: standalone backend PANICs during recovery  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
While investigating a problem on a streaming hot standby instance at a
customer site, i got the following when using a standalone backend:

PANIC:  btree_xlog_delete_get_latestRemovedXid: cannot operate with
inconsistent data
CONTEXT:  xlog redo delete: index 1663/65588/65625; iblk 11, heap
1663/65588/65613;

The responsible PANIC is triggered here:

src/backend/access/nbtree/nbtxlog.c:555

btree_xlog_delete_get_latestRemovedXid(XLogReaderState *record)
{

[...]
    if (!reachedConsistency)
        elog(PANIC, "btree_xlog_delete_get_latestRemovedXid: cannot operate with
inconsistent data");
[...]

}

There's already an "optimization" before, exiting with InvalidTransactionId
in case a HS doesn't count any active backends. In standalone mode however,
CountDBBackends() will always return 1 afaik. It looks like
btree_xlog_delete_get_latestRemovedXid() needs an additional check for
standalone backends, so i came up with the attached patch. This allowed the
standalone backend to recover without any problems.

--
Thanks

    Bernd
Attachment

pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: IF (NOT) EXISTS in psql-completion
Next
From: Amit Kapila
Date:
Subject: Re: Speed up Clog Access by increasing CLOG buffers