Using non-sequential timelines in order to help with possible collisions

From: Brian Faherty <anothergenericuser(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Using non-sequential timelines in order to help with possible collisions
Date: 2017-07-19 15:23:12
Message-ID: CAMLsqiRvA=jx8W8eSBOznGHH7HSAcpSroxgwyY=4kjbyxQ36KA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hey hackers,
I was working with replication and recovery the other day and noticed
that there were scenarios where I could cause multiple servers to enter the
same timeline while possibly having divergent data. One such scenario is
Master A and Replica B are both on timeline 1. There is an event that
causes Replica B to become promoted which changes it to timeline 2.
Following this, you perform a restore on Master A to a point before the
event happened. Once Postgres completes this recovery on Master A, it will
switch over to timeline 2. There are now WAL files that have been written
to timeline 2 from both servers.

From this scenario, I would like to suggest considering using
non-sequential timelines. From what I have investigated so far, I believe
the *.history files in the WAL directory already have all the timelines
id's in them and are in order. If we could make those timeline ids to be a
bit more unique/random, and still rely on the ordering in the *.history
file, I think this would help prevent multiple servers on the same timeline
with divergent data.

I was hoping to begin a conversation on whether or not non-sequential
timelines are a good idea before I looked at the code around timelines.

--
Brian Faherty

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Sharma 2017-07-19 15:48:21 Re: pl/perl extension fails on Windows
Previous Message Tom Lane 2017-07-19 14:36:51 Re: Bug in ExecModifyTable function and trigger issues for foreign tables