Обсуждение: Broken --dry-run mode in pg_rewind

Поиск
Список
Период
Сортировка

Broken --dry-run mode in pg_rewind

От
Vladimir Borodin
Дата:
Hi all.

Seems, that pg_rewind does not account --dry-run option properly. A simple fix for that is attached.



--
May the force be with you…

Вложения

Re: Broken --dry-run mode in pg_rewind

От
Heikki Linnakangas
Дата:
On 05/08/2015 03:25 PM, Vladimir Borodin wrote:
> Hi all.
>
> Seems, that pg_rewind does not account --dry-run option properly. A simple fix
> for that is attached.

No, the --dry-run takes effect later. It performs all the actions it 
normally would, including reading files from the source, except for 
actually writing anything in the target. See the dry-run checks in 
file_ops.c

- Heikki



Re: Broken --dry-run mode in pg_rewind

От
Michael Paquier
Дата:
On Fri, May 8, 2015 at 9:34 PM, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
> On 05/08/2015 03:25 PM, Vladimir Borodin wrote:
>> Seems, that pg_rewind does not account --dry-run option properly. A simple
>> fix
>> for that is attached.
>
>
> No, the --dry-run takes effect later. It performs all the actions it
> normally would, including reading files from the source, except for actually
> writing anything in the target. See the dry-run checks in file_ops.c

Even if the patch sent is incorrect, shouldn't there be some process
bypass in updateControlFile() and createBackupLabel() in case of a
--dry-run?
-- 
Michael



Re: Broken --dry-run mode in pg_rewind

От
Heikki Linnakangas
Дата:
On 05/08/2015 03:39 PM, Michael Paquier wrote:
> On Fri, May 8, 2015 at 9:34 PM, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
>> On 05/08/2015 03:25 PM, Vladimir Borodin wrote:
>>> Seems, that pg_rewind does not account --dry-run option properly. A simple
>>> fix
>>> for that is attached.
>>
>>
>> No, the --dry-run takes effect later. It performs all the actions it
>> normally would, including reading files from the source, except for actually
>> writing anything in the target. See the dry-run checks in file_ops.c
>
> Even if the patch sent is incorrect, shouldn't there be some process
> bypass in updateControlFile() and createBackupLabel() in case of a
> --dry-run?

They both use open_target_file() and write_target_file(), which check 
for --dry-run and do nothing if it's set.

Hmm, I wonder it we should print something else than "Done!" at the end, 
if run in --dry-run mode. Or give some indication around the time it 
says "Rewinding from last common checkpoint at ...", that it's running 
in dry-run mode and won't actually modify anything. The progress 
messages are a bit alarming if you don't realize that it's skipping all 
the writes.

- Heikki




Re: Broken --dry-run mode in pg_rewind

От
Stephen Frost
Дата:
* Heikki Linnakangas (hlinnaka@iki.fi) wrote:
> On 05/08/2015 03:39 PM, Michael Paquier wrote:
> >On Fri, May 8, 2015 at 9:34 PM, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
> >>On 05/08/2015 03:25 PM, Vladimir Borodin wrote:
> >>>Seems, that pg_rewind does not account --dry-run option properly. A simple
> >>>fix
> >>>for that is attached.
> >>
> >>
> >>No, the --dry-run takes effect later. It performs all the actions it
> >>normally would, including reading files from the source, except for actually
> >>writing anything in the target. See the dry-run checks in file_ops.c
> >
> >Even if the patch sent is incorrect, shouldn't there be some process
> >bypass in updateControlFile() and createBackupLabel() in case of a
> >--dry-run?
>
> They both use open_target_file() and write_target_file(), which
> check for --dry-run and do nothing if it's set.
>
> Hmm, I wonder it we should print something else than "Done!" at the
> end, if run in --dry-run mode. Or give some indication around the
> time it says "Rewinding from last common checkpoint at ...", that
> it's running in dry-run mode and won't actually modify anything. The
> progress messages are a bit alarming if you don't realize that it's
> skipping all the writes.

Wouldn't hurt to also augment that rather doom-looking "point of no
return" comment with a note that says writes won't happen if in
dry-run. :)

For my 2c anyway.
Thanks!
    Stephen

Re: Broken --dry-run mode in pg_rewind

От
Vladimir Borodin
Дата:

8 мая 2015 г., в 16:11, Stephen Frost <sfrost@snowman.net> написал(а):

* Heikki Linnakangas (hlinnaka@iki.fi) wrote:
On 05/08/2015 03:39 PM, Michael Paquier wrote:
On Fri, May 8, 2015 at 9:34 PM, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
On 05/08/2015 03:25 PM, Vladimir Borodin wrote:
Seems, that pg_rewind does not account --dry-run option properly. A simple
fix
for that is attached.


No, the --dry-run takes effect later. It performs all the actions it
normally would, including reading files from the source, except for actually
writing anything in the target. See the dry-run checks in file_ops.c

Urgh, my test script had an error and I made grep only in pg_rewind.c. Sorry for noise.


Even if the patch sent is incorrect, shouldn't there be some process
bypass in updateControlFile() and createBackupLabel() in case of a
--dry-run?

They both use open_target_file() and write_target_file(), which
check for --dry-run and do nothing if it's set.

Hmm, I wonder it we should print something else than "Done!" at the
end, if run in --dry-run mode. Or give some indication around the
time it says "Rewinding from last common checkpoint at ...", that
it's running in dry-run mode and won't actually modify anything. The
progress messages are a bit alarming if you don't realize that it's
skipping all the writes.

That would be really nice.


Wouldn't hurt to also augment that rather doom-looking "point of no
return" comment with a note that says writes won't happen if in
dry-run. :)

For my 2c anyway.

Thanks!

Stephen


--
May the force be with you…

Re: Broken --dry-run mode in pg_rewind

От
Vladimir Borodin
Дата:

8 мая 2015 г., в 16:39, Vladimir Borodin <root@simply.name> написал(а):


8 мая 2015 г., в 16:11, Stephen Frost <sfrost@snowman.net> написал(а):

* Heikki Linnakangas (hlinnaka@iki.fi) wrote:
On 05/08/2015 03:39 PM, Michael Paquier wrote:
On Fri, May 8, 2015 at 9:34 PM, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
On 05/08/2015 03:25 PM, Vladimir Borodin wrote:
Seems, that pg_rewind does not account --dry-run option properly. A simple
fix
for that is attached.


No, the --dry-run takes effect later. It performs all the actions it
normally would, including reading files from the source, except for actually
writing anything in the target. See the dry-run checks in file_ops.c

Urgh, my test script had an error and I made grep only in pg_rewind.c. Sorry for noise.


Even if the patch sent is incorrect, shouldn't there be some process
bypass in updateControlFile() and createBackupLabel() in case of a
--dry-run?

They both use open_target_file() and write_target_file(), which
check for --dry-run and do nothing if it's set.

Hmm, I wonder it we should print something else than "Done!" at the
end, if run in --dry-run mode. Or give some indication around the
time it says "Rewinding from last common checkpoint at ...", that
it's running in dry-run mode and won't actually modify anything. The
progress messages are a bit alarming if you don't realize that it's
skipping all the writes.

That would be really nice.

Added comments in all places mentioned in this thread.




Wouldn't hurt to also augment that rather doom-looking "point of no
return" comment with a note that says writes won't happen if in
dry-run. :)

For my 2c anyway.

Thanks!

Stephen


--
May the force be with you…


--
May the force be with you…

Вложения