Re: [GENERAL] pg_rewind copy so much data - Mailing list pgsql-general

From Michael Paquier
Subject Re: [GENERAL] pg_rewind copy so much data
Date
Msg-id CAB7nPqTpumjeS+x-6Z2vEQV-+t54fgQKkWz3H_swFBHdaNp6AQ@mail.gmail.com
Whole thread Raw
In response to [GENERAL] pg_rewind copy so much data  (Hung Phan <hungphan227@gmail.com>)
Responses Re: [GENERAL] pg_rewind copy so much data  (Hung Phan <hungphan227@gmail.com>)
List pgsql-general
On Wed, Sep 13, 2017 at 12:41 PM, Hung Phan <hungphan227@gmail.com> wrote:
> I have tested pg_rewind (ver 9.5) with the following scenario:
>
> - one master and one slave (total size of each server is more than 4GB)
> - set wal_log_hint=on and restart both
> - stop master, promote slave
> - start old master again (now two servers have diverged)
> - stop old master, run pg_rewind with progress option

That's a good flow. Don't forget to run a manual checkpoint after
promotion to update the control file of the promoted standby so as
pg_rewind is able to identify the timeline difference between the
source and the target servers.

> The pg_rewind ran successfully but I saw it copied more than 4GB (4265891 kB
> copied). So I wonder there was very minor difference between two servers but
> why did pg_rewind copy almost all data of new master?

Without knowing exactly the list of things that have been registered
as things to copy from the active source to the target, it is hard to
give a conclusion. But my bet here is that you let the target server
online long enough that it had a bunch of block updated, causing more
relation blocks to be copied from the source because more efforts
would be needed to re-sync it. That's only an assumption without data
with clear numbers, numbers that could be found using the --debug
messages of pg_rewind.
-- 
Michael


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

pgsql-general by date:

Previous
From: Hung Phan
Date:
Subject: [GENERAL] pg_rewind copy so much data
Next
From: Hung Phan
Date:
Subject: Re: [GENERAL] pg_rewind copy so much data