Re: pg_basebackup problem...

From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: John Scalia <jayknowsunix(at)gmail(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: pg_basebackup problem...
Date: 2015-08-06 16:49:36
Message-ID: 2095928829.121339.1438879776368.JavaMail.yahoo@mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

John Scalia <jayknowsunix(at)gmail(dot)com> wrote:

> I've been examining the source code to pg_basebackup written by
> Magnus Hagander. It definitely shows that if you do not issue a
> "-X f" or "-X s" then the pg_xlogs will NOT be included in the
> backup. This leads me to a couple more questions:
>
> 1) Does anyone know why anything in a WAL segment is required for
> a database to start?

Yes. This is covered in the docs, but in summary: the files could
be modified during the copy, and without WAL replay from before the
copy started the database would not necessarily be consistent.

> I ask this as the backup_label generated by pg_basebackup
> indicates a segment where the latest checkpoint is contained.

It indicates the location of the last checkpoint before the start
of the backup -- the latest point from which you cab start WAL
replay to achieve a consistent database.

> Surely, there has to be some better way to permit the DB to
> sanely initialize.

A write-ahead log is a well-known and widely used technique for
this. What would you suggest instead?

> 2) If a WAL segment is in fact required for the backed up DB to
> start, why would pg_basebackup not include those by default? To
> not do so, doesn't create a backup file, just in this case, a
> tarball that's worthless.

... unless you are archiving the WAL to somewhere that it will be
kept long enough to be usable for such purposes. If you are (and I
highly recommend that you do so), including WAL in the base backup
is a waste of both bandwidth and storage space.

Besides reviewing the documentation's discussions of WAL and
backups, you might want to read this:

http://tbeitr.blogspot.com/2015/07/deleting-backuplabel-on-restore-will.html

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message John Scalia 2015-08-06 18:16:36 Re: pg_basebackup problem...
Previous Message John Scalia 2015-08-06 16:04:57 Re: pg_basebackup problem...