/pgpatches/autovacuum.diff

text/x-diff

Filename: /pgpatches/autovacuum.diff
Type: text/x-diff
Part: 0
Message: Re: Bug in autovacuum.c?

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: unified
File+
src/backend/postmaster/autovacuum.c 0 0
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
new file mode 100644
index efc8e7c..244930f
*** a/src/backend/postmaster/autovacuum.c
--- b/src/backend/postmaster/autovacuum.c
*************** do_start_worker(void)
*** 1107,1114 ****
  	 */
  	recentXid = ReadNewTransactionId();
  	xidForceLimit = recentXid - autovacuum_freeze_max_age;
! 	/* ensure it's a "normal" XID, else TransactionIdPrecedes misbehaves */
! 	if (xidForceLimit < FirstNormalTransactionId)
  		xidForceLimit -= FirstNormalTransactionId;
  
  	/*
--- 1107,1120 ----
  	 */
  	recentXid = ReadNewTransactionId();
  	xidForceLimit = recentXid - autovacuum_freeze_max_age;
! 	/*
! 	 * Adjust for xids in the invalid range, less than FirstNormalTransactionId.
! 	 * We map the xids as though the invalid range did not exist.
! 	 * We cannot simplify the test below because of underflow
! 	 * issues with unsigned values.
! 	 */
! 	if (xidForceLimit < FirstNormalTransactionId || /* in invalid range? */
! 		recentXid < autovacuum_freeze_max_age) 		/* did we underflow? */
  		xidForceLimit -= FirstNormalTransactionId;
  
  	/*