On Sat, Feb 1, 2014 at 12:50 PM, Robert Haas <rh...@postgresql.org> wrote:
> Introduce replication slots.
>
> Replication slots are a crash-safe data structure which can be created
> on either a master or a standby to prevent premature removal of
> write-ahead log segments needed by a standby, as well as (with
> hot_standby_feedback=on) pruning of tuples whose removal would cause
> replication conflicts.  Slots have some advantages over existing
> techniques, as explained in the documentation.
>
> In a few places, we refer to the type of replication slots introduced
> by this patch as "physical" slots, because forthcoming patches for
> logical decoding will also have slots, but with somewhat different
> properties.

This patch changed basebackup.c so that it skips pg_replslot. It's OK
to skip all files in that directory, but an empty pg_replslot must be
included in the backup. Otherwise we cannot start PostgreSQL from
the backup taken via pg_basebackup. Attached patch fixes this problem.

Regards,

-- 
Fujii Masao
*** a/src/backend/replication/basebackup.c
--- b/src/backend/replication/basebackup.c
***************
*** 847,856 **** 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
--- 847,852 ----
***************
*** 892,897 **** sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces)
--- 888,905 ----
  		}
  
  		/*
+ 		 * Skip pg_replslot, not useful to copy. But include it as an empty
+ 		 * directory anyway, so we get permissions right.
+ 		 */
+ 		if (strcmp(de->d_name, "pg_replslot") == 0)
+ 		{
+ 			if (!sizeonly)
+ 				_tarWriteHeader(pathbuf + basepathlen + 1, NULL, &statbuf);
+ 			size += 512;		/* Size of the header just added */
+ 			continue;
+ 		}
+ 
+ 		/*
  		 * We can skip pg_xlog, the WAL segments need to be fetched from the
  		 * WAL archive anyway. But include it as an empty directory anyway, so
  		 * we get permissions right.
-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

Reply via email to