Skip to content

Commit

Permalink
fix: Allow setting maximum-backup-rate on create postgres step (#812)
Browse files Browse the repository at this point in the history
  • Loading branch information
amontalban committed Sep 24, 2021
1 parent 93fc6b1 commit 87acba1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
7 changes: 7 additions & 0 deletions docs/ref/pg_autoctl_create_postgres.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ registered too, and is known to be healthy).
--server-cert set the Postgres ssl_cert_file to that file path
--candidate-priority priority of the node to be promoted to become primary
--replication-quorum true if node participates in write quorum
--maximum-backup-rate maximum transfer rate of data transferred from the server during initial sync

Description
-----------
Expand Down Expand Up @@ -261,6 +262,12 @@ The following options are available to ``pg_autoctl create postgres``:
value (either ``true`` or ``false``) at node registration on the monitor.
Defaults to ``true``, which enables synchronous replication.

--maximum-backup-rate

Sets the maximum transfer rate of data transferred from the server during
initial sync. This is used by ``pg_basebackup``.
Defaults to ``100M``.

--run

Immediately run the ``pg_autoctl`` service after having created this node.
Expand Down
11 changes: 11 additions & 0 deletions src/bin/pg_autoctl/cli_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ int monitorDisabledNodeId = -1;
* { "citus-cluster", required_argument, NULL, 'Z' },
* { "candidate-priority", required_argument, NULL, 'P'},
* { "replication-quorum", required_argument, NULL, 'r'},
* { "maximum-backup-rate", required_argument, NULL, 'R' },
* { "help", no_argument, NULL, 0 },
* { "run", no_argument, NULL, 'x' },
* { "ssl-self-signed", no_argument, NULL, 's' },
Expand Down Expand Up @@ -389,6 +390,16 @@ cli_common_keeper_getopts(int argc, char **argv,
break;
}

case 'R':
{
/* { "maximum-backup-rate", required_argument, NULL, 'R' } */
strlcpy(LocalOptionConfig.maximum_backup_rate, optarg,
MAXIMUM_BACKUP_RATE_LEN);
log_trace("--maximum-backup-rate %s",
LocalOptionConfig.maximum_backup_rate);
break;
}

case 'V':
{
/* keeper_cli_print_version prints version and exits. */
Expand Down
4 changes: 3 additions & 1 deletion src/bin/pg_autoctl/cli_create_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ CommandLine create_postgres_command =
" --pg-hba-lan edit pg_hba.conf rules for --dbname in detected LAN\n"
KEEPER_CLI_SSL_OPTIONS
" --candidate-priority priority of the node to be promoted to become primary\n"
" --replication-quorum true if node participates in write quorum\n",
" --replication-quorum true if node participates in write quorum\n"
" --maximum-backup-rate maximum transfer rate of data transferred from the server during initial sync\n",
cli_create_postgres_getopts,
cli_create_postgres);

Expand Down Expand Up @@ -272,6 +273,7 @@ cli_create_postgres_getopts(int argc, char **argv)
{ "help", no_argument, NULL, 'h' },
{ "candidate-priority", required_argument, NULL, 'P' },
{ "replication-quorum", required_argument, NULL, 'r' },
{ "maximum-backup-rate", required_argument, NULL, 'R' },
{ "run", no_argument, NULL, 'x' },
{ "no-ssl", no_argument, NULL, 'N' },
{ "ssl-self-signed", no_argument, NULL, 's' },
Expand Down

0 comments on commit 87acba1

Please sign in to comment.