standby clone: check upstream connections after data copy operation

With long-running copy operations, it's possible the connection(s) to
the primary/source server may go away for some reason, so recheck
their availability before attempting to reuse.
This commit is contained in:
Ian Barwick
2019-02-26 14:33:54 +09:00
parent 897e3bee14
commit 0578053875
5 changed files with 44 additions and 1 deletions

View File

@@ -605,7 +605,6 @@ do_standby_clone(void)
log_error(_("unknown clone mode"));
}
/* If the backup failed then exit */
if (r != SUCCESS)
{
@@ -5794,6 +5793,12 @@ run_basebackup(t_node_info *node_record)
if (r != 0)
return ERR_BAD_BASEBACKUP;
/* check connections are still available */
(void)connection_ping_reconnect(primary_conn);
if (source_conn != primary_conn)
(void)connection_ping_reconnect(source_conn);
/*
* If replication slots in use, check the created slot is on the correct
* node; the slot will initially get created on the source node, and will
@@ -6396,6 +6401,15 @@ stop_backup:
RecordStatus record_status = RECORD_NOT_FOUND;
PGconn *upstream_conn = NULL;
/* check connections are still available */
(void)connection_ping_reconnect(primary_conn);
if (source_conn != primary_conn)
(void)connection_ping_reconnect(source_conn);
(void)connection_ping_reconnect(source_conn);
record_status = get_node_record(source_conn, upstream_node_id, &upstream_node_record);
if (record_status != RECORD_FOUND)