Re: Snapshot backups - Mailing list pgsql-general

From James Sewell
Subject Re: Snapshot backups
Date
Msg-id CANkGpBuWaVQ5hMtod087VsgLsvbiCXOm9T1RDOiPdSsZH1Mfvw@mail.gmail.com
Whole thread Raw
In response to Re: Snapshot backups  (Amit Langote <amitlangote09@gmail.com>)
Responses Re: Snapshot backups
List pgsql-general
I understand what you are saying, and I understand how the backup_label works - but I still don't understand why the pg_start and pg_stop commands are REQUIRED when doing a snapshot backup to ensure data integrity. 

Surely not using them and restoring a snapshot is the same as starting after a crash, and will result in log replay to get to the latest possible consistent state?

I thought PostgreSQL guaranteed a consistent state after a crash, am I mistaken about this?

James



James Sewell
PostgreSQL Team Lead / Solutions Architect

_____________________________________


http://www.lisasoft.com/sites/lisasoft/files/u1/2013hieghtslogan_0.png

Level 2, 50 Queen St,
Melbourne, VIC, 3000

P: 03 8370 8000   F: 03 8370 8099  W: www.lisasoft.com



On Mon, Jul 29, 2013 at 4:54 PM, Amit Langote <amitlangote09@gmail.com> wrote:

On Mon, Jul 29, 2013 at 3:32 PM, James Sewell <james.sewell@lisasoft.com> wrote:
Hey all,

I understand that I have already been given an answer here, but I am still curious as to why this is the case (perhaps I should ask this on the hackers list though, if so let me know).

More importantly I'd like to understand why I would need to use the start/stop backup commands to ensure a valid backup when using filesystem snapshots (assuming I get the order correct)- worst case scenario wouldn't it be the same as a crash and cause an automatic roll-forward?



pg_start_backup('backup_label') and pg_stop_backup(), if I understand it correctly, write to the 'backup_label' file the information necessary to recover "consistently" from that backup. For example, backup_label file contains the checkpoint location and its REDO location (identified as "START WAL LOCATION:" field in the backup_label file.) While you are reading the code, you can read the comment above the function read_backup_label() in src/backend/access/transam/xlog.c


--
Amit Langote



The contents of this email are confidential and may be subject to legal or professional privilege and copyright. No representation is made that this email is free of viruses or other defects. If you have received this communication in error, you may not copy or distribute any part of it or otherwise disclose its contents to anyone. Please advise the sender of your incorrect receipt of this correspondence.
Attachment

pgsql-general by date:

Previous
From: David Johnston
Date:
Subject: Re: How get column-wise table info from an arbitrary query?
Next
From: Rob Sargent
Date:
Subject: more fun with building 9.3beta2