remove_obsolete_assertion_0206.patch

text/x-diff

Filename: remove_obsolete_assertion_0206.patch
Type: text/x-diff
Part: 0
Message: Re: Failed assertion during recovery of partial WAL file

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: context
File+
src/backend/access/transam/xlog.c 10 0
*** a/src/backend/access/transam/xlog.c
--- b/src/backend/access/transam/xlog.c
***************
*** 5110,5125 **** exitArchiveRecovery(TimeLineID endTLI, uint32 endLogId, uint32 endLogSeg)
  	UpdateMinRecoveryPoint(InvalidXLogRecPtr, true);
  
  	/*
! 	 * We should have the ending log segment currently open.  Verify, and then
! 	 * close it (to avoid problems on Windows with trying to rename or delete
! 	 * an open file).
  	 */
! 	Assert(readFile >= 0);
! 	Assert(readId == endLogId);
! 	Assert(readSeg == endLogSeg);
! 
! 	close(readFile);
! 	readFile = -1;
  
  	/*
  	 * If the segment was fetched from archival storage, we want to replace
--- 5110,5123 ----
  	UpdateMinRecoveryPoint(InvalidXLogRecPtr, true);
  
  	/*
! 	 * If the ending log segment is currently open, close it (to avoid
! 	 * problems on Windows with trying to rename or delete an open file).
  	 */
! 	if (readFile >= 0)
! 	{
! 		close(readFile);
! 		readFile = -1;
! 	}
  
  	/*
  	 * If the segment was fetched from archival storage, we want to replace
***************
*** 5974,5979 **** StartupXLOG(void)
--- 5972,5980 ----
  	EndOfLog = EndRecPtr;
  	XLByteToPrevSeg(EndOfLog, endLogId, endLogSeg);
  
+ 	Assert(readId == endLogId);
+ 	Assert(readSeg == endLogSeg);
+ 
  	/*
  	 * Complain if we did not roll forward far enough to render the backup
  	 * dump consistent.  Note: it is indeed okay to look at the local variable