Alexander Kukushkin
b54119b918
Run is_healthiest_node against last know healthy configuration of cluster
...
This will help to survive when everything was wiped from configuration
store.
2015-07-15 11:20:25 +02:00
Alexander Kukushkin
7445590546
Keep node name in AbstractDCS class
...
It eliminates need to pass this name into most of the methods
2015-07-07 12:26:52 +02:00
Alexander Kukushkin
ae689a2f83
Rename ha.etcd into ha.dcs
2015-07-02 15:33:21 +02:00
Alexander Kukushkin
cc71906009
Inherit Etcd from abstract class
2015-07-02 15:15:07 +02:00
Alexander Kukushkin
9732106e5d
BUGFIX: keep list of replication slots on slaves empty
...
Otherwise slaves accumulate wal files...
2015-06-25 14:01:06 +02:00
Alexander Kukushkin
b7c73fdba8
Rename hostname to name in a Member
2015-06-23 14:07:00 +02:00
Alexander Kukushkin
261fbf2721
Replace logging with logger in ha.py
2015-06-09 10:27:09 +02:00
Alexander Kukushkin
adcc7ac256
Try to avoid "double" promotion.
...
Also check presence of trigger_file on master after promotion when
pg_is_in_recovery() = false and if it is there - remove it.
Plus check presence of trigger_file on a new slave (after running
pg_basebackup) and if it is there - also remove it.
2015-06-01 13:48:44 +02:00
Alexander Kukushkin
b85262637d
Bugfix: do not create replication slot for master
2015-06-01 09:20:24 +02:00
Alexander Kukushkin
8dd99170bf
Refactor exceptions handling in etcd.py and ha.py
...
update_leader can throw EtcdError exception
unused HealthiestMemberError exception is removed
2015-05-24 15:40:36 +02:00
Alexander Kukushkin
ce267d9f1e
query method will retry only in case of communication error
2015-05-24 09:01:23 +02:00
Alexander Kukushkin
34f9b666cf
Demote master when etcd is not accessible
2015-05-22 12:26:19 +02:00
Alexander Kukushkin
bb884bac00
Move is_unlocked method from Ha into Cluster class
2015-05-22 11:45:09 +02:00
Alexander Kukushkin
b24fb0488c
last_leader_operation is the propery of Cluster object and the value is set in get_cluster method
2015-05-18 13:33:27 +02:00
Alexander Kukushkin
0c040b8ce2
Merge branch 'master' of github.com:compose/governor
...
Conflicts:
governor.py
helpers/etcd.py
helpers/ha.py
helpers/postgresql.py
2015-05-13 18:01:01 +02:00
Alexander Kukushkin
d25ad17c32
Add support of python3
2015-05-13 14:53:23 +02:00
Christopher Winslett
2c69074652
move stale protection from is_healthy to is_healthiest to allow stale secondaries to rejoin cluster
2015-05-12 18:29:54 -07:00
Christopher Winslett
557bad37cd
ensure a stale Postgres does not become leader
2015-05-12 18:11:12 -07:00
Alexander Kukushkin
281b0b8455
Bugfix in has_lock: sometimes leader can be undefined
2015-05-12 11:07:52 +02:00
Alexander Kukushkin
9dcbc75fd2
Bugfix. It wasn't possible to start the old cluster if all its members were shutdown.
...
Basically this is rollback to the original decision tree with the small exception:
1 - If leader is defined and it's not me - then slave would be started immidiately
with the correct recovery conf.
2 - If leader is defined in and it's my host, then it will start instance in
readonly (but without primary_conninfo in recovery.conf)
3 - And the third case - if the leader is not defined - it also will start
instance in readonly, without primary_conninfo.
After performing 2 or 3 it will perform usual decision tree.
2015-05-12 10:19:45 +02:00
Alexander Kukushkin
e2faf641d5
Start slave with the correct recovery.conf on governor start
...
Also governor is able to pick up already running master and slave
instances without restarting them.
In case is you have a lock and postgres is not running behaviour remains
the same: it will start master in read only mode and then promote if it
still has the lock.
2015-05-11 16:50:21 +02:00
Alexander Kukushkin
eb1721f65f
Minimize amount of requests to etcd
2015-05-11 15:15:08 +02:00
Alexander Kukushkin
8cfbdcfcd4
Track list of already existing physical replication slots
...
Drop replication slot when it was removed from etcd.
Execute pg_create_physical_replication_slot only when something new appeared in etcd.
2015-05-11 09:44:57 +02:00
Alexander Kukushkin
588c951a86
Return True after success call of update_leader and check return code
2015-05-11 08:48:51 +02:00
Alexander Kukushkin
72010f68cc
Bugfix: two calls has_lock and update_lock are not atomic
...
Having a lock a few moments ago, doesn't mean that you will be able to
update it.
2015-05-08 16:21:09 +02:00
Alexander Kukushkin
c75bb2b297
Format code according to pep8
2015-05-06 14:39:15 +02:00
Christopher Grim
b979c12c9d
Use timestamped logs
2015-04-03 17:27:47 -04:00
Christopher Winslett
d07572e80e
add a restarter to the ha loop
2015-03-19 08:46:14 -07:00
Christopher Winslett
0d75152d54
make healthiest node work
2015-03-16 09:47:52 -07:00
Christopher Winslett
450b9912d7
clean up some debugging statements
2015-03-16 08:30:15 -07:00
Christopher Winslett
3749883328
first commit
2015-03-15 23:16:48 -07:00