mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2024-11-28 09:33:54 +02:00
[Issue #400] PostgreSQL 14 support
This commit is contained in:
parent
e68132d10c
commit
e27a6a91e0
@ -725,7 +725,7 @@ pgdata_basic_setup(ConnectionOptions conn_opt, PGNodeInfo *nodeInfo)
|
||||
elog(WARNING, "Current PostgreSQL role is 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));
|
||||
|
||||
return cur_conn;
|
||||
@ -761,7 +761,7 @@ do_backup(pgSetBackupParams *set_backup_params,
|
||||
current.status = BACKUP_STATUS_RUNNING;
|
||||
current.start_time = current.backup_id;
|
||||
|
||||
StrNCpy(current.program_version, PROGRAM_VERSION,
|
||||
strlcpy(current.program_version, PROGRAM_VERSION,
|
||||
sizeof(current.program_version));
|
||||
|
||||
current.compress_alg = instance_config.compress_alg;
|
||||
|
@ -2648,14 +2648,14 @@ readBackupControlFile(const char *path)
|
||||
|
||||
if (program_version)
|
||||
{
|
||||
StrNCpy(backup->program_version, program_version,
|
||||
strlcpy(backup->program_version, program_version,
|
||||
sizeof(backup->program_version));
|
||||
pfree(program_version);
|
||||
}
|
||||
|
||||
if (server_version)
|
||||
{
|
||||
StrNCpy(backup->server_version, server_version,
|
||||
strlcpy(backup->server_version, server_version,
|
||||
sizeof(backup->server_version));
|
||||
pfree(server_version);
|
||||
}
|
||||
|
@ -735,7 +735,7 @@ merge_chain(parray *parent_chain, pgBackup *full_backup, pgBackup *dest_backup,
|
||||
* We cannot set backup status to OK just yet,
|
||||
* 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));
|
||||
full_backup->parent_backup = INVALID_BACKUP_ID;
|
||||
full_backup->start_lsn = dest_backup->start_lsn;
|
||||
|
@ -1798,6 +1798,18 @@ extractPageInfo(XLogReaderState *record, XLogReaderData *reader_data,
|
||||
* 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)
|
||||
{
|
||||
/*
|
||||
|
@ -552,7 +552,7 @@ show_instance_plain(const char *instance_name, parray *backup_list, bool show_na
|
||||
time2iso(row->recovery_time, lengthof(row->recovery_time),
|
||||
backup->recovery_time, false);
|
||||
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));
|
||||
cur++;
|
||||
|
||||
@ -587,7 +587,7 @@ show_instance_plain(const char *instance_name, parray *backup_list, bool show_na
|
||||
pretty_time_interval(difftime(backup->end_time, backup->start_time),
|
||||
row->duration, lengthof(row->duration));
|
||||
else
|
||||
StrNCpy(row->duration, "----", sizeof(row->duration));
|
||||
strlcpy(row->duration, "----", sizeof(row->duration));
|
||||
widths[cur] = Max(widths[cur], strlen(row->duration));
|
||||
cur++;
|
||||
|
||||
|
@ -16,6 +16,10 @@
|
||||
#include "libpq/pqsignal.h"
|
||||
#include "pqexpbuffer.h"
|
||||
|
||||
#if PG_VERSION_NUM >= 140000
|
||||
#include "common/string.h"
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "pgut.h"
|
||||
@ -75,7 +79,16 @@ prompt_for_password(const char *username)
|
||||
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);
|
||||
if (username == NULL)
|
||||
simple_prompt("Password: ", password, 100, false);
|
||||
|
@ -139,6 +139,10 @@ def slow_start(self, replica=False):
|
||||
except testgres.QueryException as e:
|
||||
if 'database system is starting up' in e.message:
|
||||
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:
|
||||
raise e
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user