Thread: support for windows robocopy in archive_command and restore_command

support for windows robocopy in archive_command and restore_command

From
Andrew Dunstan
Date:
Quite a few years ago Microsoft recognized that with windows copy and
xcopy commands had some serious inadequacies. They therefore created
robocopy <https://ss64.com/nt/robocopy.html> as a replacement, and it
has shipped in all modern versions of Windows. At any rate it's
something I think we should support. Unfortunately it has a couple of
wrinkles. First, it actually returns non-zero in most success
conditions. See <https://ss64.com/nt/robocopy-exit.html> That can be
handled by calling it via a script. But the other thing is that the
calling syntax is different. It's "robocopy sourcedir destdir filename"
It doesn't allow for files to be renamed, but luckily we don't normally
need it to. However, what we do need is the ability to get the directory
name from the %p parameter for archive_command and restore_command,
stripped of the actual file name. I therefore suggest in both cases we
implement a %P escape to allow for it. Should be a pretty tiny patch.


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com




Re: support for windows robocopy in archive_command and restore_command

From
Julien Rouhaud
Date:
On Thu, Aug 19, 2021 at 5:01 AM Andrew Dunstan <andrew@dunslane.net> wrote:
>
> It doesn't allow for files to be renamed, but luckily we don't normally
> need it to.

Doesn't the recovery ask to recover the WAL files in
pg_wal/RECOVERYXLOG and the history files in pg_wal/RECOVERYHISTORY
rather than the original names?



Re: support for windows robocopy in archive_command and restore_command

From
Andrew Dunstan
Date:
On 8/18/21 10:32 PM, Julien Rouhaud wrote:
> On Thu, Aug 19, 2021 at 5:01 AM Andrew Dunstan <andrew@dunslane.net> wrote:
>> It doesn't allow for files to be renamed, but luckily we don't normally
>> need it to.
> Doesn't the recovery ask to recover the WAL files in
> pg_wal/RECOVERYXLOG and the history files in pg_wal/RECOVERYHISTORY
> rather than the original names?


Oh, darn. I was looking at what pg_rewind does; it uses the same name.


Well, maybe we need to scrub that idea -(


cheers


andrew


--
Andrew Dunstan
EDB: https://www.enterprisedb.com