Re: pg_rewind in contrib

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Satoshi Nagayasu <snaga(at)uptime(dot)jp>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Michael Paquier <mpaquier(at)vmware(dot)com>
Subject: Re: pg_rewind in contrib
Date: 2015-03-10 22:14:58
Message-ID: 54FF6CE2.5000009@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 03/10/2015 07:46 AM, Amit Kapila wrote:
> On Mon, Mar 9, 2015 at 7:32 PM, Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:
>>
>> Attached is a new patch version, fixing all the little things you listed.
> I believe this is pretty much ready for commit. I'm going to read it
> through myself one more time before committing, but I don't have anything
> mind now that needs fixing anymore. I just pushed the change to split
> dbcommands.h into dbcommands.h and dbcommands_xlog.h, as that seems like a
> nice-to-have anyway.
>>
>
> Few assorted comments:
>
> 1.
> + <step>
> + <para>
> + Copy all those changed blocks from the new cluster to the old
> cluster.
> +
> </para>
> + </step>
>
> Isn't it possible incase of async replication that old cluster has
> some blocks which new cluster doesn't have, what will it do
> in such a case?

Sure, that's certainly possible. If the source cluster doesn't have some
blocks that exist in the target, IOW a file in the source cluster is
shorter than the same file in the target, that means that the relation
was truncated in the source. pg_rewind will truncate the file in the
target to match the source's size, although that's not strictly
necessary as there will also be a WAL record in the source about the
truncation. That will be replayed on the first startup after pg_rewind
and would do the truncation anyway.

> I have tried to test some form of such a case and it seems to be
> failing with below error:
>
> pg_rewind.exe -D ..\..\Data\ --source-pgdata=..\..\Database1
> The servers diverged at WAL position 0/16DE858 on timeline 1.
> Rewinding from last common checkpoint at 0/16B8A70 on timeline 1
>
> could not open file "..\..\Data\/base/12706/16391" for truncation: No such
> file
> or directory
> Failure, exiting

Hmm, could that be just because of the funny business with the Windows
path separators? Does it work if you use "-D ..\..\Data" instead,
without the last backslash?

> +# To run a test, the test script (in t/ subdirectory) calls the functions
>
> What do you mean by t/ subdirectory?

There is a directory, "src/bin/pg_rewind/t", which contains the
regression tests.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2015-03-10 22:20:20 Re: proposal: searching in array function - array_position
Previous Message Rahila Syed 2015-03-10 22:08:49 Re: [REVIEW] Re: Compression of full-page-writes