diff options
author | Magnus Hagander <magnus@hagander.net> | 2011-01-14 16:30:33 +0100 |
---|---|---|
committer | Magnus Hagander <magnus@hagander.net> | 2011-01-14 16:30:33 +0100 |
commit | fcd810c69adf11b6ec1cff35359be0dd27662eff (patch) | |
tree | b4edb043afe37dc221b765572aa90dafafefcfc7 /src/backend/replication/basebackup.c | |
parent | 688423d004f4092aed73c73a3281c281d476436d (diff) | |
download | postgresql-fcd810c69adf11b6ec1cff35359be0dd27662eff.tar.gz postgresql-fcd810c69adf11b6ec1cff35359be0dd27662eff.zip |
Use a lexer and grammar for parsing walsender commands
Makes it easier to parse mainly the BASE_BACKUP command
with it's options, and avoids having to manually deal
with quoted identifiers in the label (previously broken),
and makes it easier to add new commands and options in
the future.
In passing, refactor the case statement in the walsender
to put each command in it's own function.
Diffstat (limited to 'src/backend/replication/basebackup.c')
-rw-r--r-- | src/backend/replication/basebackup.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c index 7929f855f6d..1ed5e2a6c9e 100644 --- a/src/backend/replication/basebackup.c +++ b/src/backend/replication/basebackup.c @@ -98,12 +98,10 @@ perform_base_backup(const char *backup_label, List *tablespaces) * pg_stop_backup() for the user. */ void -SendBaseBackup(const char *options) +SendBaseBackup(const char *backup_label, bool progress) { DIR *dir; struct dirent *de; - char *backup_label = strchr(options, ';'); - bool progress = false; List *tablespaces = NIL; tablespaceinfo *ti; MemoryContext backup_context; @@ -119,18 +117,7 @@ SendBaseBackup(const char *options) WalSndSetState(WALSNDSTATE_BACKUP); if (backup_label == NULL) - ereport(FATAL, - (errcode(ERRCODE_PROTOCOL_VIOLATION), - errmsg("invalid base backup options: %s", options))); - backup_label++; /* Walk past the semicolon */ - - /* Currently the only option string supported is PROGRESS */ - if (strncmp(options, "PROGRESS", 8) == 0) - progress = true; - else if (options[0] != ';') - ereport(FATAL, - (errcode(ERRCODE_PROTOCOL_VIOLATION), - errmsg("invalid base backup options: %s", options))); + backup_label = "base backup"; if (update_process_title) { |