pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Rationalize GetWalRcv{Write,Flush}RecPtr().
4+ messages / 3 participants
[nested] [flat]

* pgsql: Rationalize GetWalRcv{Write,Flush}RecPtr().
@ 2020-04-08 11:55 Thomas Munro <tmunro@postgresql.org>
  2020-04-09 21:49 ` Re: pgsql: Rationalize GetWalRcv{Write,Flush}RecPtr(). Alvaro Herrera <alvherre@2ndquadrant.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Thomas Munro @ 2020-04-08 11:55 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Rationalize GetWalRcv{Write,Flush}RecPtr().

GetWalRcvWriteRecPtr() previously reported the latest *flushed*
location.  Adopt the conventional terminology used elsewhere in the tree
by renaming it to GetWalRcvFlushRecPtr(), and likewise for some related
variables that used the term "received".

Add a new definition of GetWalRcvWriteRecPtr(), which returns the latest
*written* value.  This will allow later patches to use the value for
non-data-integrity purposes, without having to wait for the flush
pointer to advance.

Reviewed-by: Alvaro Herrera <alvherre@2ndquadrant.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CA%2BhUKGJ4VJN8ttxScUFM8dOKX0BrBiboo5uz1cq%3DAovOddfHpA%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d140f2f3e225ea53e2d92ab6833b8c186c90666c

Modified Files
--------------
src/backend/access/transam/xlog.c          | 20 ++++++++++----------
src/backend/access/transam/xlogfuncs.c     |  2 +-
src/backend/replication/README             |  2 +-
src/backend/replication/walreceiver.c      | 15 ++++++++++-----
src/backend/replication/walreceiverfuncs.c | 24 ++++++++++++++++++------
src/backend/replication/walsender.c        |  2 +-
src/include/replication/walreceiver.h      | 18 ++++++++++++++----
7 files changed, 55 insertions(+), 28 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pgsql: Rationalize GetWalRcv{Write,Flush}RecPtr().
  2020-04-08 11:55 pgsql: Rationalize GetWalRcv{Write,Flush}RecPtr(). Thomas Munro <tmunro@postgresql.org>
@ 2020-04-09 21:49 ` Alvaro Herrera <alvherre@2ndquadrant.com>
  2020-04-15 21:24   ` Re: pgsql: Rationalize GetWalRcv{Write,Flush}RecPtr(). Alvaro Herrera <alvherre@2ndquadrant.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Alvaro Herrera @ 2020-04-09 21:49 UTC (permalink / raw)
  To: Thomas Munro <tmunro@postgresql.org>; +Cc: pgsql-hackers@lists.postgresql.org

On 2020-Apr-08, Thomas Munro wrote:

> Rationalize GetWalRcv{Write,Flush}RecPtr().
> 
> GetWalRcvWriteRecPtr() previously reported the latest *flushed*
> location.  Adopt the conventional terminology used elsewhere in the tree
> by renaming it to GetWalRcvFlushRecPtr(), and likewise for some related
> variables that used the term "received".
> 
> Add a new definition of GetWalRcvWriteRecPtr(), which returns the latest
> *written* value.  This will allow later patches to use the value for
> non-data-integrity purposes, without having to wait for the flush
> pointer to advance.

It seems worth pointing out that the new GetWalRcvWriteRecPtr function
has a different signature from the original one -- so any third-party
code using the original function will now get a compile failure that
should alert them that they need to change their code to call
GetWalRcvFlushRecPtr instead.  Maybe we should add a line or two in the
comments GetWalRcvWriteRecPtr to make this explicit.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pgsql: Rationalize GetWalRcv{Write,Flush}RecPtr().
  2020-04-08 11:55 pgsql: Rationalize GetWalRcv{Write,Flush}RecPtr(). Thomas Munro <tmunro@postgresql.org>
  2020-04-09 21:49 ` Re: pgsql: Rationalize GetWalRcv{Write,Flush}RecPtr(). Alvaro Herrera <alvherre@2ndquadrant.com>
@ 2020-04-15 21:24   ` Alvaro Herrera <alvherre@2ndquadrant.com>
  2020-05-02 03:53     ` Re: pgsql: Rationalize GetWalRcv{Write,Flush}RecPtr(). Thomas Munro <thomas.munro@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Alvaro Herrera @ 2020-04-15 21:24 UTC (permalink / raw)
  To: Thomas Munro <tmunro@postgresql.org>; +Cc: pgsql-hackers@lists.postgresql.org

On 2020-Apr-09, Alvaro Herrera wrote:

> It seems worth pointing out that the new GetWalRcvWriteRecPtr function
> has a different signature from the original one -- so any third-party
> code using the original function will now get a compile failure that
> should alert them that they need to change their code to call
> GetWalRcvFlushRecPtr instead.  Maybe we should add a line or two in the
> comments GetWalRcvWriteRecPtr to make this explicit.

After using codesearch.debian.net and finding no results, I decided that
this is not worth the effort.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pgsql: Rationalize GetWalRcv{Write,Flush}RecPtr().
  2020-04-08 11:55 pgsql: Rationalize GetWalRcv{Write,Flush}RecPtr(). Thomas Munro <tmunro@postgresql.org>
  2020-04-09 21:49 ` Re: pgsql: Rationalize GetWalRcv{Write,Flush}RecPtr(). Alvaro Herrera <alvherre@2ndquadrant.com>
  2020-04-15 21:24   ` Re: pgsql: Rationalize GetWalRcv{Write,Flush}RecPtr(). Alvaro Herrera <alvherre@2ndquadrant.com>
@ 2020-05-02 03:53     ` Thomas Munro <thomas.munro@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Thomas Munro @ 2020-05-02 03:53 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: Thomas Munro <tmunro@postgresql.org>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

On Thu, Apr 16, 2020 at 9:24 AM Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
> On 2020-Apr-09, Alvaro Herrera wrote:
> > It seems worth pointing out that the new GetWalRcvWriteRecPtr function
> > has a different signature from the original one -- so any third-party
> > code using the original function will now get a compile failure that
> > should alert them that they need to change their code to call
> > GetWalRcvFlushRecPtr instead.  Maybe we should add a line or two in the
> > comments GetWalRcvWriteRecPtr to make this explicit.
>
> After using codesearch.debian.net and finding no results, I decided that
> this is not worth the effort.

Thanks for checking.  Yeah, it looks like you're right.
codesearch.debian.net is cool.





^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2020-05-02 03:53 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-04-08 11:55 pgsql: Rationalize GetWalRcv{Write,Flush}RecPtr(). Thomas Munro <tmunro@postgresql.org>
2020-04-09 21:49 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2020-04-15 21:24   ` Alvaro Herrera <alvherre@2ndquadrant.com>
2020-05-02 03:53     ` Thomas Munro <thomas.munro@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox