1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-06-06 02:07:22 +02:00

PGPRO-692: Improve help for archive-push/archive-get

This commit is contained in:
Arthur Zakirov 2017-12-13 13:39:49 +03:00
parent 7b0d214c0b
commit fbda56902b
2 changed files with 56 additions and 7 deletions

View File

@ -31,13 +31,13 @@ do_archive_push(char *wal_file_path, char *wal_file_name)
pgBackupConfig *config; pgBackupConfig *config;
if (wal_file_name == NULL && wal_file_path == NULL) if (wal_file_name == NULL && wal_file_path == NULL)
elog(ERROR, "required parameters are not specified: --wal_file_name %%f --wal_file_path %%p"); elog(ERROR, "required parameters are not specified: --wal-file-name %%f --wal-file-path %%p");
if (wal_file_name == NULL) if (wal_file_name == NULL)
elog(ERROR, "required parameter not specified: --wal_file_name %%f"); elog(ERROR, "required parameter not specified: --wal-file-name %%f");
if (wal_file_path == NULL) if (wal_file_path == NULL)
elog(ERROR, "required parameter not specified: --wal_file_path %%p"); elog(ERROR, "required parameter not specified: --wal-file-path %%p");
if (!getcwd(current_dir, sizeof(current_dir))) if (!getcwd(current_dir, sizeof(current_dir)))
elog(ERROR, "getcwd() error"); elog(ERROR, "getcwd() error");
@ -83,13 +83,13 @@ do_archive_get(char *wal_file_path, char *wal_file_name)
char current_dir[MAXPGPATH]; char current_dir[MAXPGPATH];
if (wal_file_name == NULL && wal_file_path == NULL) if (wal_file_name == NULL && wal_file_path == NULL)
elog(ERROR, "required parameters are not specified: --wal_file_name %%f --wal_file_path %%p"); elog(ERROR, "required parameters are not specified: --wal-file-name %%f --wal-file-path %%p");
if (wal_file_name == NULL) if (wal_file_name == NULL)
elog(ERROR, "required parameter not specified: --wal_file_name %%f"); elog(ERROR, "required parameter not specified: --wal-file-name %%f");
if (wal_file_path == NULL) if (wal_file_path == NULL)
elog(ERROR, "required parameter not specified: --wal_file_path %%p"); elog(ERROR, "required parameter not specified: --wal-file-path %%p");
if (!getcwd(current_dir, sizeof(current_dir))) if (!getcwd(current_dir, sizeof(current_dir)))
elog(ERROR, "getcwd() error"); elog(ERROR, "getcwd() error");

View File

@ -18,6 +18,8 @@ static void help_set_config(void);
static void help_show_config(void); static void help_show_config(void);
static void help_add_instance(void); static void help_add_instance(void);
static void help_del_instance(void); static void help_del_instance(void);
static void help_archive_push(void);
static void help_archive_get(void);
void void
help_command(char *command) help_command(char *command)
@ -42,6 +44,10 @@ help_command(char *command)
help_add_instance(); help_add_instance();
else if (strcmp(command, "del-instance") == 0) else if (strcmp(command, "del-instance") == 0)
help_del_instance(); help_del_instance();
else if (strcmp(command, "archive-push") == 0)
help_archive_push();
else if (strcmp(command, "archive-get") == 0)
help_archive_get();
else if (strcmp(command, "--help") == 0 else if (strcmp(command, "--help") == 0
|| strcmp(command, "help") == 0 || strcmp(command, "help") == 0
|| strcmp(command, "-?") == 0 || strcmp(command, "-?") == 0
@ -117,6 +123,15 @@ help_pg_probackup(void)
printf(_("\n %s del-instance -B backup-dir\n"), PROGRAM_NAME); printf(_("\n %s del-instance -B backup-dir\n"), PROGRAM_NAME);
printf(_(" --instance=instance_name\n")); printf(_(" --instance=instance_name\n"));
printf(_("\n %s archive-push -B backup-dir --instance=instance_name\n"), PROGRAM_NAME);
printf(_(" --wal-file-path=wal-file-path\n"));
printf(_(" --wal-file-name=wal-file-name\n"));
printf(_(" [--compress [--compress-level=compress-level]]\n"));
printf(_("\n %s archive-get -B backup-dir --instance=instance_name\n"), PROGRAM_NAME);
printf(_(" --wal-file-path=wal-file-path\n"));
printf(_(" --wal-file-name=wal-file-name\n"));
if ((PROGRAM_URL || PROGRAM_EMAIL)) if ((PROGRAM_URL || PROGRAM_EMAIL))
{ {
printf("\n"); printf("\n");
@ -308,7 +323,7 @@ help_set_config(void)
printf(_("\n Replica options:\n")); printf(_("\n Replica options:\n"));
printf(_(" --master-db=db_name database to connect to master\n")); printf(_(" --master-db=db_name database to connect to master\n"));
printf(_(" --master-host=host_name database server host of master\n")); printf(_(" --master-host=host_name database server host of master\n"));
printf(_(" --master-port=port=port database server port of master\n")); printf(_(" --master-port=port database server port of master\n"));
printf(_(" --master-user=user_name user name to connect to master\n")); printf(_(" --master-user=user_name user name to connect to master\n"));
printf(_(" --replica-timeout=timeout wait timeout for WAL segment streaming through replication\n")); printf(_(" --replica-timeout=timeout wait timeout for WAL segment streaming through replication\n"));
} }
@ -342,3 +357,37 @@ help_del_instance(void)
printf(_(" -B, --backup-path=backup-path location of the backup storage area\n")); printf(_(" -B, --backup-path=backup-path location of the backup storage area\n"));
printf(_(" --instance=instance_name name of the instance to delete\n")); printf(_(" --instance=instance_name name of the instance to delete\n"));
} }
static void
help_archive_push(void)
{
printf(_("\n %s archive-push -B backup-dir --instance=instance_name\n"), PROGRAM_NAME);
printf(_(" --wal-file-path=wal-file-path\n"));
printf(_(" --wal-file-name=wal-file-name\n"));
printf(_(" [--compress [--compress-level=compress-level]]\n\n"));
printf(_(" -B, --backup-path=backup-path location of the backup storage area\n"));
printf(_(" --instance=instance_name name of the instance to delete\n"));
printf(_(" --wal-file-path=wal-file-path\n"));
printf(_(" relative path name of the WAL file on the server\n"));
printf(_(" --wal-file-name=wal-file-name\n"));
printf(_(" name of the WAL file to retrieve from the server\n"));
printf(_(" --compress compress WAL file during archiving\n"));
printf(_(" --compress-level=compress-level\n"));
printf(_(" level of compression [0-9]\n"));
}
static void
help_archive_get(void)
{
printf(_("\n %s archive-get -B backup-dir --instance=instance_name\n"), PROGRAM_NAME);
printf(_(" --wal-file-path=wal-file-path\n"));
printf(_(" --wal-file-name=wal-file-name\n\n"));
printf(_(" -B, --backup-path=backup-path location of the backup storage area\n"));
printf(_(" --instance=instance_name name of the instance to delete\n"));
printf(_(" --wal-file-path=wal-file-path\n"));
printf(_(" relative destination path name of the WAL file on the server\n"));
printf(_(" --wal-file-name=wal-file-name\n"));
printf(_(" name of the WAL file to retrieve from the archive\n"));
}