Fix GetOldestXmin comment

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Fix GetOldestXmin comment
Date: 2017-05-30 01:02:53
Message-ID: CAD21AoAtw3XkwBDHJPE0wQ4+R00_zE7E5oZt3-k_YzfCpBi=YQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Attachment Content-Type Size
getoldestxmin_comment.patch application/octet-stream 882 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2017-05-30 01:12:05 Re: Alter subscription..SET - NOTICE message is coming for table which is already removed
Previous Message Tom Lane 2017-05-30 00:14:55 Re: Receive buffer size for the statistics socket