mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2024-11-24 08:52:38 +02:00
Code cleanup. Delete -W option
This commit is contained in:
parent
e2eed71657
commit
f35d0d7ee9
53
catalog.c
53
catalog.c
@ -479,58 +479,37 @@ pgBackupWriteIni(pgBackup *backup)
|
||||
static pgBackup *
|
||||
read_backup_from_file(const char *path)
|
||||
{
|
||||
pgBackup *backup;
|
||||
pgBackup *backup = pgut_new(pgBackup);
|
||||
char *backup_mode = NULL;
|
||||
char *start_lsn = NULL;
|
||||
char *stop_lsn = NULL;
|
||||
char *status = NULL;
|
||||
char *parent_backup = NULL;
|
||||
int i;
|
||||
|
||||
pgut_option options[] =
|
||||
{
|
||||
{'s', 0, "backup-mode", NULL, SOURCE_FILE_STRICT},
|
||||
{'u', 0, "timelineid", NULL, SOURCE_FILE_STRICT},
|
||||
{'s', 0, "start-lsn", NULL, SOURCE_FILE_STRICT},
|
||||
{'s', 0, "stop-lsn", NULL, SOURCE_FILE_STRICT},
|
||||
{'t', 0, "start-time", NULL, SOURCE_FILE_STRICT},
|
||||
{'t', 0, "end-time", NULL, SOURCE_FILE_STRICT},
|
||||
{'U', 0, "recovery-xid", NULL, SOURCE_FILE_STRICT},
|
||||
{'t', 0, "recovery-time", NULL, SOURCE_FILE_STRICT},
|
||||
{'I', 0, "data-bytes", NULL, SOURCE_FILE_STRICT},
|
||||
{'u', 0, "block-size", NULL, SOURCE_FILE_STRICT},
|
||||
{'u', 0, "xlog-block-size", NULL, SOURCE_FILE_STRICT},
|
||||
{'u', 0, "checksum_version", NULL, SOURCE_FILE_STRICT},
|
||||
{'u', 0, "stream", NULL, SOURCE_FILE_STRICT},
|
||||
{'s', 0, "status", NULL, SOURCE_FILE_STRICT},
|
||||
{'s', 0, "parent_backup", NULL, SOURCE_FILE_STRICT},
|
||||
{'s', 0, "backup-mode", &backup_mode, SOURCE_FILE_STRICT},
|
||||
{'u', 0, "timelineid", &backup->tli, SOURCE_FILE_STRICT},
|
||||
{'s', 0, "start-lsn", &start_lsn, SOURCE_FILE_STRICT},
|
||||
{'s', 0, "stop-lsn", &stop_lsn, SOURCE_FILE_STRICT},
|
||||
{'t', 0, "start-time", &backup->start_time, SOURCE_FILE_STRICT},
|
||||
{'t', 0, "end-time", &backup->end_time, SOURCE_FILE_STRICT},
|
||||
{'U', 0, "recovery-xid", &backup->recovery_xid, SOURCE_FILE_STRICT},
|
||||
{'t', 0, "recovery-time", &backup->recovery_time, SOURCE_FILE_STRICT},
|
||||
{'I', 0, "data-bytes", &backup->data_bytes, SOURCE_FILE_STRICT},
|
||||
{'u', 0, "block-size", &backup->block_size, SOURCE_FILE_STRICT},
|
||||
{'u', 0, "xlog-block-size", &backup->wal_block_size, SOURCE_FILE_STRICT},
|
||||
{'u', 0, "checksum_version", &backup->checksum_version, SOURCE_FILE_STRICT},
|
||||
{'u', 0, "stream", &backup->stream, SOURCE_FILE_STRICT},
|
||||
{'s', 0, "status", &status, SOURCE_FILE_STRICT},
|
||||
{'s', 0, "parent_backup", &parent_backup, SOURCE_FILE_STRICT},
|
||||
{0}
|
||||
};
|
||||
|
||||
if (access(path, F_OK) != 0)
|
||||
return NULL;
|
||||
|
||||
backup = pgut_new(pgBackup);
|
||||
init_backup(backup);
|
||||
|
||||
i = 0;
|
||||
options[i++].var = &backup_mode;
|
||||
options[i++].var = &backup->tli;
|
||||
options[i++].var = &start_lsn;
|
||||
options[i++].var = &stop_lsn;
|
||||
options[i++].var = &backup->start_time;
|
||||
options[i++].var = &backup->end_time;
|
||||
options[i++].var = &backup->recovery_xid;
|
||||
options[i++].var = &backup->recovery_time;
|
||||
options[i++].var = &backup->data_bytes;
|
||||
options[i++].var = &backup->block_size;
|
||||
options[i++].var = &backup->wal_block_size;
|
||||
options[i++].var = &backup->checksum_version;
|
||||
options[i++].var = &backup->stream;
|
||||
options[i++].var = &status;
|
||||
options[i++].var = &parent_backup;
|
||||
Assert(i == lengthof(options) - 1);
|
||||
|
||||
pgut_readopt(path, options, ERROR);
|
||||
|
||||
if (backup_mode)
|
||||
|
@ -35,8 +35,7 @@ const char *username = NULL;
|
||||
char *password = NULL;
|
||||
bool verbose = false;
|
||||
bool quiet = false;
|
||||
|
||||
bool prompt_password = false;
|
||||
bool prompt_password = true;
|
||||
|
||||
/* Database connections */
|
||||
static PGcancel *volatile cancel_conn = NULL;
|
||||
@ -75,7 +74,6 @@ static pgut_option default_options[] =
|
||||
{ 's', 'U', "username" , &username, SOURCE_CMDLINE },
|
||||
{ 'b', 'v', "verbose" , &verbose, SOURCE_CMDLINE },
|
||||
{ 'B', 'w', "no-password" , &prompt_password, SOURCE_CMDLINE },
|
||||
{ 'b', 'W', "password" , &prompt_password, SOURCE_CMDLINE },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
@ -882,13 +880,9 @@ PGconn *
|
||||
pgut_connect(const char *dbname)
|
||||
{
|
||||
PGconn *conn;
|
||||
|
||||
if (interrupted && !in_cleanup)
|
||||
elog(ERROR, "interrupted");
|
||||
|
||||
if (prompt_password)
|
||||
prompt_for_password(username);
|
||||
|
||||
/* Start the connection. Loop until we have a password if requested by backend. */
|
||||
for (;;)
|
||||
{
|
||||
|
@ -86,8 +86,6 @@ extern char *password;
|
||||
extern bool verbose;
|
||||
extern bool quiet;
|
||||
|
||||
extern bool prompt_password;
|
||||
|
||||
extern bool interrupted;
|
||||
|
||||
extern void help(bool details);
|
||||
|
Loading…
Reference in New Issue
Block a user