Re: broke postgres, how to fix??

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "JD Wong *EXTERN*" <jdmswong(at)gmail(dot)com>, Lonni J Friedman <netllama(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: broke postgres, how to fix??
Date: 2013-03-01 09:31:03
Message-ID: A737B7A37273E048B164557ADEF4A58B057B9926@ntex2010a.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

JD Wong wrote:
>>> Hi Adrian, yes I completely copied the config-file and data directories
>>> over.

>> That's guaranteed to break everything badly.

> Even if I "read only style" copied the files? Do you mind elaborating on why this happens? ( or point
> me to relevant documentation )

The problem is that if you copy the files of a running database,
these files will change while they are being copied.
This can result in unusable contents.
Also, to function properly, the different files
in a PostgreSQL data directory must be consistent with each other.
If you copy one file after the other, files that are copied later
might belong to a different state of the database than earlier files.

You either have to shutdown the database before copying
(a filesystem level offline backup) or use some instantaneous
snapshotting technique that your file system might offer.
In the latter case PostgreSQL should perform crash recovery
and eventually reach a consistent state.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2013-03-01 09:46:31 Re: warm standby question
Previous Message Raymond O'Donnell 2013-03-01 09:21:20 Re: Poor performance when using a window function in a view