Refactor pg_rewind code and make it work against a standby

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Refactor pg_rewind code and make it work against a standby
Date: 2020-08-19 12:50:16
Message-ID: 0c5b3783-af52-3ee5-f8fa-6e794061f70d@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I started to hack on making pg_rewind crash-safe (see [1]), but I
quickly got side-tracked into refactoring and tidying up up the code in
general. I ended up with this series of patches:

The first four patches are just refactoring that make the code and the
logic more readable. Tom Lane commented about the messy comments earlier
(see [2]), and I hope these patches will alleviate that confusion. See
commit messages for details.

The last patch refactors the logic in libpq_fetch.c, so that it no
longer uses a temporary table in the source system. That allows using a
hot standby server as the pg_rewind source.

This doesn't do anything about pg_rewind's crash-safety yet, but I'll
try work on that after these patches.

[1]
https://www.postgresql.org/message-id/d8dcc760-8780-5084-f066-6d663801d2e2%40iki.fi

[2] https://www.postgresql.org/message-id/30255.1522711675%40sss.pgh.pa.us

- Heikki

Attachment Content-Type Size
0001-pg_rewind-Move-syncTargetDirectory-to-file_ops.c.patch text/x-patch 4.4 KB
0002-Refactor-pg_rewind-for-more-clear-decision-making.patch text/x-patch 28.7 KB
0003-pg_rewind-Replace-the-hybrid-list-array-data-structu.patch text/x-patch 21.4 KB
0004-pg_rewind-Refactor-the-abstraction-to-fetch-from-loc.patch text/x-patch 42.0 KB
0005-Allow-pg_rewind-to-use-a-standby-server-as-the-sourc.patch text/x-patch 17.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Anastasia Lubennikova 2020-08-19 13:15:40 Re: COPY FREEZE and setting PD_ALL_VISIBLE/visibility map bits
Previous Message Hamid Akhtar 2020-08-19 12:45:41 Re: track_planning causing performance regression