Re: Using copy for WAL archiving on Windows

Поиск
Список
Период
Сортировка
От Christian Ullrich
Тема Re: Using copy for WAL archiving on Windows
Дата
Msg-id 4D3B1694.5050908@chrullrich.net
обсуждение исходный текст
Ответ на Re: Using copy for WAL archiving on Windows  (Harald Armin Massa <harald@2ndQuadrant.com>)
Список pgsql-general
* Harald Armin Massa wrote:

>     Should PostgreSQL maybe provide its own file-copy utility for
>     Windows that meets the requirements for safe WAL archiving?
>
> Microsoft does provide an enterprise-ready  webscale copy program ... it
> is called robocopy and part of the Windows Server Resource Kit Tools.
> Would you mind trying that utility for copying WAL-files?

I'm not sure I trust _that_:

    ### archive_wal.bat ###

    robocopy pg_xlog c:\wal %1 /r:0 /w:0 /xc
    if errorlevel 4 exit 1
    if errorlevel 1 exit 0
    if errorlevel 0 exit 1

    ### end ###

    archive_command = "archive_wal.bat %f"

robocopy's exit codes make good reading, if you are into horror stories.

Thanks for the tip; I had previously discounted robocopy because I
thought it could not copy individual files, only whole directories (with
exclusion patterns, but not inclusion patterns). It turns out I will not
use it for entirely different reasons.

The perfect archiving utility for Windows is something like this:

### archive_wal.c ###

#define UNICODE 1
#define _UNICODE 1
#include <windows.h>

int wmain(int argc, WCHAR *argv[])
{
    return ((argc == 3
         && CopyFile(argv[1], argv[2], TRUE) != 0) ? 0 : 1);
}

### end ###

archive_command = "archive_wal %p c:\wal\%f"

--
Christian

В списке pgsql-general по дате отправления:

Предыдущее
От: Andy Colson
Дата:
Сообщение: Re: Server stops responding in every week
Следующее
От: Greg Smith
Дата:
Сообщение: Re: SHMMAX and SHMALL question