Timeline ID in backup_label file

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Timeline ID in backup_label file
Date: 2017-10-25 18:50:00
Message-ID: CAB7nPqRosJNapKVW2QPwkN9+ypfL4yiR4mcNFZcjxS2c8m+Vkw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

Lately, in order to extract some information from a backup_label file
in python I have found myself doing something like the following to
get a timeline number (feel free to reuse that code, especially the
regex pattern):
pattern = re.compile('^START WAL
LOCATION:.*([0-9A-F]+\/[0-9A-F]+).*\(file ([0-9A-F]+)\)')
if pattern.match(backup_lable_line):
current_lsn = m.group(1)
current_segment = m.group(2)
current_tli = str(int(current_segment[:8], 16))

That's more or less similar to what read_backup_label()@xlog.c does
using sscanf(), still I keep wondering why we need to go through this
much complication to get the origin timeline number of a base backup,
information which is IMO as important as the start LSN when working on
backup methods.

I would find interesting to add at the bottom of the backup_label file
a new field called "START TIMELINE: %d" to put this information in a
more understandable shape. Any opinions?
--
Michael

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2017-10-25 20:03:23 Re: Implementing pg_receivewal --no-sync
Previous Message Tomas Vondra 2017-10-25 16:51:44 Re: WIP: BRIN multi-range indexes