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

From Simon Riggs
Subject Re: PATCH: add pg_current_xlog_flush_location function
Date
Msg-id CANP8+jLGh3yxM52UhhbYSvitCdu=bboY=YSLvLp3LPO9DsTqcA@mail.gmail.com
Whole thread Raw
In response to Re: PATCH: add pg_current_xlog_flush_location function  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-hackers
On 12 January 2016 at 05:58, Michael Paquier <michael.paquier@gmail.com> wrote:
On Tue, Jan 12, 2016 at 6:35 AM, Simon Riggs wrote:
> Comments in xlog.c say
>
> "In addition to the shared variable, each backend has a private copy of
> LogwrtResult, which is updated when convenient."
> It is therefore valid to update the value of both Write and Flush positions
> at the same time, any time either is required.

Yes I saw this one yesterday when looking at this code. My comment
regarded the potential interactions between this field with XLogFlush,
but now I see that my concerns are not valid, updating more frequently
LogwrtResult may save some cycles though.

> My suggested commit pattern for this is...
> 1. Update existing function to maintain LogwrtResult more eagerly (separate
> patch)

The only place I see now that would benefit a bit from that is
UpdateMinRecoveryPoint when info_lck is taken, which can be called by
XLogFlush. Though I would expect this to have minimal impact.

> 2. Have the patch use the existing function name (main patch)

Yeah, we had better just use GetFlushRecPtr and be done with it. It
seems that there is little point to add a new function, and it is not
going to be called that much so its effects in updating LogwrtResult
would be minimized for a single backend.

Patch committed, thanks for patch and review. 

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

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: extend pgbench expressions with functions
Next
From: Simon Riggs
Date:
Subject: Re: Speedup twophase transactions