56 Commits
Author SHA1 Message Date
Feike SteenbergenandGitHub 4725f12f9a Allow integer gucs without units in validation (#2734)
Previously, integer gucs, for example `max_connections` would not pass the validation, as these settings have no unit, if and only if they were specified as a string.

This causes problems if the `max_connections` is configured in `patroni.yaml` as a string, for example, the following configuration would not result in the right `max_connections` settings, as `max_connections` is configured as a string:

    bootstrap:
      dcs:
        postgresql:
          parameters:
            log_checkpoints: "on"
            log_connections: "off"
            max_connections: "57"

Allowing a user to specify *all* parameters as a string was accepted before in Patroni and also seems very useful, as many of us will be using Ansible/Helm/Golang to build a Patroni configuration, in which creating a `map[string]string` is easier than having to deal with data types.

Attemps to address issue #2735 

Regression was introduced in https://github.com/zalando/patroni/commit/76b3b99de2f2bfaa8ab2df9e47dbfc3749d14e84
2023-07-10 13:44:54 +02:00
Feike SteenbergenandGitHub b6b220dddb Prevent pg_stat_statements from recording secrets (#2491)
pg_stat_statements is enabled by many by default, but will by default also track utility commands including an

        ALTER USER john WITH PASSWORD 's3cret'

We can prevent this leaking by ensuring that our session currently does not track utility commands when running a sensitive query.

Local testing shows that this command works fine, even for those that do not have `pg_stat_statements` configured in their
`shared_preload_libraries`.
2022-12-16 11:25:22 +01:00
Feike SteenbergenandGitHub e3bc546dd5 Move WAL and tablespaces after a failed init (#1631)
For init processes that use a symlinked WAL directory, or use custom scripts that create new tablespaces, these directories should also be renamed after a failed init attempt, as currently the following errors occur if the first init attempt failed, but a second one might succeed:

      fixing permissions on existing directory /var/lib/postgresql/data ... ok
      initdb: error: directory "/var/lib/postgresql/wal/pg_wal" exists but is not empty
      [...]
      File "/usr/lib/python3/dist-packages/patroni/ha.py", line 1173, in post_bootstrap
        self.cancel_initialization()
      File "/usr/lib/python3/dist-packages/patroni/ha.py", line 1168, in cancel_initialization
        raise PatroniException('Failed to bootstrap cluster')
      patroni.exceptions.PatroniException: 'Failed to bootstrap cluster'

In the remove_data_directory function the same happens for removing the data directory, it seems the same kind of thing should also happen when moving a data directory.

To ensure the data directory can still be used, the symlinks will point to the renamed directories.
2020-08-17 16:12:33 +02:00
Feike SteenbergenandGitHub 8b860d7528 Skip missing values from pg_controldata (#1501)
Skip missing values from pg_controldata

When calling controldata(), it may return an empty dictionary, which in
turn caused the following error to occur:

    effective_configuration
        cvalue = parse_int(data[cname])
    KeyError: 'max_wal_senders setting'

Instead of causing a crash of this part, we now log the error and
continue.




This is the full output of the error:
```
2020-04-17 14:31:54,791 ERROR: Exception during execution of long running task restarting after failure
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/patroni/async_executor.py", line 97, in run
    wakeup = func(*args) if args else func()
  File "/usr/lib/python3/dist-packages/patroni/postgresql/__init__.py", line 707, in follow
    self.start(timeout=timeout, block_callbacks=change_role, role=role)
  File "/usr/lib/python3/dist-packages/patroni/postgresql/__init__.py", line 409, in start
    configuration = self.config.effective_configuration
  File "/usr/lib/python3/dist-packages/patroni/postgresql/config.py", line 983, in effective_configuration
    cvalue = parse_int(data[cname])
KeyError: 'max_wal_senders setting'
```
2020-04-23 12:51:38 +02:00
Feike SteenbergenandGitHub d74a4b23a6 Scrub KUBERNETES_ environment from the postmaster (#1407)
The KUBERNETES_ environment variables are not required for PostgreSQL, yet having them exposed to the postmaster will also expose them to backends and to regular database users (using pl/perl for example).
2020-03-10 12:08:29 +01:00
Feike SteenbergenandHenning Jacobs d2d49907ad Correctly document PATRONI_KUBERNETES_PORTS (#1266)
The previous documentation was wrong and will throw the following error
when used:

        Exception when parsing list {[{"name": "postgresql", "port": 5432}]}

When removing the surrounding braces, the error goes away and the
endpoint is updated with the correct Port name.
2019-11-05 10:09:24 +01:00
Feike SteenbergenandGitHub dc259298dc Merge pull request #297 from ender74/python-wheel
added explicit dependency for python-wheel
2016-09-09 15:28:31 +02:00
Feike SteenbergenandGitHub 0d70199941 Merge pull request #293 from zalando/release1.1
Bumped version to 1.1
2016-09-07 15:01:56 +02:00
Feike SteenbergenandGitHub 0742ffe02e Merge pull request #292 from CartoDB/fix/remove-long-dashes-from-readme
Remove unicode em dashes and single quotes from README
2016-09-07 12:40:15 +02:00
Feike SteenbergenandGitHub 6bdaa7fb88 Merge pull request #288 from zalando/bugfix/python3_wale_restore
Decode output from wal-e list backup
2016-09-05 14:45:14 +02:00
Feike SteenbergenandGitHub 3cd5c8d3dd Merge pull request #286 from zalando/bugfix/external_master_replica
Do not attempt to parse missing conn url
2016-09-02 11:53:42 +02:00
Feike SteenbergenandGitHub dd5bc1bc9b Merge branch 'master' into feature/replica-info 2016-08-24 11:55:33 +02:00
Feike SteenbergenandGitHub dae1ab8c0a Documentation language 2016-06-13 14:55:24 +02:00
Feike SteenbergenandGitHub 1893f769a8 Merge pull request #214 from zalando/feature/dynamic_configuration
Feature/dynamic configuration
2016-06-10 09:22:48 +02:00
Feike Steenbergen dcfbdc7d29 Update .zappr.yml 2016-05-19 14:22:58 +02:00
Feike Steenbergen 4186e73c13 Update .zappr.yml 2016-05-19 14:21:33 +02:00
Feike Steenbergen 79ecfd994a Update .zappr.yml 2016-05-19 14:18:56 +02:00
Feike Steenbergen b43b670195 Update .zappr.yml 2016-05-19 14:17:55 +02:00
Feike Steenbergen 5bfc41d475 Update .zappr.yml 2016-05-19 10:22:13 +02:00
Feike Steenbergen 22a2bf73fa Merge pull request #197 from zalando/feature/dynamic_config_addons
Document passing on of run-time parameters
2016-05-17 08:51:21 +02:00
Feike Steenbergen dcdaabc747 Merge pull request #184 from zalando/feature/unify_patronictl_config_with_patroni
Unify Patroni and Patronictl configuration
2016-04-22 16:08:36 +02:00
Feike SteenbergenandFeike Steenbergen b727626f19 Update README.rst 2016-04-22 16:02:52 +02:00
Feike Steenbergen ae700062b6 Merge pull request #180 from zalando/bugfix/environment_leakage
Clear environment of PostgreSQL
2016-04-21 15:23:54 +02:00
Feike Steenbergen 07edbd2c42 Merge pull request #182 from zalando/bugfix/patroni_on_dc_fixes
Make sure present but empty optional sections don't cause errors.
2016-04-21 15:23:31 +02:00
Feike Steenbergen a5990de800 Merge pull request #181 from zalando/bugfix/acceptance-tests-connection-string
Do not assume that connection user is postgres, but take it from config.yml
2016-04-21 14:54:12 +02:00
Feike Steenbergen fbf44d3219 Merge pull request #177 from zalando/feature/remove_pghba_magic
Remove pg_hba injection and filtering
2016-04-21 10:24:52 +02:00
Feike Steenbergen a203690f07 Update README.rst 2016-04-20 16:44:02 +02:00
Feike Steenbergen d55893aa6d Merge pull request #175 from zalando/feature/cluster_id
Include database system identifier in cluster info
2016-04-20 08:58:39 +02:00
Feike Steenbergen d6c9eb0791 Merge pull request #135 from zalando/feature/setsid
Create new session and set the process group ID for the postmaster
2016-02-10 16:59:59 +01:00
Feike Steenbergen 642ffe5151 Merge pull request #126 from zalando/feature/docker_improvements
Docker improvements.
2016-02-04 11:21:00 +01:00
Feike Steenbergen 600e3fe853 Merge pull request #124 from zalando/bugfix/wrong-username
Bugfix: Ensure to inject the superuser username when connecting.
2016-02-03 17:06:52 +01:00
Feike Steenbergen 29668556db Merge pull request #112 from zalando/feature/patronictl_password
Feature/patronictl password
2016-02-03 17:03:49 +01:00
Feike Steenbergen 989443b4e3 Merge pull request #123 from zalando/feature/api-context
Provide more context for healthchecks and monitoring.
2016-02-01 12:33:08 +01:00
Feike Steenbergen c28e6a7067 Merge pull request #105 from zalando/patroni/add_wal_restore_to_pip
Enable installing scripts via pip and use patroni_ prefix for them.
2015-11-25 16:25:03 +01:00
Feike Steenbergen 781b1854eb Merge pull request #104 from zalando/feature/patroni_cli_or_ctl_tbd
Bugfixes for Patronictl and the Development Docker environment
2015-11-25 16:23:25 +01:00
Feike Steenbergen 5a99faf967 Update README.rst
Typo
2015-09-09 12:55:52 +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
Feike Steenbergen 496f91fea0 Update README.rst
Formatting issue with the header
2015-09-08 11:59:08 +02:00
Feike Steenbergen a07a80806a Update postgresql.py
Make build_connstring truly static
2015-08-11 11:33:40 +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
Feike Steenbergen a11a41796b Merge pull request #6 from zalando/feature/six
use six module to support python 2 and 3 instead of conditional imports
2015-08-11 11:20:30 +02:00
Feike Steenbergen 04dee96fde Merge pull request #9 from zalando/feature/documentation
Write some documentation in a docstring format for AbstractDCS class
2015-08-11 11:18:44 +02:00
Feike Steenbergen b7bedf6b06 Update dcs.py 2015-08-11 11:16:52 +02:00
Feike Steenbergen 76b22e7ad8 Update README.md 2015-07-08 12:23:53 +02:00
Feike Steenbergen 476685e93a Merge pull request #25 from zalando/etcd-cluster-support
Support work with etcd as a cluster
2015-06-09 14:49:34 +02:00
Feike Steenbergen f8d4a22921 Merge pull request #19 from zalando/features/refactoring
Wrap time.sleep into wrapper function
2015-05-28 16:07:41 +02:00
Feike Steenbergen 119c56e5d3 Merge pull request #18 from CyberDem0n/master
Set handler of SIGCHLD to SIG_IGN
2015-05-28 12:43:05 +02:00
Feike Steenbergen 3d11fe1fe6 Merge pull request #17 from zalando/features/refactoring
Store api url of each governor together with connect url of postgres
2015-05-28 09:26:09 +02:00
Feike Steenbergen c69f9459c6 Merge pull request #16 from zalando/features/refactoring
Replace os.system with subprocess.call
2015-05-27 11:32:53 +02:00
Feike Steenbergen 4b19daa83d Merge pull request #14 from zalando/features/refactoring
Demote master when it can not access etcd
2015-05-22 13:25:41 +02:00
Feike Steenbergen e318b06409 Merge pull request #13 from zalando/feature/unittests
Add Tests for testing the statuspage, extend the PostgreSQL test to r…
2015-05-21 15:03:31 +02:00
Feike Steenbergen ede9a2c464 Merge pull request #9 from zalando/features/refactoring
listen can contain more then one ip separated by comma
2015-05-18 16:55:35 +02:00
Feike Steenbergen 613b8793ce Merge pull request #8 from zalando/feature/connect_address
Feature/connect address
2015-05-15 13:54:00 +02:00
Feike Steenbergen d33555242d Merge pull request #6 from zalando/features/refactoring
Remove member and leader (is I was the master) keys from etcd on stop of governor
2015-05-13 17:17:51 +02:00
Feike Steenbergen 127a03d23d Merge pull request #3 from zalando/feature/status_page
Refactoring of Governor, adding of a health check, setting default ports to sane values.
2015-05-12 15:50:28 +02:00
Feike Steenbergen 82afc554d6 Merge pull request #2 from zalando/feature/status_page
Created statuspage, a health check for a PostgreSQL cluster served usi…
2015-05-11 16:25:28 +02:00