You've already forked pg_probackup
mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-09-16 09:26:30 +02:00
PBCKP-91 fix grammar in probackup's log messages
This commit is contained in:
@@ -614,7 +614,7 @@ part_opened:
|
||||
if (thread_interrupted || interrupted)
|
||||
{
|
||||
pg_atomic_write_u32(&wal_file->done, 1);
|
||||
elog(ERROR, "terminated while waiting for prev file");
|
||||
elog(ERROR, "Terminated while waiting for prev file");
|
||||
}
|
||||
usleep(250);
|
||||
}
|
||||
@@ -903,7 +903,7 @@ part_opened:
|
||||
if (thread_interrupted || interrupted)
|
||||
{
|
||||
pg_atomic_write_u32(&wal_file->done, 1);
|
||||
elog(ERROR, "terminated while waiting for prev file");
|
||||
elog(ERROR, "Terminated while waiting for prev file");
|
||||
}
|
||||
usleep(250);
|
||||
}
|
||||
|
33
src/backup.c
33
src/backup.c
@@ -84,7 +84,7 @@ backup_stopbackup_callback(bool fatal, void *userdata)
|
||||
*/
|
||||
if (backup_in_progress)
|
||||
{
|
||||
elog(WARNING, "backup in progress, stop backup");
|
||||
elog(WARNING, "A backup is in progress, stopping it.");
|
||||
/* don't care about stop_lsn in case of error */
|
||||
pg_stop_backup_send(st->conn, st->server_version, current.from_replica, exclusive_backup, NULL);
|
||||
}
|
||||
@@ -711,8 +711,9 @@ do_backup(InstanceState *instanceState, pgSetBackupParams *set_backup_params,
|
||||
char pretty_bytes[20];
|
||||
|
||||
if (!instance_config.pgdata)
|
||||
elog(ERROR, "required parameter not specified: PGDATA "
|
||||
"(-D, --pgdata)");
|
||||
elog(ERROR, "No postgres data directory specified.\n"
|
||||
"Please specify it either using environment variable PGDATA or\n"
|
||||
"command line option --pgdata (-D)");
|
||||
|
||||
/* Initialize PGInfonode */
|
||||
pgNodeInit(&nodeInfo);
|
||||
@@ -936,12 +937,12 @@ check_server_version(PGconn *conn, PGNodeInfo *nodeInfo)
|
||||
|
||||
if (nodeInfo->server_version < 90500)
|
||||
elog(ERROR,
|
||||
"server version is %s, must be %s or higher",
|
||||
"Server version is %s, must be %s or higher",
|
||||
nodeInfo->server_version_str, "9.5");
|
||||
|
||||
if (current.from_replica && nodeInfo->server_version < 90600)
|
||||
elog(ERROR,
|
||||
"server version is %s, must be %s or higher for backup from replica",
|
||||
"Server version is %s, must be %s or higher for backup from replica",
|
||||
nodeInfo->server_version_str, "9.6");
|
||||
|
||||
if (nodeInfo->pgpro_support)
|
||||
@@ -1050,7 +1051,7 @@ confirm_block_size(PGconn *conn, const char *name, int blcksz)
|
||||
|
||||
res = pgut_execute(conn, "SELECT pg_catalog.current_setting($1)", 1, &name);
|
||||
if (PQntuples(res) != 1 || PQnfields(res) != 1)
|
||||
elog(ERROR, "cannot get %s: %s", name, PQerrorMessage(conn));
|
||||
elog(ERROR, "Cannot get %s: %s", name, PQerrorMessage(conn));
|
||||
|
||||
block_size = strtol(PQgetvalue(res, 0, 0), &endp, 10);
|
||||
if ((endp && *endp) || block_size != blcksz)
|
||||
@@ -1439,7 +1440,7 @@ wait_wal_lsn(const char *wal_segment_dir, XLogRecPtr target_lsn, bool is_start_l
|
||||
}
|
||||
|
||||
if (!current.stream && is_start_lsn && try_count == 30)
|
||||
elog(WARNING, "By default pg_probackup assume WAL delivery method to be ARCHIVE. "
|
||||
elog(WARNING, "By default pg_probackup assumes that WAL delivery method to be ARCHIVE. "
|
||||
"If continuous archiving is not set up, use '--stream' option to make autonomous backup. "
|
||||
"Otherwise check that continuous archiving works correctly.");
|
||||
|
||||
@@ -1775,9 +1776,9 @@ pg_stop_backup_consume(PGconn *conn, int server_version,
|
||||
{
|
||||
pgut_cancel(conn);
|
||||
#if PG_VERSION_NUM >= 150000
|
||||
elog(ERROR, "interrupted during waiting for pg_backup_stop");
|
||||
elog(ERROR, "Interrupted during waiting for pg_backup_stop");
|
||||
#else
|
||||
elog(ERROR, "interrupted during waiting for pg_stop_backup");
|
||||
elog(ERROR, "Interrupted during waiting for pg_stop_backup");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1823,7 +1824,7 @@ pg_stop_backup_consume(PGconn *conn, int server_version,
|
||||
case PGRES_TUPLES_OK:
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "query failed: %s query was: %s",
|
||||
elog(ERROR, "Query failed: %s query was: %s",
|
||||
PQerrorMessage(conn), query_text);
|
||||
}
|
||||
backup_in_progress = false;
|
||||
@@ -1834,13 +1835,13 @@ pg_stop_backup_consume(PGconn *conn, int server_version,
|
||||
/* get&check recovery_xid */
|
||||
if (sscanf(PQgetvalue(query_result, 0, recovery_xid_colno), XID_FMT, &result->snapshot_xid) != 1)
|
||||
elog(ERROR,
|
||||
"result of txid_snapshot_xmax() is invalid: %s",
|
||||
"Result of txid_snapshot_xmax() is invalid: %s",
|
||||
PQgetvalue(query_result, 0, recovery_xid_colno));
|
||||
|
||||
/* get&check recovery_time */
|
||||
if (!parse_time(PQgetvalue(query_result, 0, recovery_time_colno), &result->invocation_time, true))
|
||||
elog(ERROR,
|
||||
"result of current_timestamp is invalid: %s",
|
||||
"Result of current_timestamp is invalid: %s",
|
||||
PQgetvalue(query_result, 0, recovery_time_colno));
|
||||
|
||||
/* get stop_backup_lsn */
|
||||
@@ -1898,13 +1899,13 @@ pg_stop_backup_write_file_helper(const char *path, const char *filename, const c
|
||||
join_path_components(full_filename, path, filename);
|
||||
fp = fio_fopen(full_filename, PG_BINARY_W, FIO_BACKUP_HOST);
|
||||
if (fp == NULL)
|
||||
elog(ERROR, "can't open %s file \"%s\": %s",
|
||||
elog(ERROR, "Can't open %s file \"%s\": %s",
|
||||
error_msg_filename, full_filename, strerror(errno));
|
||||
|
||||
if (fio_fwrite(fp, data, len) != len ||
|
||||
fio_fflush(fp) != 0 ||
|
||||
fio_fclose(fp))
|
||||
elog(ERROR, "can't write %s file \"%s\": %s",
|
||||
elog(ERROR, "Can't write %s file \"%s\": %s",
|
||||
error_msg_filename, full_filename, strerror(errno));
|
||||
|
||||
/*
|
||||
@@ -1943,7 +1944,7 @@ pg_stop_backup(InstanceState *instanceState, pgBackup *backup, PGconn *pg_startb
|
||||
|
||||
/* Remove it ? */
|
||||
if (!backup_in_progress)
|
||||
elog(ERROR, "backup is not in progress");
|
||||
elog(ERROR, "Backup is not in progress");
|
||||
|
||||
pg_silent_client_messages(pg_startbackup_conn);
|
||||
|
||||
@@ -2098,7 +2099,7 @@ backup_files(void *arg)
|
||||
|
||||
/* check for interrupt */
|
||||
if (interrupted || thread_interrupted)
|
||||
elog(ERROR, "interrupted during backup");
|
||||
elog(ERROR, "Interrupted during backup");
|
||||
|
||||
elog(progress ? INFO : LOG, "Progress: (%d/%d). Process file \"%s\"",
|
||||
i + 1, n_backup_files_list, file->rel_path);
|
||||
|
@@ -1055,7 +1055,7 @@ get_backup_filelist(pgBackup *backup, bool strict)
|
||||
|
||||
fp = fio_open_stream(backup_filelist_path, FIO_BACKUP_HOST);
|
||||
if (fp == NULL)
|
||||
elog(ERROR, "cannot open \"%s\": %s", backup_filelist_path, strerror(errno));
|
||||
elog(ERROR, "Cannot open \"%s\": %s", backup_filelist_path, strerror(errno));
|
||||
|
||||
/* enable stdio buffering for local file */
|
||||
if (!fio_is_remote(FIO_BACKUP_HOST))
|
||||
@@ -2841,7 +2841,7 @@ parse_backup_mode(const char *value)
|
||||
return BACKUP_MODE_DIFF_DELTA;
|
||||
|
||||
/* Backup mode is invalid, so leave with an error */
|
||||
elog(ERROR, "invalid backup-mode \"%s\"", value);
|
||||
elog(ERROR, "Invalid backup-mode \"%s\"", value);
|
||||
return BACKUP_MODE_INVALID;
|
||||
}
|
||||
|
||||
@@ -2876,7 +2876,7 @@ parse_compress_alg(const char *arg)
|
||||
len = strlen(arg);
|
||||
|
||||
if (len == 0)
|
||||
elog(ERROR, "compress algorithm is empty");
|
||||
elog(ERROR, "Compress algorithm is empty");
|
||||
|
||||
if (pg_strncasecmp("zlib", arg, len) == 0)
|
||||
return ZLIB_COMPRESS;
|
||||
@@ -2885,7 +2885,7 @@ parse_compress_alg(const char *arg)
|
||||
else if (pg_strncasecmp("none", arg, len) == 0)
|
||||
return NONE_COMPRESS;
|
||||
else
|
||||
elog(ERROR, "invalid compress algorithm value \"%s\"", arg);
|
||||
elog(ERROR, "Invalid compress algorithm value \"%s\"", arg);
|
||||
|
||||
return NOT_DEFINED_COMPRESS;
|
||||
}
|
||||
|
@@ -184,7 +184,7 @@ catchup_preflight_checks(PGNodeInfo *source_node_info, PGconn *source_conn,
|
||||
if (source_node_info->ptrack_version_num == 0)
|
||||
elog(ERROR, "This PostgreSQL instance does not support ptrack");
|
||||
else if (source_node_info->ptrack_version_num < 200)
|
||||
elog(ERROR, "ptrack extension is too old.\n"
|
||||
elog(ERROR, "Ptrack extension is too old.\n"
|
||||
"Upgrade ptrack to version >= 2");
|
||||
else if (!source_node_info->is_ptrack_enabled)
|
||||
elog(ERROR, "Ptrack is disabled");
|
||||
|
@@ -145,7 +145,7 @@ check_files(void *arg)
|
||||
|
||||
/* check for interrupt */
|
||||
if (interrupted || thread_interrupted)
|
||||
elog(ERROR, "interrupted during checkdb");
|
||||
elog(ERROR, "Interrupted during checkdb");
|
||||
|
||||
/* No need to check directories */
|
||||
if (S_ISDIR(file->mode))
|
||||
@@ -750,7 +750,7 @@ do_checkdb(bool need_amcheck,
|
||||
if (!skip_block_validation)
|
||||
{
|
||||
if (!pgdata)
|
||||
elog(ERROR, "required parameter not specified: PGDATA "
|
||||
elog(ERROR, "Required parameter not specified: PGDATA "
|
||||
"(-D, --pgdata)");
|
||||
|
||||
/* get node info */
|
||||
|
22
src/dir.c
22
src/dir.c
@@ -182,7 +182,7 @@ pgFileNew(const char *path, const char *rel_path, bool follow_symlink,
|
||||
/* file not found is not an error case */
|
||||
if (errno == ENOENT)
|
||||
return NULL;
|
||||
elog(ERROR, "cannot stat file \"%s\": %s", path,
|
||||
elog(ERROR, "Cannot stat file \"%s\": %s", path,
|
||||
strerror(errno));
|
||||
}
|
||||
|
||||
@@ -787,14 +787,14 @@ opt_path_map(ConfigOption *opt, const char *arg, TablespaceList *list,
|
||||
for (arg_ptr = arg; *arg_ptr; arg_ptr++)
|
||||
{
|
||||
if (dst_ptr - dst >= MAXPGPATH)
|
||||
elog(ERROR, "directory name too long");
|
||||
elog(ERROR, "Directory name too long");
|
||||
|
||||
if (*arg_ptr == '\\' && *(arg_ptr + 1) == '=')
|
||||
; /* skip backslash escaping = */
|
||||
else if (*arg_ptr == '=' && (arg_ptr == arg || *(arg_ptr - 1) != '\\'))
|
||||
{
|
||||
if (*cell->new_dir)
|
||||
elog(ERROR, "multiple \"=\" signs in %s mapping\n", type);
|
||||
elog(ERROR, "Multiple \"=\" signs in %s mapping\n", type);
|
||||
else
|
||||
dst = dst_ptr = cell->new_dir;
|
||||
}
|
||||
@@ -803,7 +803,7 @@ opt_path_map(ConfigOption *opt, const char *arg, TablespaceList *list,
|
||||
}
|
||||
|
||||
if (!*cell->old_dir || !*cell->new_dir)
|
||||
elog(ERROR, "invalid %s mapping format \"%s\", "
|
||||
elog(ERROR, "Invalid %s mapping format \"%s\", "
|
||||
"must be \"OLDDIR=NEWDIR\"", type, arg);
|
||||
canonicalize_path(cell->old_dir);
|
||||
canonicalize_path(cell->new_dir);
|
||||
@@ -815,11 +815,11 @@ opt_path_map(ConfigOption *opt, const char *arg, TablespaceList *list,
|
||||
* consistent with the new_dir check.
|
||||
*/
|
||||
if (!is_absolute_path(cell->old_dir))
|
||||
elog(ERROR, "old directory is not an absolute path in %s mapping: %s\n",
|
||||
elog(ERROR, "Old directory is not an absolute path in %s mapping: %s\n",
|
||||
type, cell->old_dir);
|
||||
|
||||
if (!is_absolute_path(cell->new_dir))
|
||||
elog(ERROR, "new directory is not an absolute path in %s mapping: %s\n",
|
||||
elog(ERROR, "New directory is not an absolute path in %s mapping: %s\n",
|
||||
type, cell->new_dir);
|
||||
|
||||
if (list->tail)
|
||||
@@ -1046,7 +1046,7 @@ read_tablespace_map(parray *links, const char *backup_dir)
|
||||
int i = 0;
|
||||
|
||||
if (sscanf(buf, "%s %n", link_name, &n) != 1)
|
||||
elog(ERROR, "invalid format found in \"%s\"", map_path);
|
||||
elog(ERROR, "Invalid format found in \"%s\"", map_path);
|
||||
|
||||
path = buf + n;
|
||||
|
||||
@@ -1438,7 +1438,7 @@ get_control_value_str(const char *str, const char *name,
|
||||
{
|
||||
/* verify if value_str not exceeds value_str_size limits */
|
||||
if (value_str - value_str_start >= value_str_size - 1) {
|
||||
elog(ERROR, "field \"%s\" is out of range in the line %s of the file %s",
|
||||
elog(ERROR, "Field \"%s\" is out of range in the line %s of the file %s",
|
||||
name, str, DATABASE_FILE_LIST);
|
||||
}
|
||||
*value_str = *buf;
|
||||
@@ -1463,7 +1463,7 @@ get_control_value_str(const char *str, const char *name,
|
||||
|
||||
/* Did not find target field */
|
||||
if (is_mandatory)
|
||||
elog(ERROR, "field \"%s\" is not found in the line %s of the file %s",
|
||||
elog(ERROR, "Field \"%s\" is not found in the line %s of the file %s",
|
||||
name, str, DATABASE_FILE_LIST);
|
||||
return false;
|
||||
}
|
||||
@@ -1490,7 +1490,7 @@ dir_is_empty(const char *path, fio_location location)
|
||||
/* Directory in path doesn't exist */
|
||||
if (errno == ENOENT)
|
||||
return true;
|
||||
elog(ERROR, "cannot open directory \"%s\": %s", path, strerror(errno));
|
||||
elog(ERROR, "Cannot open directory \"%s\": %s", path, strerror(errno));
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
@@ -1506,7 +1506,7 @@ dir_is_empty(const char *path, fio_location location)
|
||||
return false;
|
||||
}
|
||||
if (errno)
|
||||
elog(ERROR, "cannot read directory \"%s\": %s", path, strerror(errno));
|
||||
elog(ERROR, "Cannot read directory \"%s\": %s", path, strerror(errno));
|
||||
|
||||
fio_closedir(dir);
|
||||
|
||||
|
@@ -92,7 +92,7 @@ fetchFile(PGconn *conn, const char *filename, size_t *filesize)
|
||||
|
||||
/* sanity check the result set */
|
||||
if (PQntuples(res) != 1 || PQgetisnull(res, 0, 0))
|
||||
elog(ERROR, "unexpected result set while fetching remote file \"%s\"",
|
||||
elog(ERROR, "Unexpected result set while fetching remote file \"%s\"",
|
||||
filename);
|
||||
|
||||
/* Read result to local variables */
|
||||
|
13
src/init.c
13
src/init.c
@@ -24,11 +24,11 @@ do_init(CatalogState *catalogState)
|
||||
results = pg_check_dir(catalogState->catalog_path);
|
||||
|
||||
if (results == 4) /* exists and not empty*/
|
||||
elog(ERROR, "backup catalog already exist and it's not empty");
|
||||
elog(ERROR, "The backup catalog already exists and is not empty");
|
||||
else if (results == -1) /*trouble accessing directory*/
|
||||
{
|
||||
int errno_tmp = errno;
|
||||
elog(ERROR, "cannot open backup catalog directory \"%s\": %s",
|
||||
elog(ERROR, "Cannot open backup catalog directory \"%s\": %s",
|
||||
catalogState->catalog_path, strerror(errno_tmp));
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ do_init(CatalogState *catalogState)
|
||||
/* create backup catalog wal directory */
|
||||
dir_create_dir(catalogState->wal_subdir_path, DIR_PERMISSION, false);
|
||||
|
||||
elog(INFO, "Backup catalog '%s' successfully inited", catalogState->catalog_path);
|
||||
elog(INFO, "Backup catalog '%s' successfully initialized", catalogState->catalog_path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -53,8 +53,9 @@ do_add_instance(InstanceState *instanceState, InstanceConfig *instance)
|
||||
|
||||
/* PGDATA is always required */
|
||||
if (instance->pgdata == NULL)
|
||||
elog(ERROR, "Required parameter not specified: PGDATA "
|
||||
"(-D, --pgdata)");
|
||||
elog(ERROR, "No postgres data directory specified.\n"
|
||||
"Please specify it either using environment variable PGDATA or\n"
|
||||
"command line option --pgdata (-D)");
|
||||
|
||||
/* Read system_identifier from PGDATA */
|
||||
instance->system_identifier = get_system_identifier(instance->pgdata, FIO_DB_HOST, false);
|
||||
@@ -121,6 +122,6 @@ do_add_instance(InstanceState *instanceState, InstanceConfig *instance)
|
||||
/* pgdata was set through command line */
|
||||
do_set_config(instanceState, true);
|
||||
|
||||
elog(INFO, "Instance '%s' successfully inited", instanceState->instance_name);
|
||||
elog(INFO, "Instance '%s' successfully initialized", instanceState->instance_name);
|
||||
return 0;
|
||||
}
|
||||
|
@@ -79,10 +79,10 @@ do_merge(InstanceState *instanceState, time_t backup_id, bool no_validate, bool
|
||||
int i;
|
||||
|
||||
if (backup_id == INVALID_BACKUP_ID)
|
||||
elog(ERROR, "required parameter is not specified: --backup-id");
|
||||
elog(ERROR, "Required parameter is not specified: --backup-id");
|
||||
|
||||
if (instanceState == NULL)
|
||||
elog(ERROR, "required parameter is not specified: --instance");
|
||||
elog(ERROR, "Required parameter is not specified: --instance");
|
||||
|
||||
elog(INFO, "Merge started");
|
||||
|
||||
|
@@ -491,7 +491,10 @@ main(int argc, char *argv[])
|
||||
backup_subcmd != HELP_CMD &&
|
||||
backup_subcmd != VERSION_CMD &&
|
||||
backup_subcmd != CATCHUP_CMD)
|
||||
elog(ERROR, "required parameter not specified: BACKUP_PATH (-B, --backup-path)");
|
||||
elog(ERROR,
|
||||
"No backup catalog path specified.\n"
|
||||
"Please specify it either using environment variable BACKUP_PATH or\n"
|
||||
"command line option --backup-path (-B)");
|
||||
|
||||
/* ===== catalogState (END) ======*/
|
||||
|
||||
@@ -505,7 +508,7 @@ main(int argc, char *argv[])
|
||||
{
|
||||
if (backup_subcmd != INIT_CMD && backup_subcmd != SHOW_CMD &&
|
||||
backup_subcmd != VALIDATE_CMD && backup_subcmd != CHECKDB_CMD && backup_subcmd != CATCHUP_CMD)
|
||||
elog(ERROR, "required parameter not specified: --instance");
|
||||
elog(ERROR, "Required parameter not specified: --instance");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -618,7 +621,7 @@ main(int argc, char *argv[])
|
||||
backup_path != NULL &&
|
||||
instance_name == NULL &&
|
||||
instance_config.pgdata == NULL)
|
||||
elog(ERROR, "required parameter not specified: --instance");
|
||||
elog(ERROR, "Required parameter not specified: --instance");
|
||||
|
||||
/* Check checkdb command options consistency */
|
||||
if (backup_subcmd == CHECKDB_CMD &&
|
||||
@@ -831,14 +834,16 @@ main(int argc, char *argv[])
|
||||
if (catchup_destination_pgdata == NULL)
|
||||
elog(ERROR, "You must specify \"--destination-pgdata\" option with the \"%s\" command", get_subcmd_name(backup_subcmd));
|
||||
if (current.backup_mode == BACKUP_MODE_INVALID)
|
||||
elog(ERROR, "Required parameter not specified: BACKUP_MODE (-b, --backup-mode)");
|
||||
elog(ERROR, "No backup mode specified.\n"
|
||||
"Please specify it either using environment variable BACKUP_MODE or\n"
|
||||
"command line option --backup-mode (-b)");
|
||||
if (current.backup_mode != BACKUP_MODE_FULL && current.backup_mode != BACKUP_MODE_DIFF_PTRACK && current.backup_mode != BACKUP_MODE_DIFF_DELTA)
|
||||
elog(ERROR, "Only \"FULL\", \"PTRACK\" and \"DELTA\" modes are supported with the \"%s\" command", get_subcmd_name(backup_subcmd));
|
||||
if (!stream_wal)
|
||||
elog(INFO, "--stream is required, forcing stream mode");
|
||||
current.stream = stream_wal = true;
|
||||
if (instance_config.external_dir_str)
|
||||
elog(ERROR, "external directories not supported fom \"%s\" command", get_subcmd_name(backup_subcmd));
|
||||
elog(ERROR, "External directories not supported fom \"%s\" command", get_subcmd_name(backup_subcmd));
|
||||
// TODO check instance_config.conn_opt
|
||||
}
|
||||
|
||||
@@ -985,8 +990,9 @@ main(int argc, char *argv[])
|
||||
|
||||
/* sanity */
|
||||
if (current.backup_mode == BACKUP_MODE_INVALID)
|
||||
elog(ERROR, "required parameter not specified: BACKUP_MODE "
|
||||
"(-b, --backup-mode)");
|
||||
elog(ERROR, "No backup mode specified.\n"
|
||||
"Please specify it either using environment variable BACKUP_MODE or\n"
|
||||
"command line option --backup-mode (-b)");
|
||||
|
||||
return do_backup(instanceState, set_backup_params,
|
||||
no_validate, no_sync, backup_logs, start_time);
|
||||
|
@@ -214,7 +214,7 @@ pg_ptrack_get_pagemapset(PGconn *backup_conn, const char *ptrack_schema,
|
||||
pfree(params[0]);
|
||||
|
||||
if (PQnfields(res) != 2)
|
||||
elog(ERROR, "cannot get ptrack pagemapset");
|
||||
elog(ERROR, "Cannot get ptrack pagemapset");
|
||||
|
||||
/* sanity ? */
|
||||
|
||||
|
@@ -131,13 +131,14 @@ do_restore_or_validate(InstanceState *instanceState, time_t target_backup_id, pg
|
||||
XLogRecPtr shift_lsn = InvalidXLogRecPtr;
|
||||
|
||||
if (instanceState == NULL)
|
||||
elog(ERROR, "required parameter not specified: --instance");
|
||||
elog(ERROR, "Required parameter not specified: --instance");
|
||||
|
||||
if (params->is_restore)
|
||||
{
|
||||
if (instance_config.pgdata == NULL)
|
||||
elog(ERROR,
|
||||
"required parameter not specified: PGDATA (-D, --pgdata)");
|
||||
elog(ERROR, "No postgres data directory specified.\n"
|
||||
"Please specify it either using environment variable PGDATA or\n"
|
||||
"command line option --pgdata (-D)");
|
||||
|
||||
/* Check if restore destination empty */
|
||||
if (!dir_is_empty(instance_config.pgdata, FIO_DB_HOST))
|
||||
@@ -290,7 +291,7 @@ do_restore_or_validate(InstanceState *instanceState, time_t target_backup_id, pg
|
||||
if (!satisfy_timeline(timelines, current_backup->tli, current_backup->stop_lsn))
|
||||
{
|
||||
if (target_backup_id != INVALID_BACKUP_ID)
|
||||
elog(ERROR, "target backup %s does not satisfy target timeline",
|
||||
elog(ERROR, "Target backup %s does not satisfy target timeline",
|
||||
base36enc(target_backup_id));
|
||||
else
|
||||
/* Try to find another backup that satisfies target timeline */
|
||||
@@ -776,7 +777,7 @@ restore_chain(pgBackup *dest_backup, parray *parent_chain,
|
||||
use_bitmap = false;
|
||||
|
||||
if (params->incremental_mode != INCR_NONE)
|
||||
elog(ERROR, "incremental restore is not possible for backups older than 2.3.0 version");
|
||||
elog(ERROR, "Incremental restore is not possible for backups older than 2.3.0 version");
|
||||
}
|
||||
|
||||
/* There is no point in bitmap restore, when restoring a single FULL backup,
|
||||
@@ -1479,7 +1480,7 @@ update_recovery_options_before_v12(InstanceState *instanceState, pgBackup *backu
|
||||
|
||||
fp = fio_fopen(path, "w", FIO_DB_HOST);
|
||||
if (fp == NULL)
|
||||
elog(ERROR, "cannot open file \"%s\": %s", path,
|
||||
elog(ERROR, "Cannot open file \"%s\": %s", path,
|
||||
strerror(errno));
|
||||
|
||||
if (fio_chmod(path, FILE_PERMISSION, FIO_DB_HOST) == -1)
|
||||
@@ -1499,7 +1500,7 @@ update_recovery_options_before_v12(InstanceState *instanceState, pgBackup *backu
|
||||
|
||||
if (fio_fflush(fp) != 0 ||
|
||||
fio_fclose(fp))
|
||||
elog(ERROR, "cannot write file \"%s\": %s", path,
|
||||
elog(ERROR, "Cannot write file \"%s\": %s", path,
|
||||
strerror(errno));
|
||||
}
|
||||
#endif
|
||||
@@ -1538,7 +1539,7 @@ update_recovery_options(InstanceState *instanceState, pgBackup *backup,
|
||||
{
|
||||
/* file not found is not an error case */
|
||||
if (errno != ENOENT)
|
||||
elog(ERROR, "cannot stat file \"%s\": %s", postgres_auto_path,
|
||||
elog(ERROR, "Cannot stat file \"%s\": %s", postgres_auto_path,
|
||||
strerror(errno));
|
||||
st.st_size = 0;
|
||||
}
|
||||
@@ -1548,13 +1549,13 @@ update_recovery_options(InstanceState *instanceState, pgBackup *backup,
|
||||
{
|
||||
fp = fio_open_stream(postgres_auto_path, FIO_DB_HOST);
|
||||
if (fp == NULL)
|
||||
elog(ERROR, "cannot open \"%s\": %s", postgres_auto_path, strerror(errno));
|
||||
elog(ERROR, "Cannot open \"%s\": %s", postgres_auto_path, strerror(errno));
|
||||
}
|
||||
|
||||
sprintf(postgres_auto_path_tmp, "%s.tmp", postgres_auto_path);
|
||||
fp_tmp = fio_fopen(postgres_auto_path_tmp, "w", FIO_DB_HOST);
|
||||
if (fp_tmp == NULL)
|
||||
elog(ERROR, "cannot open \"%s\": %s", postgres_auto_path_tmp, strerror(errno));
|
||||
elog(ERROR, "Cannot open \"%s\": %s", postgres_auto_path_tmp, strerror(errno));
|
||||
|
||||
while (fp && fgets(line, lengthof(line), fp))
|
||||
{
|
||||
@@ -1612,7 +1613,7 @@ update_recovery_options(InstanceState *instanceState, pgBackup *backup,
|
||||
{
|
||||
fp = fio_fopen(postgres_auto_path, "a", FIO_DB_HOST);
|
||||
if (fp == NULL)
|
||||
elog(ERROR, "cannot open file \"%s\": %s", postgres_auto_path,
|
||||
elog(ERROR, "Cannot open file \"%s\": %s", postgres_auto_path,
|
||||
strerror(errno));
|
||||
|
||||
fio_fprintf(fp, "\n# recovery settings added by pg_probackup restore of backup %s at '%s'\n",
|
||||
@@ -1626,7 +1627,7 @@ update_recovery_options(InstanceState *instanceState, pgBackup *backup,
|
||||
|
||||
if (fio_fflush(fp) != 0 ||
|
||||
fio_fclose(fp))
|
||||
elog(ERROR, "cannot write file \"%s\": %s", postgres_auto_path,
|
||||
elog(ERROR, "Cannot write file \"%s\": %s", postgres_auto_path,
|
||||
strerror(errno));
|
||||
|
||||
/*
|
||||
@@ -1646,12 +1647,12 @@ update_recovery_options(InstanceState *instanceState, pgBackup *backup,
|
||||
|
||||
fp = fio_fopen(path, PG_BINARY_W, FIO_DB_HOST);
|
||||
if (fp == NULL)
|
||||
elog(ERROR, "cannot open file \"%s\": %s", path,
|
||||
elog(ERROR, "Cannot open file \"%s\": %s", path,
|
||||
strerror(errno));
|
||||
|
||||
if (fio_fflush(fp) != 0 ||
|
||||
fio_fclose(fp))
|
||||
elog(ERROR, "cannot write file \"%s\": %s", path,
|
||||
elog(ERROR, "Cannot write file \"%s\": %s", path,
|
||||
strerror(errno));
|
||||
}
|
||||
|
||||
@@ -1662,12 +1663,12 @@ update_recovery_options(InstanceState *instanceState, pgBackup *backup,
|
||||
|
||||
fp = fio_fopen(path, PG_BINARY_W, FIO_DB_HOST);
|
||||
if (fp == NULL)
|
||||
elog(ERROR, "cannot open file \"%s\": %s", path,
|
||||
elog(ERROR, "Cannot open file \"%s\": %s", path,
|
||||
strerror(errno));
|
||||
|
||||
if (fio_fflush(fp) != 0 ||
|
||||
fio_fclose(fp))
|
||||
elog(ERROR, "cannot write file \"%s\": %s", path,
|
||||
elog(ERROR, "Cannot write file \"%s\": %s", path,
|
||||
strerror(errno));
|
||||
}
|
||||
}
|
||||
@@ -1704,12 +1705,12 @@ read_timeline_history(const char *arclog_path, TimeLineID targetTLI, bool strict
|
||||
if (fd == NULL)
|
||||
{
|
||||
if (errno != ENOENT)
|
||||
elog(ERROR, "could not open file \"%s\": %s", path,
|
||||
elog(ERROR, "Could not open file \"%s\": %s", path,
|
||||
strerror(errno));
|
||||
|
||||
/* There is no history file for target timeline */
|
||||
if (strict)
|
||||
elog(ERROR, "recovery target timeline %u does not exist",
|
||||
elog(ERROR, "Recovery target timeline %u does not exist",
|
||||
targetTLI);
|
||||
else
|
||||
return NULL;
|
||||
@@ -1743,12 +1744,12 @@ read_timeline_history(const char *arclog_path, TimeLineID targetTLI, bool strict
|
||||
{
|
||||
/* expect a numeric timeline ID as first field of line */
|
||||
elog(ERROR,
|
||||
"syntax error in history file: %s. Expected a numeric timeline ID.",
|
||||
"Syntax error in history file: %s. Expected a numeric timeline ID.",
|
||||
fline);
|
||||
}
|
||||
if (nfields != 3)
|
||||
elog(ERROR,
|
||||
"syntax error in history file: %s. Expected a transaction log switchpoint location.",
|
||||
"Syntax error in history file: %s. Expected a transaction log switchpoint location.",
|
||||
fline);
|
||||
|
||||
if (last_timeline && tli <= last_timeline->tli)
|
||||
|
@@ -74,7 +74,7 @@ checkControlFile(ControlFileData *ControlFile)
|
||||
|
||||
if ((ControlFile->pg_control_version % 65536 == 0 || ControlFile->pg_control_version % 65536 > 10000) &&
|
||||
ControlFile->pg_control_version / 65536 != 0)
|
||||
elog(ERROR, "possible byte ordering mismatch\n"
|
||||
elog(ERROR, "Possible byte ordering mismatch\n"
|
||||
"The byte ordering used to store the pg_control file might not match the one\n"
|
||||
"used by this program. In that case the results below would be incorrect, and\n"
|
||||
"the PostgreSQL installation would be incompatible with this data directory.");
|
||||
@@ -93,7 +93,7 @@ digestControlFile(ControlFileData *ControlFile, char *src, size_t size)
|
||||
#endif
|
||||
|
||||
if (size != ControlFileSize)
|
||||
elog(ERROR, "unexpected control file size %d, expected %d",
|
||||
elog(ERROR, "Unexpected control file size %d, expected %d",
|
||||
(int) size, ControlFileSize);
|
||||
|
||||
memcpy(ControlFile, src, sizeof(ControlFileData));
|
||||
|
@@ -521,11 +521,17 @@ config_get_opt(int argc, char **argv, ConfigOption cmd_options[],
|
||||
|
||||
optstring = longopts_to_optstring(longopts, cmd_len + len);
|
||||
|
||||
opterr = 0;
|
||||
/* Assign named options */
|
||||
while ((c = getopt_long(argc, argv, optstring, longopts, &optindex)) != -1)
|
||||
{
|
||||
ConfigOption *opt;
|
||||
|
||||
if (c == '?')
|
||||
{
|
||||
elog(ERROR, "Option '%s' requires an argument. Try \"%s --help\" for more information.",
|
||||
argv[optind-1], PROGRAM_NAME);
|
||||
}
|
||||
opt = option_find(c, cmd_options);
|
||||
if (opt == NULL)
|
||||
opt = option_find(c, options);
|
||||
@@ -1439,16 +1445,16 @@ parse_lsn(const char *value, XLogRecPtr *result)
|
||||
|
||||
len1 = strspn(value, "0123456789abcdefABCDEF");
|
||||
if (len1 < 1 || len1 > MAXPG_LSNCOMPONENT || value[len1] != '/')
|
||||
elog(ERROR, "invalid LSN \"%s\"", value);
|
||||
elog(ERROR, "Invalid LSN \"%s\"", value);
|
||||
len2 = strspn(value + len1 + 1, "0123456789abcdefABCDEF");
|
||||
if (len2 < 1 || len2 > MAXPG_LSNCOMPONENT || value[len1 + 1 + len2] != '\0')
|
||||
elog(ERROR, "invalid LSN \"%s\"", value);
|
||||
elog(ERROR, "Invalid LSN \"%s\"", value);
|
||||
|
||||
if (sscanf(value, "%X/%X", &xlogid, &xrecoff) == 2)
|
||||
*result = (XLogRecPtr) ((uint64) xlogid << 32) | xrecoff;
|
||||
else
|
||||
{
|
||||
elog(ERROR, "invalid LSN \"%s\"", value);
|
||||
elog(ERROR, "Invalid LSN \"%s\"", value);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -394,7 +394,7 @@ do_validate_all(CatalogState *catalogState, InstanceState *instanceState)
|
||||
/* open directory and list contents */
|
||||
dir = opendir(catalogState->backup_subdir_path);
|
||||
if (dir == NULL)
|
||||
elog(ERROR, "cannot open directory \"%s\": %s", catalogState->backup_subdir_path, strerror(errno));
|
||||
elog(ERROR, "Cannot open directory \"%s\": %s", catalogState->backup_subdir_path, strerror(errno));
|
||||
|
||||
errno = 0;
|
||||
while ((dent = readdir(dir)))
|
||||
@@ -412,7 +412,7 @@ do_validate_all(CatalogState *catalogState, InstanceState *instanceState)
|
||||
join_path_components(child, catalogState->backup_subdir_path, dent->d_name);
|
||||
|
||||
if (lstat(child, &st) == -1)
|
||||
elog(ERROR, "cannot stat file \"%s\": %s", child, strerror(errno));
|
||||
elog(ERROR, "Cannot stat file \"%s\": %s", child, strerror(errno));
|
||||
|
||||
if (!S_ISDIR(st.st_mode))
|
||||
continue;
|
||||
|
@@ -117,13 +117,13 @@ class SimpleAuthTest(ProbackupTest, unittest.TestCase):
|
||||
except ProbackupException as e:
|
||||
if self.get_version(node) < 150000:
|
||||
self.assertIn(
|
||||
"ERROR: query failed: ERROR: permission denied "
|
||||
"ERROR: Query failed: ERROR: permission denied "
|
||||
"for function pg_stop_backup", e.message,
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
repr(e.message), self.cmd))
|
||||
else:
|
||||
self.assertIn(
|
||||
"ERROR: query failed: ERROR: permission denied "
|
||||
"ERROR: Query failed: ERROR: permission denied "
|
||||
"for function pg_backup_stop", e.message,
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
repr(e.message), self.cmd))
|
||||
|
@@ -2926,9 +2926,9 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
gdb.output)
|
||||
|
||||
self.assertIn(
|
||||
'WARNING: backup in progress, stop backup',
|
||||
'WARNING: A backup is in progress, stopping it',
|
||||
gdb.output)
|
||||
|
||||
|
||||
# TODO: check the same for PAGE backup
|
||||
|
||||
# @unittest.skip("skip")
|
||||
@@ -3316,7 +3316,7 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
log_content = f.read()
|
||||
#print(log_content)
|
||||
self.assertIn(
|
||||
'WARNING: backup in progress, stop backup',
|
||||
'WARNING: A backup is in progress, stopping it.',
|
||||
log_content)
|
||||
|
||||
if self.get_version(node) < 150000:
|
||||
@@ -3327,7 +3327,7 @@ class BackupTest(ProbackupTest, unittest.TestCase):
|
||||
self.assertIn(
|
||||
'FROM pg_catalog.pg_backup_stop',
|
||||
log_content)
|
||||
|
||||
|
||||
self.assertIn(
|
||||
'setting its status to ERROR',
|
||||
log_content)
|
||||
|
@@ -131,7 +131,7 @@ class CheckdbTest(ProbackupTest, unittest.TestCase):
|
||||
repr(self.output), self.cmd))
|
||||
except ProbackupException as e:
|
||||
self.assertIn(
|
||||
"ERROR: required parameter not specified: --instance",
|
||||
"ERROR: Required parameter not specified: --instance",
|
||||
e.message,
|
||||
"\n Unexpected Error Message: {0}\n CMD: {1}".format(
|
||||
repr(e.message), self.cmd))
|
||||
@@ -397,7 +397,7 @@ class CheckdbTest(ProbackupTest, unittest.TestCase):
|
||||
repr(self.output), self.cmd))
|
||||
except ProbackupException as e:
|
||||
self.assertIn(
|
||||
"ERROR: required parameter not specified: PGDATA (-D, --pgdata)",
|
||||
"ERROR: Required parameter not specified: PGDATA (-D, --pgdata)",
|
||||
e.message,
|
||||
"\n Unexpected Error Message: {0}\n CMD: {1}".format(
|
||||
repr(e.message), self.cmd))
|
||||
|
@@ -443,7 +443,7 @@ class CompressionTest(ProbackupTest, unittest.TestCase):
|
||||
except ProbackupException as e:
|
||||
self.assertEqual(
|
||||
e.message,
|
||||
'ERROR: invalid compress algorithm value "bla-blah"\n',
|
||||
'ERROR: Invalid compress algorithm value "bla-blah"\n',
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
repr(e.message), self.cmd))
|
||||
|
||||
|
@@ -56,7 +56,8 @@ class InitTest(ProbackupTest, unittest.TestCase):
|
||||
repr(self.output), self.cmd))
|
||||
except ProbackupException as e:
|
||||
self.assertIn(
|
||||
"ERROR: Required parameter not specified: PGDATA (-D, --pgdata)",
|
||||
"ERROR: No postgres data directory specified.\n"
|
||||
"Please specify it either using environment variable PGDATA or\ncommand line option --pgdata (-D)",
|
||||
e.message,
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(e.message, self.cmd))
|
||||
|
||||
|
@@ -33,7 +33,9 @@ class OptionTest(ProbackupTest, unittest.TestCase):
|
||||
repr(self.output), self.cmd))
|
||||
except ProbackupException as e:
|
||||
self.assertIn(
|
||||
'ERROR: required parameter not specified: BACKUP_PATH (-B, --backup-path)',
|
||||
'ERROR: No backup catalog path specified.\n' + \
|
||||
'Please specify it either using environment variable BACKUP_PATH or\n' + \
|
||||
'command line option --backup-path (-B)',
|
||||
e.message,
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(repr(e.message), self.cmd))
|
||||
|
||||
@@ -54,7 +56,7 @@ class OptionTest(ProbackupTest, unittest.TestCase):
|
||||
repr(self.output), self.cmd))
|
||||
except ProbackupException as e:
|
||||
self.assertIn(
|
||||
'ERROR: required parameter not specified: --instance',
|
||||
'ERROR: Required parameter not specified: --instance',
|
||||
e.message,
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(repr(e.message), self.cmd))
|
||||
|
||||
@@ -65,7 +67,7 @@ class OptionTest(ProbackupTest, unittest.TestCase):
|
||||
repr(self.output), self.cmd))
|
||||
except ProbackupException as e:
|
||||
self.assertIn(
|
||||
'ERROR: required parameter not specified: BACKUP_MODE (-b, --backup-mode)',
|
||||
'ERROR: No backup mode specified.\nPlease specify it either using environment variable BACKUP_MODE or\ncommand line option --backup-mode (-b)',
|
||||
e.message,
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(repr(e.message), self.cmd))
|
||||
|
||||
@@ -76,7 +78,7 @@ class OptionTest(ProbackupTest, unittest.TestCase):
|
||||
repr(self.output), self.cmd))
|
||||
except ProbackupException as e:
|
||||
self.assertIn(
|
||||
'ERROR: invalid backup-mode "bad"',
|
||||
'ERROR: Invalid backup-mode "bad"',
|
||||
e.message,
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(repr(e.message), self.cmd))
|
||||
|
||||
@@ -102,7 +104,7 @@ class OptionTest(ProbackupTest, unittest.TestCase):
|
||||
repr(self.output), self.cmd))
|
||||
except ProbackupException as e:
|
||||
self.assertIn(
|
||||
"option requires an argument -- 'i'",
|
||||
"Option '-i' requires an argument",
|
||||
e.message,
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(repr(e.message), self.cmd))
|
||||
|
||||
@@ -114,13 +116,8 @@ class OptionTest(ProbackupTest, unittest.TestCase):
|
||||
base_dir=os.path.join(self.module_name, self.fname, 'node'))
|
||||
|
||||
output = self.init_pb(backup_dir)
|
||||
self.assertIn(
|
||||
"INFO: Backup catalog",
|
||||
output)
|
||||
self.assertIn(f"INFO: Backup catalog '{backup_dir}' successfully initialized", output)
|
||||
|
||||
self.assertIn(
|
||||
"successfully inited",
|
||||
output)
|
||||
self.add_instance(backup_dir, 'node', node)
|
||||
|
||||
node.slow_start()
|
||||
|
@@ -2995,7 +2995,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
||||
self.output, self.cmd))
|
||||
except ProbackupException as e:
|
||||
self.assertIn(
|
||||
'ERROR: field "dbOid" is not found in the line 42 of '
|
||||
'ERROR: Field "dbOid" is not found in the line 42 of '
|
||||
'the file backup_content.control', e.message,
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
repr(e.message), self.cmd))
|
||||
@@ -3011,7 +3011,7 @@ class RestoreTest(ProbackupTest, unittest.TestCase):
|
||||
self.output, self.cmd))
|
||||
except ProbackupException as e:
|
||||
self.assertIn(
|
||||
'ERROR: field "dbOid" is not found in the line 42 of '
|
||||
'ERROR: Field "dbOid" is not found in the line 42 of '
|
||||
'the file backup_content.control', e.message,
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
repr(e.message), self.cmd))
|
||||
|
@@ -41,7 +41,7 @@ class SetBackupTest(ProbackupTest, unittest.TestCase):
|
||||
repr(self.output), self.cmd))
|
||||
except ProbackupException as e:
|
||||
self.assertIn(
|
||||
'ERROR: required parameter not specified: --instance',
|
||||
'ERROR: Required parameter not specified: --instance',
|
||||
e.message,
|
||||
"\n Unexpected Error Message: {0}\n CMD: {1}".format(
|
||||
repr(e.message), self.cmd))
|
||||
|
Reference in New Issue
Block a user