repmgr: automatically create slot name if missing

It's possible that a node was registered with "use_replication_slots=false"
but that was later changed to "use_replication_slots=true". If the node
was not subsequently re-registered, the node record will contain an empty
slot name, which will cause any slot creation operation during
"standby follow" or "node rejoin" to fail.

To prevent this happening, check for an empty slot name and automatically
set before proceeding.

Addresses GitHub #343.
This commit is contained in:
Ian Barwick
2018-01-11 11:13:41 +09:00
parent 61d46172b9
commit 7ccae6c2b1
5 changed files with 80 additions and 16 deletions

View File

@@ -2729,6 +2729,6 @@ init_node_record(t_node_info *node_record)
if (config_file_options.use_replication_slots == true)
{
maxlen_snprintf(node_record->slot_name, "repmgr_slot_%i", config_file_options.node_id);
create_slot_name(node_record->slot_name, config_file_options.node_id);
}
}