From e6af18f0bb8818e01719e97b07417f39ab8f79c3 Mon Sep 17 00:00:00 2001 From: Alexander Kukushkin Date: Thu, 24 Mar 2016 14:45:21 +0100 Subject: [PATCH] Former leader was not able to reattach to cluster without pg_rewind It was shutdown correctly and I expected such 'join' working, but it was not, because new leader didn't had enough time to catch up with the master before promote. --- features/patroni_api.feature | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/features/patroni_api.feature b/features/patroni_api.feature index b1eded96..3c408dfc 100644 --- a/features/patroni_api.feature +++ b/features/patroni_api.feature @@ -29,20 +29,23 @@ Scenario: check API requests for the primary-replica pair And I receive a response role replica When I issue an empty POST request to http://127.0.0.1:8009/reinitialize Then I receive a response code 200 - Given replication works from postgres0 to postgres1 after 10 seconds When I issue an empty POST request to http://127.0.0.1:8008/restart Then I receive a response code 200 And postgres0 is a leader after 5 seconds + When I sleep for 10 seconds + Then postgres1 role is the secondary after 15 seconds Scenario: check the failover via the API Given I issue a POST request to http://127.0.0.1:8008/failover with leader=postgres0,candidate=postgres1 Then I receive a response code 200 And postgres1 is a leader after 5 seconds + And postgres1 role is the primary after 5 seconds + And postgres0 role is the secondary after 5 seconds And replication works from postgres1 to postgres0 after 15 seconds Scenario: check the scheduled failover Given I issue a scheduled failover at http://127.0.0.1:8009 from postgres1 to postgres0 in 10 seconds Then I receive a response code 200 - And postgres0 is a leader after 15 seconds + And postgres0 is a leader after 20 seconds And replication works from postgres0 to postgres1 after 25 seconds