ERROR: could not open file "pg_tblspc/ issue with replication setup.

Started by Rajkumar Raghuwanshiover 5 years ago3 messages
#1Rajkumar Raghuwanshi
rajkumar.raghuwanshi@enterprisedb.com
1 attachment(s)

Hi,

While testing for a feature I got this tablespace related error while
running script.
The Issue is not reproducible everytime, but If I am running the same set
of commands after 2-3 runs I am able to reproduce the same error.

--first run - pass
# master slave setup
+ mkdir /tmp/test_bkp/tblsp01
+ ./psql postgres -p 5432 -c 'create tablespace tblsp01 location
'\''/tmp/test_bkp/tblsp01'\'';'
CREATE TABLESPACE
+ ./psql postgres -p 5432 -c 'create table test (a text) tablespace
tblsp01;'
CREATE TABLE
#cleanup
--next
#master-slave setup
+ mkdir /tmp/test_bkp/tblsp01
+ ./psql postgres -p 5432 -c 'create tablespace tblsp01 location
'\''/tmp/test_bkp/tblsp01'\'';'
CREATE TABLESPACE
+ ./psql postgres -p 5432 -c 'create table test (a text) tablespace
tblsp01;'
ERROR:  could not open file "pg_tblspc/16384/PG_13_202004074/13530/16388":
No such file or directory

Attaching command and script which help to reproduce it.
[edb@localhost bin]$ while sh pg_tblsp_wal.sh; do :; done

Thanks & Regards,
Rajkumar Raghuwanshi

Attachments:

pg_tblsp_wal.shapplication/x-shellscript; name=pg_tblsp_wal.shDownload
#2Michael Paquier
michael@paquier.xyz
In reply to: Rajkumar Raghuwanshi (#1)
Re: ERROR: could not open file "pg_tblspc/ issue with replication setup.

On Thu, Apr 16, 2020 at 01:56:47PM +0530, Rajkumar Raghuwanshi wrote:

While testing for a feature I got this tablespace related error while
running script.

Primary and standby are running on the same host, so they would
interact with each other as the tablespace path used by both clusters
would be the same (primary uses the path defined by the DDL, which is
registered in the WAL record the standby replays). What you are
looking for here is to create the tablespace before taking the base
backup, and then use the option --tablespace-mapping with
pg_basebackup to avoid the issue.
--
Michael

#3Rajkumar Raghuwanshi
rajkumar.raghuwanshi@enterprisedb.com
In reply to: Michael Paquier (#2)
Re: ERROR: could not open file "pg_tblspc/ issue with replication setup.

On Fri, Apr 17, 2020 at 9:51 AM Michael Paquier <michael@paquier.xyz> wrote:

On Thu, Apr 16, 2020 at 01:56:47PM +0530, Rajkumar Raghuwanshi wrote:

While testing for a feature I got this tablespace related error while
running script.

Primary and standby are running on the same host, so they would
interact with each other as the tablespace path used by both clusters
would be the same (primary uses the path defined by the DDL, which is
registered in the WAL record the standby replays). What you are
looking for here is to create the tablespace before taking the base
backup, and then use the option --tablespace-mapping with
pg_basebackup to avoid the issue.

Thanks for the help.

Show quoted text

--
Michael