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
a69565fc5f
Set Postgresql._SERVER_VERSION only after real connect.
2015-09-04 13:22: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
5612cd0280
Changed use_slots to be backwards compatible by using config.get() per PR feedback.
2015-09-03 22:20:27 -07:00
Josh Berkus
aeea7196bd
Fixing flake8 issue.
2015-09-03 21:46:06 -07:00
Josh Berkus
6df56fc6cc
Another try at the is_healthiest_node bugfix.
2015-09-03 21:41:33 -07:00
Josh Berkus
2b62adae21
Fixed inherited bug in is_healthiest_node() with LSN position.
2015-09-03 21:22:59 -07:00
Josh Berkus
bdb1454e35
Another commit because flake8 is a huge waste of time.
2015-09-03 21:10:30 -07:00
Josh Berkus
5f4a9ffabb
Text spacing changes in an attempt to get flake8 to stop complaining.
2015-09-03 21:04:42 -07:00
Josh Berkus
2b801a3ccc
Next 9.3 compatibility commit. Removed pg_lsn, since it's not available in 9.3.
2015-09-03 18:03:25 -07:00
Josh Berkus
330f9023ee
Interim commit to make replication slots optional for 9.3 users.
2015-09-03 17:46:41 -07:00
Oleksii Kliukin
da132ca1fc
Do not rely on env vars for superuser role name.
...
Environment variables may not be set in Docker.
Instead, obtain the superuser role from the database.
2015-09-02 15:20:16 +02:00
Oleksii Kliukin
a5f2ab6f88
Better SIGCHLD handling, use correct user name.
...
- Defer SIGCHLD processing until the later stage in order to allow
subprocess to run its own reaping of children and return the correct
exit code from the process called.
- When changing the password at startup, do not assume the user postgres.
2015-09-02 12:56:23 +02:00
Oleksii Kliukin
29434e24ea
Allow relative paths to external scripts.
2015-08-24 16:53:57 +02:00
Alexander Kukushkin
72043703f5
Small code cleanup
2015-08-17 16:06:48 +02:00
Feike Steenbergen
a07a80806a
Update postgresql.py
...
Make build_connstring truly static
2015-08-11 11:33:40 +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
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
fd884a53a9
Multiple small fixes:
...
- Do delete trigger file in the patroni itself.
- Fix the typo in the datadir member.
- Add #! at the top of the python script.
2015-08-03 15:51:40 +02:00
Oleksii Kliukin
2089a123c2
fix line too long warning.
2015-08-03 11:48:02 +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
a0fdd6398f
Cosmetic changes: avoid magic strings in action names, name the parameter passed to the callback 'scope' for consistency.
2015-07-30 10:17:17 +02:00
Oleksii Kliukin
5171964758
Merge branch 'master' into feature/callbacks
2015-07-27 16:19:03 +02:00
Oleksii Kliukin
115ba1d9ae
Make sure postgresql.stop also return True if pg_ctl stop returned 0.
2015-07-27 11:23:08 +02:00
Oleksii Kliukin
201f9bf4b2
Make sure role check during callbacks does not accidentially modify the cluster state (is_promoted flag or trigger file).
2015-07-27 11:08:19 +02:00
Oleksii Kliukin
dac3d7997f
Change a typo.
2015-07-24 10:47:26 +02:00
Oleksii Kliukin
c9c678fb5b
Pass scope, the cluster name, instead of the name, which is the instance name, to the callback.
2015-07-23 16:16:22 +02:00
Oleksii Kliukin
e9934be9aa
Do not terminate on callback failure.
...
Show the error if a callback command fails and move on.
Set the executable bit for the aws callback.
2015-07-17 17:26:28 +02:00
Oleksii Kliukin
a11d94aff5
Pass text names of cluster roles to the script.
...
Seems better than passing a bool flag and
converting it from/to string.
2015-07-17 15:39:34 +02:00
Oleksii Kliukin
33b5e1b22e
Make sure is_leader is False does not trigger the leader re-check.
2015-07-17 15:22:21 +02:00
Oleksii Kliukin
11004f8c48
Be more robust on callbacks when cluster is down.
...
For 'on_stop' or 'on_restart' callbacks we cannot
call is_leader, because the cluster would be stopped.
Instead, call is_leader before running a callback.
In addition, make the call_nowait more robust by handling
the exceptions related to the DB cluster unavailability.
2015-07-17 11:19:05 +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
Oleksii Kliukin
d8aa1ff849
fix a typo.
2015-07-14 09:22:49 +02:00
Oleksii Kliukin
f734272f3f
Process the command paths relative to the patroni dir correctly, fix the error of not supplying a callback action to the actual command.
2015-07-13 11:45:25 +02:00
Oleksii Kliukin
c0cc590938
Remove usage of AWS.py from Patroni
...
Functionality provided by that module will be achieved via callbacks.
- fix a typo in aws.py
- fix some mixups of old code and new callbacks in postgresql.py
2015-07-10 12:58:37 +02:00
Alexander Kukushkin
71fce312c2
Enforce flake8 check
2015-07-10 10:53:04 +02:00
Oleksii Kliukin
aa5a72fb37
Add on_start, on_stop, on_role_change, on_restart and on_reload callbacks.
2015-07-09 15:45:10 +02:00
Alexander Kukushkin
c49580d6a7
Rename governor into patroni
2015-07-08 10:37:35 +02:00
Alexander Kukushkin
54400c6dec
Merge branch 'multidcs' of github.com:CyberDem0n/governor into feature/multidcs
...
Conflicts:
governor.py
tests/test_governor.py
tests/test_postgresql.py
2015-07-08 08:47:26 +02:00
Alexander Kukushkin
1531304baa
return result of last_operation as a string
2015-07-07 12:23:06 +02:00
Alexander Kukushkin
c7210d35ff
Merge pull request #27 from CyberDem0n/master
...
BUGFIX: keep list of replication slots on slaves empty
2015-06-25 14:20:10 +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
10d992a974
Merge pull request #26 from CyberDem0n/master
...
Reduce amount of writes into etcd
2015-06-24 16:39:50 +02:00