From e69a9eea71562434cc0512871a9b6d7424ce93ec Mon Sep 17 00:00:00 2001 From: Vigneshwaran c Date: Fri, 30 Aug 2019 11:45:03 +0530 Subject: [PATCH] FailedAssertion("!(logno == context->recovery_logno) fix try_location was not updated in UndoLogAllocateInRecovery, in PrepareUndoInsert the try_location was updated with the undo record size. In the subsequent UndoLogAllocateInRecovery as the value for try_location was not initialized but only updated with the size the logno will always not match if the recovery_logno is non zero and the assert fails. Fixed by setting the try_location in UndoLogAllocateInRecovery, similar to try_location setting in UndoLogAllocate. Patch by Vigneshwaran C, reviewed by Dilip Kumar. --- src/backend/access/undo/undolog.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/backend/access/undo/undolog.c b/src/backend/access/undo/undolog.c index 073221c..9acd570 100644 --- a/src/backend/access/undo/undolog.c +++ b/src/backend/access/undo/undolog.c @@ -960,6 +960,14 @@ UndoLogAllocateInRecovery(UndoLogAllocContext *context, *need_xact_header = context->try_location == InvalidUndoRecPtr && slot->meta.unlogged.insert == slot->meta.unlogged.this_xact_start; + + /* + * If no try_location was passed in, or if we switched logs, then we'll + * return the current insertion point. + */ + if (context->try_location == InvalidUndoRecPtr) + context->try_location = MakeUndoRecPtr(slot->logno, slot->meta.unlogged.insert); + *last_xact_start = slot->meta.unlogged.last_xact_start; context->recovery_logno = slot->logno; -- 1.8.3.1