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

Attachment: getoldestxmin_comment.patch
Description: Binary data

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

Reply via email to