Alexander Kukushkin
f494d2ce64
Build Cluster object for ZooKeeper the same way as for Etcd
...
Previous implementation was always setting Cluster.initialize to True.
Also it was throwing ZooKeeperError when there were no members in a
cluster.
Plus BUGFIX of a bug introduced with
https://github.com/zalando/patroni/pull/34 in a `load_members` method.
- data = self.get_node(self.member_path)
+ data = self.get_node(self.members_path + member)
It was always fetching the same node for all cluster members.
Fortunately Etcd doesn't have such problem because we are fetching the
whole cluster directory with one recursive API call.
2015-09-14 11:19:46 +02:00
Oleksii Kliukin
cd312de252
Fix a flake8 warning.
...
Improve some unit tests by expecting specific exceptions.
2015-09-10 17:15:43 +02:00
Oleksii Kliukin
2377c417e4
Fix etcd and zookeper interactions with initialize key.
...
Fix unittests as well.
2015-09-10 16:05:10 +02:00
Oleksii Kliukin
938b946e55
Merge branch 'master' into feature/cleanup_on_failed_initialization
2015-09-10 15:43:31 +02:00
Alexander Kukushkin
36cbd34ffc
Fix zookeeper test coverage
2015-09-09 15:59:02 +02:00
Alexander Kukushkin
5bdb18761b
Define initialize, leader, optime and members string constansts in AbstractDCS
...
Also define following properties:
* initialize_path
* members_path
* member_path
* leader_path
* leader_optime_path
And replace any occurrences of these strings or client_path calls in a
etcd and zookeeper implementations with given constants and properties.
2015-09-09 15:10:45 +02:00
Oleksii Kliukin
ff499604f0
Act on removal of initialization flag.
...
If initializer node suddenly dies before the initialization is complete,
other nodes should try to take over.
Fix some unittests for etcd and zookeeper and add couple of new ones.
2015-09-08 16:04:54 +02:00
Oleksii Kliukin
92647b7aad
Merge branch 'master' of https://github.com/zalando/patroni into feature/cleanup_on_failed_initialization
2015-09-08 14:54:52 +02:00
Oleksii Kliukin
b842ed478b
Make sure initialize flag is reset on failure.
...
Cleanup the initialize flag if the initializing node fails
to bootstrap its PostgreSQL database.
Rename dcs.race to initialize, since we only call it for the
initialize flag. Factored out PostgreSQL bootstrapping code
into a separate function.
2015-09-08 12:03:34 +02:00
Alexander Kukushkin
1774d6e31a
Merge branches watch-leader-key and package-refactoring
2015-09-05 16:09:28 +02:00
Alexander Kukushkin
3a4a2dbb94
Merge branch 'master' of github.com:zalando/patroni into feature/watch-leader-key
2015-09-05 15:31:37 +02:00
Alexander Kukushkin
ac2740eeb9
Drop unused variable server_version
2015-09-05 15:22:38 +02:00
Alexander Kukushkin
7cce02ae95
Always use pg_xlog_location_diff to calculate bytes written to xlog
...
Drop unused functionality (lsn_to_bytes, bytes_to_lsn)
Revert some changes.
2015-09-05 15:19:17 +02:00
Alexander Kukushkin
650e244904
Refactor directory structure in preparation for building pypi-package
2015-09-04 16:06:44 +02:00
Alexander Kukushkin
c913c8ad92
Calculate xlog bytes with using lsn_to_bytes method
...
This method behaves differently depending on server version and will
allow to use patroni with postgres older than 9.3
2015-09-04 12:11:55 +02:00
Alexander Kukushkin
8b9e99090f
Move lsn_to_bytes and bytes_to_lsn into Postgresql class
...
and make their behavior version specific
2015-09-04 10:41:59 +02:00
Alexander Kukushkin
9361732722
Fix pep8 formatting and unit-tests
2015-09-04 08:29:16 +02:00
Alexander Kukushkin
df06860bde
Merge pull request #23 from pgexperts/93compat
...
93compat
2015-09-04 08:14:13 +02:00
Josh Berkus
f5627a498e
Fixed test_postgresql.py to include use_slots.
2015-09-03 18:41:30 -07:00
Alexander Kukushkin
50420771ce
Retry when executing take_leader method.
2015-09-03 16:53:15 +02:00
Alexander Kukushkin
2f6399de27
More unit-tests for etcd
2015-09-03 16:35:58 +02:00
Alexander Kukushkin
58410db9dd
Implemented Retry class inspired by KazooRetry
2015-09-03 11:47:08 +02:00
Alexander Kukushkin
7456662eef
Merge branch 'master' of github.com:zalando/patroni into feature/watch-leader-key
2015-09-03 10:33:26 +02:00
Alexander Kukushkin
a670b598f4
Implement unit test for reap_children function
2015-09-02 16:48:40 +02:00
Alexander Kukushkin
c6abf85740
Bugfix: sleep method was renamed to watch
2015-09-02 08:42:47 +02:00
Alexander Kukushkin
eb85caa3bd
Remove spurious print
2015-09-01 17:16:15 +02:00
Alexander Kukushkin
10c95a23e4
Rename sleep to watch in a AbstractDCS
...
This method suppose to watch for changes of leader key if current node
is not leader and also it could watch for changes in a members list if
current conde is the leader.
2015-09-01 09:59:37 +02:00
Alexander Kukushkin
fab321c6b0
Watch for changes of leader key
2015-09-01 09:54:57 +02:00
Alexander Kukushkin
3b1efff53e
Refactor Cluster object
...
`Cluster.leader` is not reference to `Member` anymore, but to `Leader`
`Leader` class contains field `index` (update index). This field is very
useful for watching for events which changing leader key. Also `Leader`
contains `member` field, which should reference real member.
2015-08-27 10:53:22 +02:00
Alexander Kukushkin
353fc58bee
Do not inherit rest api port on fork
2015-08-26 15:14:44 +02:00
Alexander Kukushkin
420176aa75
Merge branch 'master' of github.com:zalando/patroni into feature/python-etcd
2015-08-25 10:11:29 +02:00
Alexander Kukushkin
befd33555d
Refactor helpers/etcd.py
...
Work with etcd cluster via high-level python-etcd module.
Plus change all unit tests accordingly.
2015-08-24 16:58:08 +02:00
Oleksii Kliukin
29434e24ea
Allow relative paths to external scripts.
2015-08-24 16:53:57 +02:00
Feike Steenbergen
b0707c8ddd
Merge branch 'master' of github.com:zalando/patroni into feature/external_backup
...
Conflicts:
requirements-py2.txt
2015-08-11 11:27:53 +02:00
Feike Steenbergen
e51ea4c1ca
Merge pull request #4 from zalando/feature/lost-dcs-data
...
Run is_healthiest_node against last know healthy configuration of cluster
2015-08-11 11:22:46 +02:00
Alexander Kukushkin
ce6d1c69d8
Merge branch 'master' of github.com:zalando/patroni into feature/six
2015-08-11 10:19:35 +02:00
Alexander Kukushkin
e9d46b0adb
Merge branch 'master' of github.com:zalando/patroni into feature/lost-dcs-data
2015-08-11 10:19:07 +02:00
Oleksii Kliukin
164b5760a4
remove line too long warnings where possible.
2015-08-07 16:35:00 +02:00
Oleksii Kliukin
5d1d59a42b
Add mock-based unit tests for the restore module.
...
- add unit tests for the restore module
- additional dependencies in requirement
- harden the code that calls restore callbacks
- remove WAL-E related code from postgresql.py
2015-08-07 16:05:17 +02:00
Oleksii Kliukin
7f2dcc0a95
Move replica creation code into a separte file. So far, only the class that makes replicas with pg_basebackup is called.
2015-08-03 11:44:11 +02:00
Oleksii Kliukin
5171964758
Merge branch 'master' into feature/callbacks
2015-07-27 16:19:03 +02:00
Oleksii Kliukin
d85451efae
Increase test coverage for aws script.
2015-07-27 13:04:45 +02:00
Oleksii Kliukin
b92bfb34a5
Futher test for postgresql module (includes callbacks)
2015-07-27 13:04:01 +02:00
Oleksii Kliukin
859da0db0a
Make unit tets run again.
2015-07-27 10:10:29 +02:00
Alexander Kukushkin
b6c2061f3a
Merge branch 'master' of github.com:zalando/patroni into feature/six
2015-07-15 12:49:51 +02:00
Alexander Kukushkin
26935c3725
Merge branch 'master' of github.com:zalando/patroni into feature/lost-dcs-data
2015-07-15 12:49:38 +02:00
Alexander Kukushkin
66f4f790d2
Improve test coverage
2015-07-15 12:49:17 +02:00
Alexander Kukushkin
9df783cf9d
use six module to support python 2 and 3 instead of conditional imports
2015-07-15 12:03:28 +02:00
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
71fce312c2
Enforce flake8 check
2015-07-10 10:53:04 +02:00