mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 16:46:28 +00:00
Remove unused backup functions
Not needed since removal of rsync functionality
This commit is contained in:
100
dbutils.c
100
dbutils.c
@@ -1933,7 +1933,7 @@ drop_replication_slot(PGconn *conn, char *slot_name)
|
|||||||
initPQExpBuffer(&query);
|
initPQExpBuffer(&query);
|
||||||
|
|
||||||
appendPQExpBuffer(&query,
|
appendPQExpBuffer(&query,
|
||||||
"SELECT pg_drop_replication_slot('%s')",
|
"SELECT pg_catalog.pg_drop_replication_slot('%s')",
|
||||||
slot_name);
|
slot_name);
|
||||||
|
|
||||||
log_verbose(LOG_DEBUG, "drop_replication_slot():\n %s", query.data);
|
log_verbose(LOG_DEBUG, "drop_replication_slot():\n %s", query.data);
|
||||||
@@ -2003,101 +2003,3 @@ get_slot_record(PGconn *conn, char *slot_name, t_replication_slot *record)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ================ */
|
|
||||||
/* backup functions */
|
|
||||||
/* ================ */
|
|
||||||
|
|
||||||
// XXX is first_wal_segment actually used anywhere?
|
|
||||||
bool
|
|
||||||
start_backup(PGconn *conn, char *first_wal_segment, bool fast_checkpoint, int server_version_num)
|
|
||||||
{
|
|
||||||
PQExpBufferData query;
|
|
||||||
PGresult *res;
|
|
||||||
|
|
||||||
initPQExpBuffer(&query);
|
|
||||||
|
|
||||||
if (server_version_num >= 100000)
|
|
||||||
{
|
|
||||||
appendPQExpBuffer(&query,
|
|
||||||
"SELECT pg_catalog.pg_walfile_name(pg_catalog.pg_start_backup('repmgr_standby_clone_%ld', %s))",
|
|
||||||
time(NULL),
|
|
||||||
fast_checkpoint ? "TRUE" : "FALSE");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
appendPQExpBuffer(&query,
|
|
||||||
"SELECT pg_catalog.pg_xlogfile_name(pg_catalog.pg_start_backup('repmgr_standby_clone_%ld', %s))",
|
|
||||||
time(NULL),
|
|
||||||
fast_checkpoint ? "TRUE" : "FALSE");
|
|
||||||
}
|
|
||||||
|
|
||||||
log_verbose(LOG_DEBUG, "start_backup():\n %s", query.data);
|
|
||||||
|
|
||||||
res = PQexec(conn, query.data);
|
|
||||||
|
|
||||||
termPQExpBuffer(&query);
|
|
||||||
|
|
||||||
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
|
||||||
{
|
|
||||||
log_error(_("unable to start backup:\n %s"), PQerrorMessage(conn));
|
|
||||||
PQclear(res);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (first_wal_segment != NULL)
|
|
||||||
{
|
|
||||||
char *first_wal_seg_pq = PQgetvalue(res, 0, 0);
|
|
||||||
size_t buf_sz = strlen(first_wal_seg_pq);
|
|
||||||
|
|
||||||
first_wal_segment = pg_malloc0(buf_sz + 1);
|
|
||||||
snprintf(first_wal_segment, buf_sz + 1, "%s", first_wal_seg_pq);
|
|
||||||
}
|
|
||||||
|
|
||||||
PQclear(res);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
stop_backup(PGconn *conn, char *last_wal_segment, int server_version_num)
|
|
||||||
{
|
|
||||||
PQExpBufferData query;
|
|
||||||
PGresult *res;
|
|
||||||
|
|
||||||
initPQExpBuffer(&query);
|
|
||||||
|
|
||||||
if (server_version_num >= 100000)
|
|
||||||
{
|
|
||||||
appendPQExpBuffer(&query,
|
|
||||||
"SELECT pg_catalog.pg_walfile_name(pg_catalog.pg_stop_backup())");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
appendPQExpBuffer(&query,
|
|
||||||
"SELECT pg_catalog.pg_xlogfile_name(pg_catalog.pg_stop_backup())");
|
|
||||||
}
|
|
||||||
|
|
||||||
res = PQexec(conn, query.data);
|
|
||||||
termPQExpBuffer(&query);
|
|
||||||
|
|
||||||
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
|
||||||
{
|
|
||||||
log_error(_("unable to stop backup:\n %s"), PQerrorMessage(conn));
|
|
||||||
PQclear(res);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (last_wal_segment != NULL)
|
|
||||||
{
|
|
||||||
char *last_wal_seg_pq = PQgetvalue(res, 0, 0);
|
|
||||||
size_t buf_sz = strlen(last_wal_seg_pq);
|
|
||||||
|
|
||||||
last_wal_segment = pg_malloc0(buf_sz + 1);
|
|
||||||
snprintf(last_wal_segment, buf_sz + 1, "%s", last_wal_seg_pq);
|
|
||||||
}
|
|
||||||
|
|
||||||
PQclear(res);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -216,9 +216,5 @@ bool create_replication_slot(PGconn *conn, char *slot_name, int server_version_
|
|||||||
bool drop_replication_slot(PGconn *conn, char *slot_name);
|
bool drop_replication_slot(PGconn *conn, char *slot_name);
|
||||||
int get_slot_record(PGconn *conn, char *slot_name, t_replication_slot *record);
|
int get_slot_record(PGconn *conn, char *slot_name, t_replication_slot *record);
|
||||||
|
|
||||||
/* backup functions */
|
|
||||||
bool start_backup(PGconn *conn, char *first_wal_segment, bool fast_checkpoint, int server_version_num);
|
|
||||||
bool stop_backup(PGconn *conn, char *last_wal_segment, int server_version_num);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1726,9 +1726,8 @@ initialise_direct_clone(void)
|
|||||||
PQclear(res);
|
PQclear(res);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If replication slots requested, create appropriate slot on
|
* If replication slots requested, create appropriate slot on the
|
||||||
* the primary; this must be done before pg_start_backup() is
|
* primary; this must be done before pg_basebackup is called.
|
||||||
* issued, either by us or by pg_basebackup.
|
|
||||||
*
|
*
|
||||||
* Replication slots are not supported (and not very useful
|
* Replication slots are not supported (and not very useful
|
||||||
* anyway) in Barman mode.
|
* anyway) in Barman mode.
|
||||||
|
|||||||
Reference in New Issue
Block a user