Commit Graph
497 Commits
Author SHA1 Message Date
Alexander Kukushkin 918ac6a87d Merge pull request #39 from zalando/feature/reschedule-next-run
Feature/reschedule next run of ha cycle depending on return value of `watch`
2015-09-17 16:22:12 +02:00
Alexander Kukushkin b9ccd411ed Merge pull request #19 from zalando/feature/faster_shutdown
Feature/faster shutdown
2015-09-17 16:21:59 +02:00
Alexander Kukushkin 6530e1f7aa Remove unused parameter in a is_leader method 2015-09-17 16:11:08 +02:00
Alexander Kukushkin 0b753d25e1 Get rid from is_promoted flag. use role == 'master' instead 2015-09-17 13:57:29 +02:00
Alexander Kukushkin dbcc5aff9b Track postgresql role in a Postgresql class 2015-09-16 16:22:10 +02:00
Alexander Kukushkin e204945b3d Merge branch 'master' of github.com:zalando/patroni into feature/faster_shutdown 2015-09-16 15:20:53 +02:00
Alexander Kukushkin 0435e36cad self.cluster = None if unexpected exception occured 2015-09-16 15:14:02 +02:00
Alexander Kukushkin 246f0dbbaf watch should return true if you are not leader 2015-09-16 14:23:47 +02:00
Alexander Kukushkin c240fd1ee8 More documentation for watch method 2015-09-16 11:09:53 +02:00
Alexander Kukushkin 7f8e95b334 Next run of ha cycle is rescheduled depending on return value of watch
Current etcd implementation does not yet support timeout option when
`wait=true`: https://github.com/coreos/etcd/issues/2468

Originaly I've implemented `watch` method for `Etcd` class in a
following manner: if the leader key was updated just because master
needs to update ttl and watch timeout is not yet expired, I was
recalculating timeout and starting `watch` call once again.
Usually after "restart" we were getting urllib3.exceptions.TimeoutError.
The only possible way to recover after such exception - close socket and
establish a new connection. With pure http it's relatively cheap, but
with https and some kind of authorization on etcd side it would became
rather expensive and should be avoided.
2015-09-16 10:38:34 +02:00
Alexander Kukushkin a8305079c3 Merge pull request #38 from zalando/bugfix/zookeeper
Bugfix/zookeeper
2015-09-15 09:29:18 +02:00
Alexander Kukushkin 90cfcf0c14 Make zookeeper module compatible with python3 2015-09-14 17:14:39 +02:00
Alexander Kukushkin 44a20f12a4 version field is znode is just version, not mzxid 2015-09-14 16:32:45 +02:00
Oleksii Kliukin bf5737614d Merge pull request #30 from zalando/feature/cleanup_on_failed_initialization
Make sure initialize flag is reset on failure.
v0.3
2015-09-14 12:57:39 +02:00
Oleksii Kliukin d69403ab6f Merge pull request #37 from zalando/feature/zookeeper-fetch-initialize
Build Cluster object for ZooKeeper the same way as for Etcd
2015-09-14 12:55:10 +02:00
Oleksii Kliukin 51eacc5042 Handle the case when initialize flag is not set and leader is present. 2015-09-14 12:36:28 +02:00
Alexander Kukushkin 98488a00a2 Remove unused import of KazooException 2015-09-14 12:00:24 +02:00
Alexander Kukushkin 4a081bcb71 Run cancel_initialization with retry 2015-09-14 11:58:10 +02:00
Alexander Kukushkin 209c985420 get_node and get_children should catch only NoNodeError exception.
All other exceptions are needed to have retry functionality working
correctly.
2015-09-14 11:45:00 +02:00
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 be110c4ba0 Do not try to stop postgres twice if initialization had failed. 2015-09-14 09:20:45 +02:00
Oleksii Kliukin 15cd10669d Change an outdated comment. 2015-09-10 18:04:47 +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
Oleksii Kliukin 30a9e0f7f5 Move PostgreSQL data directory if init had failed.
Prevent treating the incompletely-initialized PostgreSQL cluster
as a valid on restart by forcefully moving the data directory.
I don't want to remove it altogether, since a DBA might decide
to analyze the failed PG cluster in order to resolve the init
issue.
2015-09-10 15:34:29 +02:00
Alexander Kukushkin 30a7d50a56 Merge pull request #34 from zalando/feature/constants-for-key-names
Define initialize, leader, optime and members string constansts in Ab…
2015-09-10 15:33:08 +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
Alexander Kukushkin e90b14cd3b Merge pull request #31 from zalando/bugfix/script_paths
Fix path to scripts subdirectory in configuration files.
2015-09-08 16:25:52 +02:00
Oleksii Kliukin 1c61280d70 Fix path to scripts subdirectory in configuration files. 2015-09-08 16:10:42 +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
Feike Steenbergen dd8472f639 Tag on github is prefixed with v. 2015-09-08 13:17:36 +02:00
Feike Steenbergen 4d334061b0 Bumped version to 0.2 v0.2 2015-09-08 13:10:19 +02:00
Feike Steenbergen 763e4db949 Bumped version to 0.20 2015-09-08 13:09:58 +02:00
Feike Steenbergen 02137948d0 Merge pull request #29 from zalando/feature/pypi-package-complete
Feature/pypi package complete
2015-09-08 12:50:57 +02:00
Alexander Kukushkin 61d1d5a098 Set current version to 0.2 2015-09-08 12:42:12 +02:00
Alexander Kukushkin fa22d91e05 Move some basic methods implementation into parent exception class 2015-09-08 12:41:48 +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
Feike Steenbergen 496f91fea0 Update README.rst
Formatting issue with the header
2015-09-08 11:59:08 +02:00
Feike Steenbergen 28f5839ac2 Make git add part of the release.sh again. 2015-09-07 14:00:05 +02:00
Feike Steenbergen cdccebd2d1 Point to api for listing of Docker images for Patroni (Issue #14) 2015-09-07 13:53:48 +02:00
Feike Steenbergen 348e8e8086 Reverted pip installation in Dockerfile
As the Dockerfile is there mainly to support developers, we want to build the Dockerfile using the current working
directory instead of a previously released version.
2015-09-07 13:47:05 +02:00
Alexander Kukushkin 5ea0ab70f5 Add patroni.py executable file 2015-09-07 10:37:10 +02:00
Alexander Kukushkin c9577e1a62 Merge Feike-s and my work on pypi package alltogether 2015-09-06 12:56:13 +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