RE: invalid data in file backup_label problem on windows

From: "wangsh(dot)fnst(at)fujitsu(dot)com" <wangsh(dot)fnst(at)fujitsu(dot)com>
To: David Steele <david(at)pgmasters(dot)net>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: invalid data in file backup_label problem on windows
Date: 2021-03-20 02:09:39
Message-ID: OSBPR01MB4214C3E09959ECF9A0A1C8CCF2679@OSBPR01MB4214.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Steele <david(at)pgmasters(dot)net> wrote:

> It's not clear to me what text editors have to do with this? Are you
> editing the file manually?

When I execute SELECT * FROM pg_stop_backup(false, true) in psql.

The results will be shown like:
lsn | labelfile | spcmapfile
------------+---------------------------------------------------------------------+------------
0/2000138 | START WAL LOCATION: 0/2000028 (file 000000010000000000000002)+|
| CHECKPOINT LOCATION: 0/2000060 +|
| BACKUP METHOD: streamed +|
| BACKUP FROM: master +
......
The results only will be shown on screen and this function will not generate any files. What I do is write
the second field(labelfile) to a new file backup_label and write the third field(spcmapfile) to tablespace_map if
the third field is not null.

Therefore, I choose a text editor to help me write the file.
I copy the a line in second field and paste this to text editor and press the 'enter' key, repeat this action util
all the line have be pasted to text editor, then save the file.

If this is not a good way to create the backup_label file, can you tell me how can I create this file on windows?

I think the real problem is this file on windows is opened with binary mode. If I use libpq to get the result and write
the result to file directly(the default action on windows is open file in text mode), this problem will be happened.
So I consider this is a bug.

Best Regards,
Shenhao Wang

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-03-20 02:17:41 Re: Logical Replication vs. 2PC
Previous Message Peter Geoghegan 2021-03-20 02:05:28 Re: New IndexAM API controlling index vacuum strategies