diff options
Diffstat (limited to 'src/backend/replication')
-rw-r--r-- | src/backend/replication/basebackup.c | 19 | ||||
-rw-r--r-- | src/backend/replication/repl_gram.y | 11 | ||||
-rw-r--r-- | src/backend/replication/repl_scanner.l | 1 | ||||
-rw-r--r-- | src/backend/replication/walsender.c | 2 |
4 files changed, 24 insertions, 9 deletions
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c index b4d5bbe412e..943d80470bf 100644 --- a/src/backend/replication/basebackup.c +++ b/src/backend/replication/basebackup.c @@ -40,7 +40,7 @@ static void send_int8_string(StringInfoData *buf, int64 intval); static void SendBackupHeader(List *tablespaces); static void SendBackupDirectory(char *location, char *spcoid); static void base_backup_cleanup(int code, Datum arg); -static void perform_base_backup(const char *backup_label, bool progress, DIR *tblspcdir); +static void perform_base_backup(const char *backup_label, bool progress, DIR *tblspcdir, bool fastcheckpoint); typedef struct { @@ -67,9 +67,9 @@ base_backup_cleanup(int code, Datum arg) * clobbered by longjmp" from stupider versions of gcc. */ static void -perform_base_backup(const char *backup_label, bool progress, DIR *tblspcdir) +perform_base_backup(const char *backup_label, bool progress, DIR *tblspcdir, bool fastcheckpoint) { - do_pg_start_backup(backup_label, true); + do_pg_start_backup(backup_label, fastcheckpoint); PG_ENSURE_ERROR_CLEANUP(base_backup_cleanup, (Datum) 0); { @@ -135,7 +135,7 @@ perform_base_backup(const char *backup_label, bool progress, DIR *tblspcdir) * pg_stop_backup() for the user. */ void -SendBaseBackup(const char *backup_label, bool progress) +SendBaseBackup(const char *backup_label, bool progress, bool fastcheckpoint) { DIR *dir; MemoryContext backup_context; @@ -168,7 +168,7 @@ SendBaseBackup(const char *backup_label, bool progress) ereport(ERROR, (errmsg("unable to open directory pg_tblspc: %m"))); - perform_base_backup(backup_label, progress, dir); + perform_base_backup(backup_label, progress, dir, fastcheckpoint); FreeDir(dir); @@ -333,7 +333,16 @@ sendDir(char *path, int basepathlen, bool sizeonly) if (strcmp(pathbuf, "./pg_xlog") == 0) { if (!sizeonly) + { + /* If pg_xlog is a symlink, write it as a directory anyway */ +#ifndef WIN32 + if (S_ISLNK(statbuf.st_mode)) +#else + if (pgwin32_is_junction(pathbuf)) +#endif + statbuf.st_mode = S_IFDIR | S_IRWXU; _tarWriteHeader(pathbuf + basepathlen + 1, NULL, &statbuf); + } size += 512; /* Size of the header just added */ continue; /* don't recurse into pg_xlog */ } diff --git a/src/backend/replication/repl_gram.y b/src/backend/replication/repl_gram.y index 0ef33ddb4f9..e4f4c4742f6 100644 --- a/src/backend/replication/repl_gram.y +++ b/src/backend/replication/repl_gram.y @@ -66,11 +66,12 @@ Node *replication_parse_result; %token K_IDENTIFY_SYSTEM %token K_LABEL %token K_PROGRESS +%token K_FAST %token K_START_REPLICATION %type <node> command %type <node> base_backup start_replication identify_system -%type <boolval> opt_progress +%type <boolval> opt_progress opt_fast %type <str> opt_label %% @@ -102,15 +103,16 @@ identify_system: ; /* - * BASE_BACKUP [LABEL <label>] [PROGRESS] + * BASE_BACKUP [LABEL <label>] [PROGRESS] [FAST] */ base_backup: - K_BASE_BACKUP opt_label opt_progress + K_BASE_BACKUP opt_label opt_progress opt_fast { BaseBackupCmd *cmd = (BaseBackupCmd *) makeNode(BaseBackupCmd); cmd->label = $2; cmd->progress = $3; + cmd->fastcheckpoint = $4; $$ = (Node *) cmd; } @@ -123,6 +125,9 @@ opt_label: K_LABEL SCONST { $$ = $2; } opt_progress: K_PROGRESS { $$ = true; } | /* EMPTY */ { $$ = false; } ; +opt_fast: K_FAST { $$ = true; } + | /* EMPTY */ { $$ = false; } + ; /* * START_REPLICATION %X/%X diff --git a/src/backend/replication/repl_scanner.l b/src/backend/replication/repl_scanner.l index 014a72059a4..e6dfb041b6a 100644 --- a/src/backend/replication/repl_scanner.l +++ b/src/backend/replication/repl_scanner.l @@ -57,6 +57,7 @@ quotestop {quote} %% BASE_BACKUP { return K_BASE_BACKUP; } +FAST { return K_FAST; } IDENTIFY_SYSTEM { return K_IDENTIFY_SYSTEM; } LABEL { return K_LABEL; } PROGRESS { return K_PROGRESS; } diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index 0ad6804e552..14b43d855ba 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -402,7 +402,7 @@ HandleReplicationCommand(const char *cmd_string) { BaseBackupCmd *cmd = (BaseBackupCmd *) cmd_node; - SendBaseBackup(cmd->label, cmd->progress); + SendBaseBackup(cmd->label, cmd->progress, cmd->fastcheckpoint); /* Send CommandComplete and ReadyForQuery messages */ EndCommand("SELECT", DestRemote); |