Oleksii Kliukin
3181c4e59f
Code review, asynchronous restarts.
...
- Make the restart initiated by the schedule asynchronous
- Fix the placeholders in logs.
- Fix the regexp to detect the PostgreSQL version.
2016-07-12 20:25:01 +02:00
Oleksii Kliukin
ec160f0d59
Do not send 2 quotes for the empty request, instead, send None.
2016-07-11 18:20:42 +02:00
Oleksii Kliukin
bf95b75489
Use the parameter that really sets the pending_restart flag.
2016-07-11 18:20:15 +02:00
Oleksii Kliukin
b17483b7dd
Fix the PG version regex.
2016-07-11 15:21:31 +02:00
Oleksii Kliukin
c91eda8d78
Merge branch 'master' into feature/scheduled_restarts
2016-07-11 12:56:24 +02:00
Oleksii Kliukin
6da2eecb90
Increase the test coverage.
2016-07-11 11:51:07 +03:00
Oleksii Kliukin
8548956370
Bumped version to 1.0
v1.0
2016-07-05 17:03:19 +02:00
Oleksii Kliukin
34d18cc182
Set the standard name for the docker-compose file.
2016-07-05 17:02:40 +02:00
Alexander Kukushkin and GitHub
58ad8399cf
Merge pull request #238 from zalando/bugfix/pg_rewind
...
One more try to fix pg_rewind
2016-07-05 16:25:03 +02:00
Alexander Kukushkin
659f7617f5
New option: remove_data_directory_on_rewind_failure
...
One more try to fix pg_rewind
2016-07-05 12:11:15 +02:00
Oleksii Kliukin
8834f929aa
Improve the unit tests/coverage.
2016-07-05 10:07:29 +02:00
Oleksii Kliukin
36a86c67d0
Enable the conditions on normal restart.
2016-07-04 15:46:22 +02:00
Alexander Kukushkin and GitHub
a19dbfaddf
Merge pull request #232 from zalando/bugfix/pg_rewind
...
Start readonly when holding leader lock
2016-07-04 13:11:35 +02:00
Alexander Kukushkin and GitHub
40d48eae76
Merge pull request #237 from zalando/bugfix/etcd-retry
...
Calculate numer of retries and timeout
2016-07-04 13:11:25 +02:00
Alexander Kukushkin
f7b9709907
Calculate numer of retries and timeout
2016-07-04 12:01:54 +02:00
Alexander Kukushkin
2944a4bcbd
Start readonly when holding the leader lock
2016-07-04 11:08:24 +02:00
Alexander Kukushkin
b84e22c4ea
Implement more checks in the follow method
...
Although such situation should not happen in reality (follow method is
not supposed to be called when when the node is holding leader lock and
postgres is running), but to be on the safe side it is better to
implement as much checks as possible, because this method could
potentially remove data directory.
2016-07-04 10:56:37 +02:00
Alexander Kukushkin and GitHub
f9298d30ca
Merge pull request #231 from zalando/bugfix/etcd-retry
...
Fix retry logic in etcd.py
2016-07-04 10:37:55 +02:00
Alexander Kukushkin and GitHub
e025f335dc
Merge pull request #233 from zalando/bugfix/initialize
...
Initialize key can be present but empty
2016-07-04 09:48:09 +02:00
Alexander Kukushkin and GitHub
a6d840d6be
Merge pull request #234 from zalando/feature/zookeeper-connect-strategy
...
Implement different connect strategy for zookeeper
2016-07-04 09:47:55 +02:00
Alexander Kukushkin and GitHub
cd752fea14
Merge pull request #235 from zalando/bugfix/docker-volumes
...
Volume could be passed to the docker only with absolute path
2016-07-04 09:47:35 +02:00
Alexander Kukushkin and GitHub
3f1d06da32
Merge pull request #236 from zalando/bugfix/strtol
...
bugfix: strtol didn't worked correctly with 1 digit numbers
2016-07-04 09:47:09 +02:00
Alexander Kukushkin
bc9aec9076
bugfix: strtol didn't worked correctly with 1 digit numbers
2016-07-01 16:19:57 +02:00
Alexander Kukushkin
b7639f5b22
Volume could be passed to the docker only with absolute path
...
In addition to that add zookeeper support to the docker.
2016-07-01 12:43:33 +02:00
Alexander Kukushkin
f7c6bd4eab
Implement different connect strategy for zookeeper
...
Originally it was trying to connect during session_timeout time.
Such strategy doesn't work good during short network hiccups...
2016-07-01 12:31:29 +02:00
Alexander Kukushkin
ee529669d2
Start readonly when holding leader lock
...
Not starting of postgres was causeing situation when there were no
master running...
2016-07-01 12:28:02 +02:00
Alexander Kukushkin
8bd071d9a9
Initialize key can be present but empty
...
Nodes were trying to grab initialize key when it didn't contained sysid
2016-07-01 12:25:00 +02:00
Alexander Kukushkin and GitHub
dc27a30800
Merge pull request #230 from zalando/bugfix/pg_rewind
...
Try to cover as much as possible pg_rewind corner-cases
2016-06-30 12:09:10 +02:00
Alexander Kukushkin and GitHub
489ed20331
Merge pull request #229 from zalando/bugfix/env-zookeeper-hosts
...
Document that every single zookeeper host:port MUST be quoted
2016-06-30 12:09:03 +02:00
Alexander Kukushkin
aa10f42913
checkpoint method returns string status message
2016-06-30 10:45:54 +02:00
Feike Steenbergen
72f8fcbb5b
Document the per node timeout
2016-06-29 16:40:39 +02:00
Alexander Kukushkin
876cfdfb2d
Fix retry logic in etcd.py
...
Client class takes care about retrying when connection to the etcd node
fails. It calculates amount of retries and timeout depending on etcd
cluster size.
Etcd class should not retry when EtcdConnectionFailed exception is
raised (this case is already handled in the Client).
Besides that adjust retry timeouts in the Client class.
2016-06-29 15:30:54 +02:00
Alexander Kukushkin
4b67008488
Try to cover as much as possible pg_rewind corner-cases
...
rewind is not possible when:
1) trying to rewind from themself
2) leader is not reachable
3) leader is_in_recovery
All these cases were leading to removing of data directory...
In all cases except 1) it should "retry" when leader will became
available and not is_in_recovery.
2016-06-29 14:29:31 +02:00
Alexander Kukushkin
ae88e7c96e
Document that every single zookeeper host:port MUST be quoted
...
otherwise yaml library can not parse the list.
And make visible yaml exception when trying to parse this list.
2016-06-29 14:25:50 +02:00
Oleksii Kliukin
7a1e2e0c72
Fix the assert message.
2016-06-28 17:11:13 +02:00
Oleksii Kliukin
d2832ee43b
Address the code review.
...
Fix return value in the should_run_scheduled_action and the comments.
Correct the json composition in the scheduled_restart test.
Fix the delete in case there is no scheduled restart.
Fix the usage of format in the logger output.
Fix the indentation in the evaluate_scheduled_restart.
Fix the condition related to the body_is_optional in the do_POST_restart.
Fix a few typos in the error messages.
Fix the _read_json_content
Make the scheduled restart unit-tests a bit less ugly
2016-06-28 16:54:20 +02:00
Alexander Kukushkin and GitHub
0c6a1307da
Merge pull request #228 from zalando/bugfix/always-expose-role
...
bugfix: api must report role=master during pg_ctl stop
2016-06-28 15:24:16 +02:00
Alexander Kukushkin and GitHub
cae3b8ec1e
Merge pull request #226 from zalando/bugfix/sigterm
...
Setup signal handler before creating dcs
2016-06-28 15:24:05 +02:00
Alexander Kukushkin and GitHub
6fdd01a8eb
Merge pull request #225 from zalando/feature/confd
...
sample haproxy templates for confd
2016-06-28 15:23:54 +02:00
Alexander Kukushkin and GitHub
fe0bc2f3eb
Merge pull request #223 from zalando/feature/patronictl-at
...
Acceptance tests for patronictl
2016-06-28 15:23:44 +02:00
Alexander Kukushkin
0318749b56
bugfix: api must report role=master during pg_ctl stop
...
In addition for that make pg_ctl --timeout option configurable.
If the stop or start didn't succeeded during given timeout when demoting
master, role will be forcibly changed to 'unknown' and all needed
callbacks executed.
2016-06-28 14:14:42 +02:00
Oleksii Kliukin
854ff27e56
Allow normal conditional restarts.
...
In addition, use the RLock instead of the Lock in async executor
to make sure the lock can be acquired more than once from a single
thread.
2016-06-27 09:50:09 +02:00
Oleksii Kliukin
568eb730bc
Clear the scheduled restart after the normal one.
...
Make sure the scheduled restart flag is cleared when the
postmaster_start_time changes since the time restart was scheduled.
Additionally, separate the logic of checking the restart conditions
into the function in order to support conditions for the normal
restart as well.
2016-06-24 17:39:04 +02:00
Oleksii Kliukin
29845dd383
Restart the node according to the schedule.
...
The scheduled restart data structures are now independent of those
used by the normal restarts. This would be fixed in subsequent
commits.
Add the behave tests, that cover the POST /restart (but not DELETE).
2016-06-23 10:43:54 +02:00
Alexander Kukushkin
44433c2d42
Setup signal handler before creating dcs
...
Otherwise it was swallowing SysExit exception in an infinite loop.
2016-06-22 09:13:47 +02:00
Alexander Kukushkin
d65d1028a7
Add patroni-compose-etcd-3.yml
...
For starting up cluster easy with docker-compose.
And unify Dockerfile and scripts to be able to work with docker-compose
and the old one dev_patroni_cluster.sh script
2016-06-21 17:07:24 +02:00
Oleksii Kliukin
e5cf06101a
Fix line is too long warnings.
2016-06-21 11:19:33 +02:00
Oleksii Kliukin
6a8bfdeb76
Decouple the schedule check from the failover.
2016-06-21 11:02:10 +02:00
Oleksii Kliukin
70195bec2d
Handle empty body correctly when reading requests.
2016-06-21 10:56:18 +02:00
Oleksii Kliukin
c2490d4831
Merge branch 'master' into feature/scheduled_restarts
2016-06-20 15:38:20 +02:00