pg_basebackup skips pg_replslot directory

Started by Sawada Masahikoalmost 12 years ago4 messages
#1Sawada Masahiko
sawada.mshk@gmail.com
1 attachment(s)

Hi all,

I found strange behavior of PostgreSQL of HEAD while using pg_basebackup.
pg_basebackup skips pg_replslot directory since
858ec11858a914d4c380971985709b6d6b7dd6fc commit.

But pg_repslot direcotry is needed to start replication. So the
standby server which is created by
pg_baseback can not start.
I got following FATAL error when the standby server starts.

FATAL: could not open directory "pg_replslot": No such file or directory

Is this a bug?
Attached file solves it by including pg_replslot directory as empty directory.

Please give feedback.

Regards,

-------
Sawada Masahiko

Attachments:

basebackup_pg_replslot.patchapplication/octet-stream; name=basebackup_pg_replslot.patchDownload
*** a/src/backend/replication/basebackup.c
--- b/src/backend/replication/basebackup.c
***************
*** 862,871 **** sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces)
  		if (strcmp(de->d_name, BACKUP_LABEL_FILE) == 0)
  			continue;
  
- 		/* Skip pg_replslot, not useful to copy */
- 		if (strcmp(de->d_name, "pg_replslot") == 0)
- 			continue;
- 
  		/*
  		 * Check if the postmaster has signaled us to exit, and abort with an
  		 * error in that case. The error handler further up will call
--- 862,867 ----
***************
*** 907,912 **** sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces)
--- 903,920 ----
  		}
  
  		/*
+ 		 * We can skip replication slot files. But include it as an empty
+ 		 * direcotry anyway.
+ 		 */
+ 		if (strcmp(pathbuf, "./pg_replslot") == 0)
+ 		{
+ 			if (!sizeonly)
+ 				_tarWriteHeader(pathbuf + basepathlen + 1, NULL, &statbuf);
+ 			size += 512;
+ 			continue;
+ 		}
+ 
+ 		/*
  		 * Skip temporary statistics files. PG_STAT_TMP_DIR must be skipped
  		 * even when stats_temp_directory is set because PGSS_TEXT_FILE is
  		 * always created there.
#2Andres Freund
andres@2ndquadrant.com
In reply to: Sawada Masahiko (#1)
Re: pg_basebackup skips pg_replslot directory

Hi,

On 2014-02-18 02:01:58 +0900, Sawada Masahiko wrote:

I found strange behavior of PostgreSQL of HEAD while using pg_basebackup.
pg_basebackup skips pg_replslot directory since
858ec11858a914d4c380971985709b6d6b7dd6fc commit.

But pg_repslot direcotry is needed to start replication. So the
standby server which is created by
pg_baseback can not start.
I got following FATAL error when the standby server starts.

Yes. Fujuii has submitted a similar patch, I was hoping he'd commit
it...

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Sawada Masahiko
sawada.mshk@gmail.com
In reply to: Andres Freund (#2)
Re: pg_basebackup skips pg_replslot directory

On Tue, Feb 18, 2014 at 2:07 AM, Andres Freund <andres@2ndquadrant.com> wrote:

Hi,

On 2014-02-18 02:01:58 +0900, Sawada Masahiko wrote:

I found strange behavior of PostgreSQL of HEAD while using pg_basebackup.
pg_basebackup skips pg_replslot directory since
858ec11858a914d4c380971985709b6d6b7dd6fc commit.

But pg_repslot direcotry is needed to start replication. So the
standby server which is created by
pg_baseback can not start.
I got following FATAL error when the standby server starts.

Yes. Fujuii has submitted a similar patch, I was hoping he'd commit
it...

I did not notice it.
Thank you for info!

Regards,

-------
Sawada Masahiko

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Andres Freund
andres@2ndquadrant.com
In reply to: Sawada Masahiko (#3)
Re: pg_basebackup skips pg_replslot directory

On 2014-02-18 02:16:19 +0900, Sawada Masahiko wrote:

On Tue, Feb 18, 2014 at 2:07 AM, Andres Freund <andres@2ndquadrant.com> wrote:

Hi,

On 2014-02-18 02:01:58 +0900, Sawada Masahiko wrote:

I found strange behavior of PostgreSQL of HEAD while using pg_basebackup.
pg_basebackup skips pg_replslot directory since
858ec11858a914d4c380971985709b6d6b7dd6fc commit.

But pg_repslot direcotry is needed to start replication. So the
standby server which is created by
pg_baseback can not start.
I got following FATAL error when the standby server starts.

Yes. Fujuii has submitted a similar patch, I was hoping he'd commit
it...

I did not notice it.
Thank you for info!

His patch and some discussion is at/around
http://archives.postgresql.org/message-id/CAHGQGwGvb0qXP7Q76xLUkGO%2BwE9SyJzvzF%3DQBOS-mxgiz0vfKw%40mail.gmail.com

Thanks for the patch,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers