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

Merge branch 'master' into release_2_5

This commit is contained in:
Grigory Smolkin
2021-06-20 14:54:16 +03:00
8 changed files with 41 additions and 12 deletions

View File

@ -6,7 +6,7 @@
`pg_probackup` is a utility to manage backup and recovery of PostgreSQL database clusters. It is designed to perform periodic backups of the PostgreSQL instance that enable you to restore the server in case of a failure. `pg_probackup` is a utility to manage backup and recovery of PostgreSQL database clusters. It is designed to perform periodic backups of the PostgreSQL instance that enable you to restore the server in case of a failure.
The utility is compatible with: The utility is compatible with:
* PostgreSQL 9.5, 9.6, 10, 11, 12, 13; * PostgreSQL 9.5, 9.6, 10, 11, 12, 13, 14;
As compared to other backup solutions, `pg_probackup` offers the following benefits that can help you implement different backup strategies and deal with large amounts of data: As compared to other backup solutions, `pg_probackup` offers the following benefits that can help you implement different backup strategies and deal with large amounts of data:
* Incremental backup: page-level incremental backup allows you to save disk space, speed up backup and restore. With three different incremental modes, you can plan the backup strategy in accordance with your data flow. * Incremental backup: page-level incremental backup allows you to save disk space, speed up backup and restore. With three different incremental modes, you can plan the backup strategy in accordance with your data flow.
@ -41,9 +41,9 @@ Regardless of the chosen backup type, all backups taken with `pg_probackup` supp
## ptrack support ## ptrack support
`PTRACK` backup support provided via following options: `PTRACK` backup support provided via following options:
* vanilla PostgreSQL 12,13 with [ptrack extension](https://github.com/postgrespro/ptrack) * vanilla PostgreSQL 11, 12, 13, 14 with [ptrack extension](https://github.com/postgrespro/ptrack)
* Postgres Pro Standard 9.6, 10, 11, 12 * Postgres Pro Standard 9.6, 10, 11, 12, 13
* Postgres Pro Enterprise 9.6, 10, 11, 12 * Postgres Pro Enterprise 9.6, 10, 11, 12, 13
## Limitations ## Limitations

View File

@ -699,7 +699,7 @@ pgdata_basic_setup(ConnectionOptions conn_opt, PGNodeInfo *nodeInfo)
elog(WARNING, "Current PostgreSQL role is superuser. " elog(WARNING, "Current PostgreSQL role is superuser. "
"It is not recommended to run backup or checkdb as superuser."); "It is not recommended to run backup or checkdb as superuser.");
StrNCpy(current.server_version, nodeInfo->server_version_str, strlcpy(current.server_version, nodeInfo->server_version_str,
sizeof(current.server_version)); sizeof(current.server_version));
return cur_conn; return cur_conn;
@ -735,7 +735,7 @@ do_backup(InstanceState *instanceState, pgSetBackupParams *set_backup_params,
current.status = BACKUP_STATUS_RUNNING; current.status = BACKUP_STATUS_RUNNING;
current.start_time = current.backup_id; current.start_time = current.backup_id;
StrNCpy(current.program_version, PROGRAM_VERSION, strlcpy(current.program_version, PROGRAM_VERSION,
sizeof(current.program_version)); sizeof(current.program_version));
current.compress_alg = instance_config.compress_alg; current.compress_alg = instance_config.compress_alg;

View File

@ -2761,14 +2761,14 @@ readBackupControlFile(const char *path)
if (program_version) if (program_version)
{ {
StrNCpy(backup->program_version, program_version, strlcpy(backup->program_version, program_version,
sizeof(backup->program_version)); sizeof(backup->program_version));
pfree(program_version); pfree(program_version);
} }
if (server_version) if (server_version)
{ {
StrNCpy(backup->server_version, server_version, strlcpy(backup->server_version, server_version,
sizeof(backup->server_version)); sizeof(backup->server_version));
pfree(server_version); pfree(server_version);
} }

View File

@ -736,7 +736,7 @@ merge_chain(InstanceState *instanceState,
* We cannot set backup status to OK just yet, * We cannot set backup status to OK just yet,
* because it still has old start_time. * because it still has old start_time.
*/ */
StrNCpy(full_backup->program_version, PROGRAM_VERSION, strlcpy(full_backup->program_version, PROGRAM_VERSION,
sizeof(full_backup->program_version)); sizeof(full_backup->program_version));
full_backup->parent_backup = INVALID_BACKUP_ID; full_backup->parent_backup = INVALID_BACKUP_ID;
full_backup->start_lsn = dest_backup->start_lsn; full_backup->start_lsn = dest_backup->start_lsn;

View File

@ -1798,6 +1798,18 @@ extractPageInfo(XLogReaderState *record, XLogReaderData *reader_data,
* source system. * source system.
*/ */
} }
else if (rmid == RM_XACT_ID &&
((rminfo & XLOG_XACT_OPMASK) == XLOG_XACT_COMMIT ||
(rminfo & XLOG_XACT_OPMASK) == XLOG_XACT_COMMIT_PREPARED ||
(rminfo & XLOG_XACT_OPMASK) == XLOG_XACT_ABORT ||
(rminfo & XLOG_XACT_OPMASK) == XLOG_XACT_ABORT_PREPARED))
{
/*
* These records can include "dropped rels". We can safely ignore
* them, we will see that they are missing and copy them from the
* source.
*/
}
else if (info & XLR_SPECIAL_REL_UPDATE) else if (info & XLR_SPECIAL_REL_UPDATE)
{ {
/* /*

View File

@ -551,7 +551,7 @@ show_instance_plain(const char *instance_name, parray *backup_list, bool show_na
time2iso(row->recovery_time, lengthof(row->recovery_time), time2iso(row->recovery_time, lengthof(row->recovery_time),
backup->recovery_time, false); backup->recovery_time, false);
else else
StrNCpy(row->recovery_time, "----", sizeof(row->recovery_time)); strlcpy(row->recovery_time, "----", sizeof(row->recovery_time));
widths[cur] = Max(widths[cur], strlen(row->recovery_time)); widths[cur] = Max(widths[cur], strlen(row->recovery_time));
cur++; cur++;
@ -586,7 +586,7 @@ show_instance_plain(const char *instance_name, parray *backup_list, bool show_na
pretty_time_interval(difftime(backup->end_time, backup->start_time), pretty_time_interval(difftime(backup->end_time, backup->start_time),
row->duration, lengthof(row->duration)); row->duration, lengthof(row->duration));
else else
StrNCpy(row->duration, "----", sizeof(row->duration)); strlcpy(row->duration, "----", sizeof(row->duration));
widths[cur] = Max(widths[cur], strlen(row->duration)); widths[cur] = Max(widths[cur], strlen(row->duration));
cur++; cur++;

View File

@ -16,6 +16,10 @@
#include "libpq/pqsignal.h" #include "libpq/pqsignal.h"
#include "pqexpbuffer.h" #include "pqexpbuffer.h"
#if PG_VERSION_NUM >= 140000
#include "common/string.h"
#endif
#include <time.h> #include <time.h>
#include "pgut.h" #include "pgut.h"
@ -75,7 +79,16 @@ prompt_for_password(const char *username)
password = NULL; password = NULL;
} }
#if PG_VERSION_NUM >= 100000 #if PG_VERSION_NUM >= 140000
if (username == NULL)
password = simple_prompt("Password: ", false);
else
{
char message[256];
snprintf(message, lengthof(message), "Password for user %s: ", username);
password = simple_prompt(message , false);
}
#elif PG_VERSION_NUM >= 100000
password = (char *) pgut_malloc(sizeof(char) * 100 + 1); password = (char *) pgut_malloc(sizeof(char) * 100 + 1);
if (username == NULL) if (username == NULL)
simple_prompt("Password: ", password, 100, false); simple_prompt("Password: ", password, 100, false);

View File

@ -139,6 +139,10 @@ def slow_start(self, replica=False):
except testgres.QueryException as e: except testgres.QueryException as e:
if 'database system is starting up' in e.message: if 'database system is starting up' in e.message:
pass pass
elif 'FATAL: the database system is not accepting connections' in e.message:
pass
elif replica and 'Hot standby mode is disabled' in e.message:
raise e
else: else:
raise e raise e