RE: invalid data in file backup_label problem on windows - Mailing list pgsql-hackers

From wangsh.fnst@fujitsu.com
Subject RE: invalid data in file backup_label problem on windows
Date
Msg-id OSBPR01MB4214051A0D5D8D7C990D1FF2F2689@OSBPR01MB4214.jpnprd01.prod.outlook.com
Whole thread Raw
In response to invalid data in file backup_label problem on windows  ("Wang, Shenhao" <wangsh.fnst@cn.fujitsu.com>)
Responses Re: invalid data in file backup_label problem on windows  (David Steele <david@pgmasters.net>)
List pgsql-hackers
Hi,

David Steele <david@pgmasters.net> wrote:

> I'm not sure how I feel about this patch (not really a Windows person)
> but I do think that you shouldn't modify the backup_label when writing
> it, i.e. you should be writing backup_label in binary mode to avoid this
> issue.

IMO, I don't modify backup_lable, I just execute select * FROM pg_stop_backup(),
copy the result from terminal to a file and save the file, but most of editor on
Windows will using CRLF as default to edit file, such as notepad, notepad++.

BTW, in [1]
> The pg_stop_backup will return one row with three values. The second
> of these fields should be written to a file named backup_label in the root
> directory of the backup. The third field should be written to a file named
> tablespace_map unless the field is empty. These files are vital to the backup
> working, and must be written without modification.

Do not use CRLF to edit a backup_label on windows is not mentioned.

> No objections from me if it gets committed but I'm not sure it should be
> classified as a "bug fix" since the backup_label was modified from what
> postgres provided, unless I am misunderstanding.

I think the backup_label is not a postgres provided file(using Non-Exclusive Low Level API),
this file must be created by user.
If users use Exclusive Low Level API or pg_basebakup, this file will be auto created, and
users will not edit this file.

Therefore, I think this is a bug instead of a misuse

[1] https://www.postgresql.org/docs/13/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP

-------------
Best Regards
Shenhao Wang



pgsql-hackers by date:

Previous
From: "houzj.fnst@fujitsu.com"
Date:
Subject: RE: Parallel Inserts in CREATE TABLE AS
Next
From: Etsuro Fujita
Date:
Subject: Re: Asynchronous Append on postgres_fdw nodes.