Re: question: data file update when pg_basebackup in progress

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Rui Hai Jiang <ruihaijiang(at)msn(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: question: data file update when pg_basebackup in progress
Date: 2017-04-25 16:45:27
Message-ID: CAKFQuwYmywMTaDUy9iOgbeaUHOoASwuSjCdg7iHArSH_s1La2w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 25, 2017 at 9:08 AM, Rui Hai Jiang <ruihaijiang(at)msn(dot)com> wrote:

> When pg_basebackup is launched, a checkpoint is created first, then all
> files are transferred to the pg_basebackup client. Is it possible that a
> data page(say page-N) in a data file is changed after the checkpoint and
> before the pg_basebackup is finished?
>

​I believe so.

> If this happens, is it possible that only part of the changed page be
> transferred to the pg_basebackup client? i.e. the pg_basebackup client
> gets page-N with part of the old content and part of the new content. How
> does postgreSQL handle this kind of data page?
>

​The first write to a page after a checkpoint is always recorded in the WAL
as a full page write. Every ​WAL file since the checkpoint must also be
copied to the backed up system. The replay of those WAL files is what
brings the remote and local system into sync with respect to all changes
since the backup checkpoint.

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2017-04-25 16:54:21 Re: Cached plans and statement generalization
Previous Message Konstantin Knizhnik 2017-04-25 16:45:20 Re: Cached plans and statement generalization