Re: Broken primary key after backup restore.

From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: Michael Chau <michael(dot)chau(at)gameyourgame(dot)com>, David Steele <david(at)pgmasters(dot)net>
Cc: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Guillaume Lelarge <guillaume(at)lelarge(dot)info>, PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Broken primary key after backup restore.
Date: 2015-10-02 20:20:56
Message-ID: 1199722635.384826.1443817256420.JavaMail.yahoo@mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Michael Chau <michael(dot)chau(at)gameyourgame(dot)com> wrote:

> For some reason, there were some bad wal log files in pg_xlog. I
> believe that they got generated during the backup last Monday,
> but I don't know why. I speculate that may be the
> wal_keep_segments was not set high enough as I have changed it
> recently.
>
> Luckily, I have archived the wal log files. And by comparing
> between the two directories, I did see those bad wal log files in
> pg_xlog directory only.

The instructions for making a backup explicitly say to exclude or
delete the files in the pg_xlog directory and use those from the
archive. That's because tar (or whatever you are using to copy the
files) may copy a WAL file before some change made during the
backup is written to it. What you were doing is not supported and
likely to appear to work sometimes (possibly even without hidden
corruption), and fail to create a backup that will even start on
other attempts.

You might find this blog post helpful:

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

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2015-10-02 20:52:50 aggregates, distinct, order by, and case - why won't this work
Previous Message Jim Nasby 2015-10-02 19:26:26 Re: "global" & shared sequences