Re: Are ZFS snapshots unsafe when PGSQL is spreading through multiple zpools?

2023-01-18 Thread Ron
On 1/18/23 10:54, Rob Sargent wrote: On 1/18/23 09:38, HECTOR INGERTO wrote: I wanted to understand the underlying issue. I use ZFS snapshots instead of a “correct” backup because with only two machines it allows me to have backups in the main machine and in the secondary too that acts as

Re: Are ZFS snapshots unsafe when PGSQL is spreading through multiple zpools?

2023-01-18 Thread Rob Sargent
On 1/18/23 09:38, HECTOR INGERTO wrote: I wanted to understand the underlying issue. I use ZFS snapshots instead of a “correct” backup because with only two machines it allows me to have backups in the main machine and in the secondary too that acts as hotspare at the same time. To

RE: Are ZFS snapshots unsafe when PGSQL is spreading through multiple zpools?

2023-01-18 Thread HECTOR INGERTO
<mailto:pgsql-gene...@postgresql.org> Asunto: Re: Are ZFS snapshots unsafe when PGSQL is spreading through multiple zpools? On Tue, 2023-01-17 at 15:22 +, HECTOR INGERTO wrote: > > Another case: a transaction COMMITs, and a slightly later transaction reads > > the data >

Re: Are ZFS snapshots unsafe when PGSQL is spreading through multiple zpools?

2023-01-18 Thread Laurenz Albe
On Tue, 2023-01-17 at 15:22 +, HECTOR INGERTO wrote: > > Another case: a transaction COMMITs, and a slightly later transaction reads > > the data > > and sets a hint bit.  If the snapshot of the file system with the data > > directory in it > > is slightly later than the snapshot of the file

Re: Are ZFS snapshots unsafe when PGSQL is spreading through multiple zpools?

2023-01-17 Thread Bruce Momjian
On Tue, Jan 17, 2023 at 03:22:02PM +, HECTOR INGERTO wrote: > > Another case: a transaction COMMITs, and a slightly later transaction reads > the data > > and sets a hint bit. If the snapshot of the file system with the data > directory in it > > is slightly later than the snapshot of the

RE: Are ZFS snapshots unsafe when PGSQL is spreading through multiple zpools?

2023-01-17 Thread HECTOR INGERTO
> Another case: a transaction COMMITs, and a slightly later transaction reads > the data > and sets a hint bit. If the snapshot of the file system with the data > directory in it > is slightly later than the snapshot of the file system with "pg_wal", the > COMMIT might > not be part of the

Re: Are ZFS snapshots unsafe when PGSQL is spreading through multiple zpools?

2023-01-17 Thread Laurenz Albe
On Mon, 2023-01-16 at 14:37 +, HECTOR INGERTO wrote: > > The database relies on the data being consistent when it performs crash > > recovery. > > Imagine that a checkpoint is running while you take your snapshot.  The > > checkpoint > > syncs a data file with a new row to disk.  Then it

Re: Are ZFS snapshots unsafe when PGSQL is spreading through multiple zpools?

2023-01-17 Thread Magnus Hagander
On Mon, Jan 16, 2023 at 3:37 PM HECTOR INGERTO wrote: > > The database relies on the data being consistent when it performs crash > recovery. > > Imagine that a checkpoint is running while you take your snapshot. The > checkpoint > > syncs a data file with a new row to disk. Then it writes a

Re: Are ZFS snapshots unsafe when PGSQL is spreading through multiple zpools?

2023-01-17 Thread Alban Hertroys
> On 16 Jan 2023, at 15:37, HECTOR INGERTO wrote: > > > The database relies on the data being consistent when it performs crash > > recovery. > > Imagine that a checkpoint is running while you take your snapshot. The > > checkpoint > > syncs a data file with a new row to disk. Then it

RE: Are ZFS snapshots unsafe when PGSQL is spreading through multiple zpools?

2023-01-16 Thread HECTOR INGERTO
> The database relies on the data being consistent when it performs crash > recovery. > Imagine that a checkpoint is running while you take your snapshot. The > checkpoint > syncs a data file with a new row to disk. Then it writes a WAL record and > updates > the control file. Now imagine

Re: Are ZFS snapshots unsafe when PGSQL is spreading through multiple zpools?

2023-01-16 Thread Laurenz Albe
On Mon, 2023-01-16 at 08:41 +, HECTOR INGERTO wrote: > I have understood I shall not do it, but could the technical details be > discussed about > why silent DB corruption can occur with non-atomical snapshots? The database relies on the data being consistent when it performs crash

RE: Are ZFS snapshots unsafe when PGSQL is spreading through multiple zpools?

2023-01-16 Thread HECTOR INGERTO
I have understood I shall not do it, but could the technical details be discussed about why silent DB corruption can occur with non-atomical snapshots?

Re: Are ZFS snapshots unsafe when PGSQL is spreading through multiple zpools?

2023-01-15 Thread Ron
er.net> *Enviado: *domingo, 15 de enero de 2023 20:36 *Para: *HECTOR INGERTO <mailto:hector_...@hotmail.com> *CC: *pgsql-gene...@postgresql.org *Asunto: *Re: Are ZFS snapshots unsafe when PGSQL is spreading through multiple zpools? On Sun, Jan 15, 2023 at 8:18 PM HECTOR INGERTO wrote:

RE: Are ZFS snapshots unsafe when PGSQL is spreading through multiple zpools?

2023-01-15 Thread HECTOR INGERTO
ZFS snapshots unsafe when PGSQL is spreading through multiple zpools? On Sun, Jan 15, 2023 at 8:18 PM HECTOR INGERTO mailto:hector_...@hotmail.com>> wrote: Hello everybody, I’m using PostgreSQL on openZFS. I use ZFS snapshots as a backup + hotspare method. >From man zfs-snapshot: “

Re: Are ZFS snapshots unsafe when PGSQL is spreading through multiple zpools?

2023-01-15 Thread Magnus Hagander
On Sun, Jan 15, 2023 at 10:57 PM HECTOR INGERTO wrote: > > > > But you cannot and should not rely on snapshots alone > > > > That’s only for non atomic (multiple pools) snapshots. Isn’t? > Right. For single-filesystem installs it should be fine. Just make sure it has both the data and the WAL

Re: Are ZFS snapshots unsafe when PGSQL is spreading through multiple zpools?

2023-01-15 Thread Magnus Hagander
On Sun, Jan 15, 2023 at 8:18 PM HECTOR INGERTO wrote: > Hello everybody, > > > > I’m using PostgreSQL on openZFS. I use ZFS snapshots as a backup + > hotspare method. > > > > From man zfs-snapshot: “Snapshots are taken atomically, so that all > snapshots correspond to the same moment in time.”

Are ZFS snapshots unsafe when PGSQL is spreading through multiple zpools?

2023-01-15 Thread HECTOR INGERTO
Hello everybody, I’m using PostgreSQL on openZFS. I use ZFS snapshots as a backup + hotspare method. >From man zfs-snapshot: “Snapshots are taken atomically, so that all snapshots >correspond to the same moment in time.” So if a PSQL instance is started from >a zfs snapshot, it will start to