Re: pg_basebackup check vs Windows file path limits

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_basebackup check vs Windows file path limits
Date: 2023-11-13 13:27:39
Message-ID: 1fab4bdd-d96a-29c7-eecf-55e55774a878@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2023-11-11 Sa 11:31, Alvaro Herrera wrote:
> On 2023-Jul-08, Andrew Dunstan wrote:
>
>> # Running: pg_basebackup -D C:\\tools\\nmsys64\\home\\pgrunner\\bf\\root\\REL_16_STABLE\\pgsql.build/testrun/pg_basebackup/010_pg_basebackup/data/t_010_pg_basebackup_main_data/backup/tarbackup2 -h C:/tools/nmsys64/tmp/63ohSgsh21 -p 54699 --checkpoint fast --no-sync -Ft
>> WARNING: aborting backup due to backend exiting before pg_backup_stop was called
>> pg_basebackup: error: could not initiate base backup: ERROR: could not get junction for "./pg_replslot": More data is available.
> Why not patch pgreadlink to use the method recommended by Microsoft,
> that DeviceIoControl() is called first with a NULL reparseBuffer to
> determine the size needed, then a second time with a buffer of that
> size?
>
> https://learn.microsoft.com/en-us/windows/win32/api/ioapiset/nf-ioapiset-deviceiocontrol

Hmm, here's what that page says - I can't see it saying what you're
suggesting here - am I missing something?:

|[in] nOutBufferSize|

The size of the output buffer, in bytes.

|[out, optional] lpBytesReturned|

A pointer to a variable that receives the size of the data stored in the
output buffer, in bytes.

If the output buffer is too small to receive any data, the call fails,
GetLastError
<https://learn.microsoft.com/en-us/windows/desktop/api/errhandlingapi/nf-errhandlingapi-getlasterror>
returns *ERROR_INSUFFICIENT_BUFFER*, and /lpBytesReturned/ is zero.

If the output buffer is too small to hold all of the data but can hold
some entries, some drivers will return as much data as fits. In this
case, the call fails, GetLastError
<https://learn.microsoft.com/en-us/windows/desktop/api/errhandlingapi/nf-errhandlingapi-getlasterror>
returns *ERROR_MORE_DATA*, and /lpBytesReturned/ indicates the amount of
data received. Your application should call *DeviceIoControl* again with
the same operation, specifying a new starting point.

cheers

andrew

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2023-11-13 13:32:07 Re: Improve WALRead() to suck data directly from WAL buffers when possible
Previous Message Pavel Stehule 2023-11-13 13:15:50 Re: proposal: possibility to read dumped table's name from file