Remove unused backup functions

Not needed since removal of rsync functionality
This commit is contained in:
Ian Barwick
2017-06-13 00:35:01 +09:00
parent f26f1c0428
commit e89c43c5cb
3 changed files with 3 additions and 106 deletions

100
dbutils.c
View File

@@ -1933,7 +1933,7 @@ drop_replication_slot(PGconn *conn, char *slot_name)
initPQExpBuffer(&query);
appendPQExpBuffer(&query,
"SELECT pg_drop_replication_slot('%s')",
"SELECT pg_catalog.pg_drop_replication_slot('%s')",
slot_name);
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;
}

View File

@@ -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);
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

View File

@@ -1726,9 +1726,8 @@ initialise_direct_clone(void)
PQclear(res);
/*
* If replication slots requested, create appropriate slot on
* the primary; this must be done before pg_start_backup() is
* issued, either by us or by pg_basebackup.
* If replication slots requested, create appropriate slot on the
* primary; this must be done before pg_basebackup is called.
*
* Replication slots are not supported (and not very useful
* anyway) in Barman mode.