Re: How does pg_basebackup manage to create a snapshot of the filesystem?

From: Christophe Pettus <xof(at)thebuild(dot)com>
To: Dennis Jacobfeuerborn <dennisml(at)conversis(dot)de>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: How does pg_basebackup manage to create a snapshot of the filesystem?
Date: 2020-03-19 22:26:53
Message-ID: 5842F57D-C8AE-4B73-9B4F-F8810174461E@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On Mar 19, 2020, at 15:19, Dennis Jacobfeuerborn <dennisml(at)conversis(dot)de> wrote:
> I'm currently trying to understand how backups work. In the
> documentation in section "25.2. File System Level Backup" it says that
> filesystem level backups can only be made when the database if offline
> yet pg_basebackup seems to do just that but works while the database is
> online. Am I misunderstanding something here or does pg_basebackup use
> some particular features of Postgres to accomplish this?

pg_basebackup does, indeed, take an inconsistent copy of the file system while it is running; what allows it to bring the database back up to consistency is the write-ahead log segments that are created while pg_basebackup is running. That's why it is important to have all of the WAL segments created during the run (which is what --wal-method=stream provides you).
--
-- Christophe Pettus
xof(at)thebuild(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message pabloa98 2020-03-19 22:32:54 Re: Could postgres12 support millions of sequences? (like 10 million)
Previous Message Dave Hughes 2020-03-19 22:24:14 Passwordcheck configuration