Re: PATCH: add pg_current_xlog_flush_location function - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: PATCH: add pg_current_xlog_flush_location function
Date
Msg-id 569399A3.3090401@2ndquadrant.com
Whole thread Raw
In response to Re: PATCH: add pg_current_xlog_flush_location function  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: PATCH: add pg_current_xlog_flush_location function  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-hackers
On 01/11/2016 06:30 AM, Michael Paquier wrote:
>
> Updating LogwrtResult directly when calling your new function
> GetXLogFlushRecPtr() does not strike me as a particularly good idea
> per this portion in XLogFlush():>
>      /* Quick exit if already known flushed */
>      if (record <= LogwrtResult.Flush)
>          return;
>
> The same counts for GetXLogWriteRecPtr, we had better allocate the
> value in an independent variable as there are checks using it. For
> now it does not matter much for the write position because all the
> code paths doing the checks explicitly update again the pointer
> before looking at it but it seems to me that using an independent
> variable would make the code more robust.

Why? LogwrtResult only serves as a local cache of shared values, so 
there should be no danger of skipping something.

regards

--
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: Why doesn't src/backend/port/win32/socket.c implement bind()?
Next
From: Stas Kelvich
Date:
Subject: Re: Speedup twophase transactions