[HACKERS] Fix GetOldestXmin comment - Mailing list pgsql-hackers

From Masahiko Sawada
Subject [HACKERS] Fix GetOldestXmin comment
Date
Msg-id CAD21AoAtw3XkwBDHJPE0wQ4+R00_zE7E5oZt3-k_YzfCpBi=YQ@mail.gmail.com
Whole thread Raw
Responses Re: [HACKERS] Fix GetOldestXmin comment  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-hackers
Hi,

While reading source code, I realized that comment of GetOldestXmin mentions;

  * if rel = NULL and there are no transactions running in the current
  * database, GetOldestXmin() returns latestCompletedXid.

However, in that case if I understand correctly GetOldestXmin()
actually returns latestCompletedXid + 1 as follows;

  /*
   * We initialize the MIN() calculation with latestCompletedXid + 1. This
   * is a lower bound for the XIDs that might appear in the ProcArray later,
   * and so protects us against overestimating the result due to future
   * additions.
   */
  result = ShmemVariableCache->latestCompletedXid;
  Assert(TransactionIdIsNormal(result));
  TransactionIdAdvance(result);

Attached patch fixes the top comment of GetOldestXmin.

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Receive buffer size for the statistics socket
Next
From: Masahiko Sawada
Date:
Subject: Re: [HACKERS] Alter subscription..SET - NOTICE message is coming fortable which is already removed