pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pg_rewind: Refactor the abstraction to fetch from local/libpq so
Date: Wed, 04 Nov 2020 09:22:56 +0000
Message-ID: <E1kaF0K-0001nK-L6@gemulon.postgresql.org> (raw)

pg_rewind: Refactor the abstraction to fetch from local/libpq source.

This makes the abstraction of a "source" server more clear, by introducing
a common abstract class, borrowing the object-oriented programming term,
that represents all the operations that can be done on the source server.
There are two implementations of it, one for fetching via libpq, and
another to fetch from a local directory. This adds some code, but makes it
easier to understand what's going on.

The copy_executeFileMap() and libpq_executeFileMap() functions contained
basically the same logic, just calling different functions to fetch the
source files. Refactor so that the common logic is in one place, in a new
function called perform_rewind().

Reviewed-by: Kyotaro Horiguchi, Soumyadeep Chakraborty
Discussion: https://www.postgresql.org/message-id/0c5b3783-af52-3ee5-f8fa-6e794061f70d%40iki.fi

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/37d2ff38031262a1778bc76a9c55fff7afbcf275

Modified Files
--------------
src/bin/pg_rewind/Makefile                         |   5 +-
src/bin/pg_rewind/copy_fetch.c                     | 266 --------------
src/bin/pg_rewind/fetch.c                          |  60 ----
src/bin/pg_rewind/fetch.h                          |  44 ---
src/bin/pg_rewind/file_ops.c                       | 133 ++++++-
src/bin/pg_rewind/file_ops.h                       |   3 +
.../pg_rewind/{libpq_fetch.c => libpq_source.c}    | 395 ++++++++++-----------
src/bin/pg_rewind/local_source.c                   | 131 +++++++
src/bin/pg_rewind/pg_rewind.c                      | 208 ++++++++---
src/bin/pg_rewind/pg_rewind.h                      |   5 -
src/bin/pg_rewind/rewind_source.h                  |  73 ++++
src/tools/pgindent/typedefs.list                   |   5 +
12 files changed, 697 insertions(+), 631 deletions(-)



Message-ID: <E1kaF0K-0001nK-L6@gemulon.postgresql.org>
Permalink:  ../E1kaF0K-0001nK-L6@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1kaF0K-0001nK-L6@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: heikki.linnakangas@iki.fi
  Subject: Re: pgsql: pg_rewind: Refactor the abstraction to fetch from local/libpq so
  In-Reply-To: <E1kaF0K-0001nK-L6@gemulon.postgresql.org>
  References: <E1kaF0K-0001nK-L6@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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