support for windows robocopy in archive_command and restore_command

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: support for windows robocopy in archive_command and restore_command
Date: 2021-08-18 21:01:40
Message-ID: 7c08ddfd-a90c-2474-a527-c19ffcef99fc@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message alvherre@alvh.no-ip.org 2021-08-18 23:46:44 Re: archive status ".ready" files may be created too early
Previous Message Bossart, Nathan 2021-08-18 20:35:12 Re: .ready and .done files considered harmful