ssi-slru-trunc-to-head-1.patch

text/plain

Filename: ssi-slru-trunc-to-head-1.patch
Type: text/plain
Part: 0
Message: could not truncate directory "pg_serial": apparent wraparound

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/storage/lmgr/predicate.c 3 0
*** a/src/backend/storage/lmgr/predicate.c
--- b/src/backend/storage/lmgr/predicate.c
***************
*** 926,943 **** CheckPointPredicate(void)
  	else
  	{
  		/*
! 		 * The SLRU is no longer needed. Truncate everything.  If we try to
! 		 * leave the head page around to avoid re-zeroing it, we might not use
! 		 * the SLRU again until we're past the wrap-around point, which makes
! 		 * SLRU unhappy.
! 		 *
! 		 * While the API asks you to specify truncation by page, it silently
! 		 * ignores the request unless the specified page is in a segment past
! 		 * some allocated portion of the SLRU.	We don't care which page in a
! 		 * later segment we hit, so just add the number of pages per segment
! 		 * to the head page to land us *somewhere* in the next segment.
  		 */
! 		tailPage = oldSerXidControl->headPage + SLRU_PAGES_PER_SEGMENT;
  		oldSerXidControl->headPage = -1;
  	}
  
--- 926,935 ----
  	else
  	{
  		/*
! 		 * The SLRU is no longer needed. Truncate to head before we set head
! 		 * invalid.
  		 */
! 		tailPage = oldSerXidControl->headPage;
  		oldSerXidControl->headPage = -1;
  	}