pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Zwettler Markus (OIZ) <Markus.Zwettler@zuerich.ch>
Cc: Ron <ronljohnsonjr@gmail.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: AW: [Extern] Re: consistent postgresql snapshot
Date: Thu, 12 May 2022 09:48:27 -0400
Message-ID: <308684.1652363307@sss.pgh.pa.us> (raw)
In-Reply-To: <0c12435782ab4e3e8cc0366a44e35c84@zuerich.ch>
References: <49bb084a06194e51a2d58421e5f074f6@zuerich.ch>
	<1ba59e2c-b0ae-387f-1272-cdbeefe7bd67@gmail.com>
	<0c12435782ab4e3e8cc0366a44e35c84@zuerich.ch>

"Zwettler Markus (OIZ)" <Markus.Zwettler@zuerich.ch> writes:
> I don't want to do use the normal backup algorithm where pg_start_backup + pg_stop_backup will fix any fractured block and I am required to have all archived logfiles, therefore.
> I want to produce an atomic consistent disk snapshot.

[ shrug... ]  You can't have that.  There is never any guarantee that
the on-disk database files are fully up-to-date while the Postgres
server is running, because there may be updates sitting in buffers
in shared memory that have not been written out yet.  We achieve
crash safety by ensuring that the WAL log contains sufficient info to
recreate any such updates by replaying WAL from the last checkpoint.
But without going through that replay process, the data visible in
the filesystem may be inconsistent.  Even taking a disk snapshot
immediately after a checkpoint won't help, because we use spread
checkpoints.  These points are independent of the possibility that
any one block write is non-atomic, although that's surely a factor
as well.

The only way you could get a consistent on-disk image is to shut
the server down (being sure to do a clean not "immediate" shutdown)
and then take the snapshot.

			regards, tom lane





view thread (5+ messages)  latest in thread

Message-ID: <308684.1652363307@sss.pgh.pa.us>
Permalink:  ../308684.1652363307@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/308684.1652363307@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, Markus.Zwettler@zuerich.ch, ronljohnsonjr@gmail.com
  Subject: Re: [Extern] Re: consistent postgresql snapshot
  In-Reply-To: <308684.1652363307@sss.pgh.pa.us>
  References: <49bb084a06194e51a2d58421e5f074f6@zuerich.ch> <1ba59e2c-b0ae-387f-1272-cdbeefe7bd67@gmail.com> <0c12435782ab4e3e8cc0366a44e35c84@zuerich.ch> <308684.1652363307@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox