Skip site navigation (1) Skip section navigation (2)

Assertion failure when promoting node by deleting recovery.conf and restart node

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Assertion failure when promoting node by deleting recovery.conf and restart node
Date: 2013-03-15 02:25:53
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers

When trying to *promote* a slave as master by removing recovery.conf and
restarting node, I found an assertion failure on master branch:
LOG:  database system was shut down in recovery at 2013-03-15 10:22:27 JST
TRAP: FailedAssertion("!(ControlFile->minRecoveryPointTLI != 1)", File:
"xlog.c", Line: 4954)
(gdb) bt
#0  0x00007f95af03b2c5 in raise () from /usr/lib/
#1  0x00007f95af03c748 in abort () from /usr/lib/
#2  0x000000000086ce71 in ExceptionalCondition (conditionName=0x8f2af0
"!(ControlFile->minRecoveryPointTLI != 1)", errorType=0x8f0813
"FailedAssertion", fileName=0x8f076b "xlog.c",
    lineNumber=4954) at assert.c:54
#3  0x00000000004fe499 in StartupXLOG () at xlog.c:4954
#4  0x00000000006f9d34 in StartupProcessMain () at startup.c:224
#5  0x000000000050ef92 in AuxiliaryProcessMain (argc=2,
argv=0x7fffa6fc3d20) at bootstrap.c:423
#6  0x00000000006f8816 in StartChildProcess (type=StartupProcess) at
#7  0x00000000006f39e9 in PostmasterMain (argc=6, argv=0x1c950a0) at
#8  0x000000000065d59b in main (argc=6, argv=0x1c950a0) at main.c:197
Ok, this is not the cleanest way to promote a node as it doesn't do any
safety checks relation at promotion but 9.2 and previous versions allowed
to do that properly.

The assertion has been introduced by commit 3f0ab05 in order to record
properly minRecoveryPointTLI in control file at the end of recovery in the
case of a crash.
However, in the case of a slave node properly shutdown in recovery which is
then restarted as a master, the code path of this assertion is taken.
What do you think of the patch attached? It avoids the update of
recoveryTargetTLI and recoveryTargetIsLatest if the node has been shutdown
while in recovery.
Another possibility could be to add in the assertion some conditions based
on the state of controlFile but I think it is more consistent simply not to
update those fields.


Attachment: 20130315_crash_tli.patch
Description: application/octet-stream (882 bytes)


pgsql-hackers by date

Next:From: Tom LaneDate: 2013-03-15 03:00:38
Subject: Re: Re: proposal: a width specification for s specifier (format function), fix behave when positional and ordered placeholders are used
Previous:From: Joe ConwayDate: 2013-03-15 00:23:59
Subject: Re: pg_dump selectively ignores extension configuration tables

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group