From 0b2134aba35d4118167f277c137cb5be4790d1d6 Mon Sep 17 00:00:00 2001 From: Nick Stott Date: Wed, 5 Jul 2017 03:56:14 -0400 Subject: [PATCH] truncate the fqdn to 64 chars, or NAMEDATALEN-1 (#470) as described here, https://github.com/postgres/postgres/blob/master/src/backend/replication/slot.c#L164-L210 the slot name should be truncated to 63 chars, getting an error related to a slot_name ``` FATAL: replication slot name "c_formationid4_main_m_1_c_formationid4_main_m_nicksaccount_svc_c" is too long ``` the leader has the following slot names ``` postgres=# select * from pg_replication_slots; slot_name | plugin | slot_type | datoid | database | active | active_pid | xmin | catalog_xmin | restart_ls n | confirmed_flush_lsn -----------------------------------------------------------------+--------+-----------+--------+----------+--------+------------+------+--------------+----------- --+--------------------- c_formationid4_main_m_1_c_formationid4_main_m_nicksaccount_svc_ | | physical | | | f | | | | | c_formationid4_main_m_2_c_formationid4_main_m_nicksaccount_svc_ | | physical | | | f | | | | | (2 rows) ``` --- patroni/postgresql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patroni/postgresql.py b/patroni/postgresql.py index fb3f9b2b..9d31f9d1 100644 --- a/patroni/postgresql.py +++ b/patroni/postgresql.py @@ -56,7 +56,7 @@ def slot_name_from_member_name(member_name): return '_' if c in '-.' else "u{:04d}".format(ord(c)) slot_name = re.sub('[^a-z0-9_]', replace_char, member_name.lower()) - return slot_name[0:64] + return slot_name[0:63] class Postgresql(object):