diff --git a/docs/ENVIRONMENT.rst b/docs/ENVIRONMENT.rst index 3fd05a8b..b6c6fe01 100644 --- a/docs/ENVIRONMENT.rst +++ b/docs/ENVIRONMENT.rst @@ -57,7 +57,7 @@ Consul - **PATRONI\_CONSUL\_REGISTER\_SERVICE**: (optional) whether or not to register a service with the name defined by the scope parameter and the tag master, primary, replica, or standby-leader depending on the node's role. Defaults to **false** - **PATRONI\_CONSUL\_SERVICE\_TAGS**: (optional) additional static tags to add to the Consul service apart from the role (``primary``/``replica``/``standby-leader``). By default an empty list is used. - **PATRONI\_CONSUL\_SERVICE\_CHECK\_INTERVAL**: (optional) how often to perform health check against registered url -- **PATRONI\_CONSUL\_SERVICE\_CHECK\_TLS\_SERVER\_NAME**: (optional) overide SNI host when connecting via TLS, see also `consul agent check API reference `__. +- **PATRONI\_CONSUL\_SERVICE\_CHECK\_TLS\_SERVER\_NAME**: (optional) override SNI host when connecting via TLS, see also `consul agent check API reference `__. Etcd ---- @@ -155,7 +155,7 @@ PostgreSQL - **PATRONI\_REPLICATION\_SSLKEY**: (optional) maps to the `sslkey `__ connection parameter, which specifies the location of the secret key used with the client's certificate. - **PATRONI\_REPLICATION\_SSLPASSWORD**: (optional) maps to the `sslpassword `__ connection parameter, which specifies the password for the secret key specified in ``PATRONI_REPLICATION_SSLKEY``. - **PATRONI\_REPLICATION\_SSLCERT**: (optional) maps to the `sslcert `__ connection parameter, which specifies the location of the client certificate. -- **PATRONI\_REPLICATION\_SSLROOTCERT**: (optional) maps to the `sslrootcert `__ connection parameter, which specifies the location of a file containing one ore more certificate authorities (CA) certificates that the client will use to verify a server's certificate. +- **PATRONI\_REPLICATION\_SSLROOTCERT**: (optional) maps to the `sslrootcert `__ connection parameter, which specifies the location of a file containing one or more certificate authorities (CA) certificates that the client will use to verify a server's certificate. - **PATRONI\_REPLICATION\_SSLCRL**: (optional) maps to the `sslcrl `__ connection parameter, which specifies the location of a file containing a certificate revocation list. A client will reject connecting to any server that has a certificate present in this list. - **PATRONI\_REPLICATION\_SSLCRLDIR**: (optional) maps to the `sslcrldir `__ connection parameter, which specifies the location of a directory with files containing a certificate revocation list. A client will reject connecting to any server that has a certificate present in this list. - **PATRONI\_REPLICATION\_SSLNEGOTIATION**: (optional) maps to the `sslnegotiation `__ connection parameter, which controls how SSL encryption is negotiated with the server, if SSL is used. @@ -167,7 +167,7 @@ PostgreSQL - **PATRONI\_SUPERUSER\_SSLKEY**: (optional) maps to the `sslkey `__ connection parameter, which specifies the location of the secret key used with the client's certificate. - **PATRONI\_SUPERUSER\_SSLPASSWORD**: (optional) maps to the `sslpassword `__ connection parameter, which specifies the password for the secret key specified in ``PATRONI_SUPERUSER_SSLKEY``. - **PATRONI\_SUPERUSER\_SSLCERT**: (optional) maps to the `sslcert `__ connection parameter, which specifies the location of the client certificate. -- **PATRONI\_SUPERUSER\_SSLROOTCERT**: (optional) maps to the `sslrootcert `__ connection parameter, which specifies the location of a file containing one ore more certificate authorities (CA) certificates that the client will use to verify a server's certificate. +- **PATRONI\_SUPERUSER\_SSLROOTCERT**: (optional) maps to the `sslrootcert `__ connection parameter, which specifies the location of a file containing one or more certificate authorities (CA) certificates that the client will use to verify a server's certificate. - **PATRONI\_SUPERUSER\_SSLCRL**: (optional) maps to the `sslcrl `__ connection parameter, which specifies the location of a file containing a certificate revocation list. A client will reject connecting to any server that has a certificate present in this list. - **PATRONI\_SUPERUSER\_SSLCRLDIR**: (optional) maps to the `sslcrldir `__ connection parameter, which specifies the location of a directory with files containing a certificate revocation list. A client will reject connecting to any server that has a certificate present in this list. - **PATRONI\_SUPERUSER\_SSLNEGOTIATION**: (optional) maps to the `sslnegotiation `__ connection parameter, which controls how SSL encryption is negotiated with the server, if SSL is used. @@ -179,7 +179,7 @@ PostgreSQL - **PATRONI\_REWIND\_SSLKEY**: (optional) maps to the `sslkey `__ connection parameter, which specifies the location of the secret key used with the client's certificate. - **PATRONI\_REWIND\_SSLPASSWORD**: (optional) maps to the `sslpassword `__ connection parameter, which specifies the password for the secret key specified in ``PATRONI_REWIND_SSLKEY``. - **PATRONI\_REWIND\_SSLCERT**: (optional) maps to the `sslcert `__ connection parameter, which specifies the location of the client certificate. -- **PATRONI\_REWIND\_SSLROOTCERT**: (optional) maps to the `sslrootcert `__ connection parameter, which specifies the location of a file containing one ore more certificate authorities (CA) certificates that the client will use to verify a server's certificate. +- **PATRONI\_REWIND\_SSLROOTCERT**: (optional) maps to the `sslrootcert `__ connection parameter, which specifies the location of a file containing one or more certificate authorities (CA) certificates that the client will use to verify a server's certificate. - **PATRONI\_REWIND\_SSLCRL**: (optional) maps to the `sslcrl `__ connection parameter, which specifies the location of a file containing a certificate revocation list. A client will reject connecting to any server that has a certificate present in this list. - **PATRONI\_REWIND\_SSLCRLDIR**: (optional) maps to the `sslcrldir `__ connection parameter, which specifies the location of a directory with files containing a certificate revocation list. A client will reject connecting to any server that has a certificate present in this list. - **PATRONI\_REWIND\_SSLNEGOTIATION**: (optional) maps to the `sslnegotiation `__ connection parameter, which controls how SSL encryption is negotiated with the server, if SSL is used. diff --git a/docs/citus.rst b/docs/citus.rst index ac2e3802..b1400255 100644 --- a/docs/citus.rst +++ b/docs/citus.rst @@ -58,7 +58,7 @@ patronictl ---------- Coordinator and worker clusters are physically different PostgreSQL/Patroni -clusters that are just logically groupped together using the +clusters that are just logically grouped together using the `Citus `__ database extension to PostgreSQL. Therefore in most cases it is not possible to manage them as a single entity. @@ -175,7 +175,7 @@ And this is how it looks on the coordinator side:: 2024-08-26 07:02:38,636 DEBUG: query(SELECT pg_catalog.citus_update_node(%s, %s, %s, true, %s), (3, '172.19.0.7-demoted', 5432, 10000)) # From this moment all application traffic on the coordinator to the worker group 2 is paused. - # The old worker primary is assiged as a secondary. + # The old worker primary is assigned as a secondary. 2024-08-26 07:02:40,084 DEBUG: query(SELECT pg_catalog.citus_update_node(%s, %s, %s, true, %s), (7, '172.19.0.7', 5432, 10000)) # The future worker primary notifies the coordinator that it acquired the leader lock in DCS and about to run "pg_ctl promote". diff --git a/docs/dynamic_configuration.rst b/docs/dynamic_configuration.rst index 403cd0aa..09413312 100644 --- a/docs/dynamic_configuration.rst +++ b/docs/dynamic_configuration.rst @@ -21,7 +21,7 @@ In order to change the dynamic configuration you can use either :ref:`patronictl - **maximum\_lag\_on\_failover**: the maximum bytes a follower may lag to be able to participate in leader election. -- **maximum\_lag\_on\_syncnode**: the maximum bytes a synchronous follower may lag before it is considered as an unhealthy candidate and swapped by healthy asynchronous follower. Patroni utilize the max replica lsn if there is more than one follower, otherwise it will use leader's current wal lsn. Default is -1, Patroni will not take action to swap synchronous unhealthy follower when the value is set to 0 or below. Please set the value high enough so Patroni won't swap synchrounous follower fequently during high transaction volume. +- **maximum\_lag\_on\_syncnode**: the maximum bytes a synchronous follower may lag before it is considered as an unhealthy candidate and swapped by healthy asynchronous follower. Patroni utilize the max replica lsn if there is more than one follower, otherwise it will use leader's current wal lsn. Default is -1, Patroni will not take action to swap synchronous unhealthy follower when the value is set to 0 or below. Please set the value high enough so Patroni won't swap synchrounous follower frequently during high transaction volume. - **max\_timelines\_history**: maximum number of timeline history items kept in DCS. Default value: 0. When set to 0, it keeps the full history in DCS. - **primary\_start\_timeout**: the amount of time a primary is allowed to recover from failures before failover is triggered (in seconds). Default is 300 seconds. When set to 0 failover is done immediately after a crash is detected if possible. When using asynchronous replication a failover can cause lost transactions. Worst case failover time for primary failure is: loop\_wait + primary\_start\_timeout + loop\_wait, unless primary\_start\_timeout is zero, in which case it's just loop\_wait. Set the value according to your durability/availability tradeoff. - **primary\_stop\_timeout**: The number of seconds Patroni is allowed to wait when stopping Postgres and effective only when synchronous_mode is enabled. When set to > 0 and the synchronous_mode is enabled, Patroni sends SIGKILL to the postmaster if the stop operation is running for more than the value set by primary\_stop\_timeout. Set the value according to your durability/availability tradeoff. If the parameter is not set or set <= 0, primary\_stop\_timeout does not apply. diff --git a/docs/faq.rst b/docs/faq.rst index 6345e569..4dd488db 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -190,7 +190,7 @@ I have ``use_slots`` enabled in my Patroni configuration, but when a cluster mem Patroni will create the permanent physical slots on all nodes, and make sure to not remove the slots, as well as to advance the slots' LSN on all nodes according to the LSN that has been consumed by the member. - Later, if you decide to remove the corresponding member, it's **your responsability** to adjust the permanent slots configuration, otherwise Patroni will keep the slots around forever. + Later, if you decide to remove the corresponding member, it's **your responsibility** to adjust the permanent slots configuration, otherwise Patroni will keep the slots around forever. **Note:** on Patroni older than ``3.2.0`` you could still have member slots configured as permanent physical slots, however they would be managed only on the current leader. That is, in case of failover/switchover these slots would be created on the new leader, but that wouldn't guarantee that it had all WAL segments for the absent node. diff --git a/docs/patronictl.rst b/docs/patronictl.rst index 7aefae8b..98cd94ee 100644 --- a/docs/patronictl.rst +++ b/docs/patronictl.rst @@ -78,7 +78,7 @@ This is the synopsis for running a command from the ``patronictl``: - Things written in uppercase represent a literal that should be given a value to. We will use this same syntax when describing ``patronictl`` sub-commands in the following sub-sections. - Also, when describing sub-commands in the following sub-sections, the commands' synposis should be seen as a replacement for the ``SUBCOMMAND`` in the above synopsis. + Also, when describing sub-commands in the following sub-sections, the commands' synopsis should be seen as a replacement for the ``SUBCOMMAND`` in the above synopsis. In the following sub-sections you can find a description of each command implemented by ``patronictl``. For sake of example, we will use the configuration files present in the GitHub repository of Patroni (files ``postgres0.yml``, ``postgres1.yml`` and ``postgres2.yml``). @@ -224,7 +224,7 @@ Parameters ``PG_CONFIG`` is the name of the Postgres configuration to be set. - ``PG_VALUE`` is the value for ``PG_CONFIG``. If it is ``nulll``, then ``PG_CONFIG`` will be removed from the dynamic configuration. + ``PG_VALUE`` is the value for ``PG_CONFIG``. If it is ``null``, then ``PG_CONFIG`` will be removed from the dynamic configuration. ``--apply`` Apply dynamic configuration from the given file. @@ -1427,7 +1427,7 @@ Parameters ``--scheduled`` Schedule a restart to occur at the given timestamp. - ``TIMESTAMP`` is the timestamp when the restart should occur. Specify it in unambiguous format, preferrably with time zone. You can also use the literal ``now`` for the restart to be executed immediately. + ``TIMESTAMP`` is the timestamp when the restart should occur. Specify it in unambiguous format, preferably with time zone. You can also use the literal ``now`` for the restart to be executed immediately. ``--force`` Flag to skip confirmation prompts when requesting the restart operations. @@ -1665,7 +1665,7 @@ Parameters ``--scheduled`` Schedule a switchover to occur at the given timestamp. - ``TIMESTAMP`` is the timestamp when the switchover should occur. Specify it in unambiguous format, preferrably with time zone. You can also use the literal ``now`` for the switchover to be executed immediately. + ``TIMESTAMP`` is the timestamp when the switchover should occur. Specify it in unambiguous format, preferably with time zone. You can also use the literal ``now`` for the switchover to be executed immediately. ``--force`` Flag to skip confirmation prompts when performing the switchover. diff --git a/docs/releases.rst b/docs/releases.rst index fddd4dcd..616a98ea 100644 --- a/docs/releases.rst +++ b/docs/releases.rst @@ -536,7 +536,7 @@ Released 2023-09-20 - Don't rely on ``pg_stat_wal_receiver`` when deciding on ``pg_rewind`` (Alexander Kukushkin) - It could happen that ``received_tli`` reported by ``pg_stat_wal_recevier`` is ahead of the actual replayed timeline, while the timeline reported by ``DENTIFY_SYSTEM`` via replication connection is always correct. + It could happen that ``received_tli`` reported by ``pg_stat_wal_receiver`` is ahead of the actual replayed timeline, while the timeline reported by ``DENTIFY_SYSTEM`` via replication connection is always correct. Version 3.1.0 @@ -1596,7 +1596,7 @@ This version enhances compatibility with PostgreSQL 13, adds support of multiple Replicas are waiting for checkpoint indication via member key of the leader in DCS. The key is normally updated only once per HA loop. Without waking the main thread up, replicas will have to wait up to ``loop_wait`` seconds longer than necessary. -- Use of ``pg_stat_wal_recevier`` view on 9.6+ (Alexander Kukushkin) +- Use of ``pg_stat_wal_receiver`` view on 9.6+ (Alexander Kukushkin) The view contains up-to-date values of ``primary_conninfo`` and ``primary_slot_name``, while the contents of ``recovery.conf`` could be stale. @@ -2781,7 +2781,7 @@ In addition to using Endpoints, Patroni supports ConfigMaps. You can find more i This object identifies a running postmaster process via pid and start time and simplifies detection (and resolution) of situations when the postmaster was restarted behind our back or when postgres directory disappeared from the file system. -- Minimize the amount of SELECT's issued by Patroni on every loop of HA cylce (Alexander Kukushkin) +- Minimize the amount of SELECT's issued by Patroni on every loop of HA cycle (Alexander Kukushkin) On every iteration of HA loop Patroni needs to know recovery status and absolute wal position. From now on Patroni will run only single SELECT to get this information instead of two on the replica and three on the master. @@ -2805,7 +2805,7 @@ In addition to using Endpoints, Patroni supports ConfigMaps. You can find more i - Improve ``patronictl reinit`` (Alexander Kukushkin) - Sometimes ``patronictl reinit`` refused to proceed when Patroni was busy with other actions, namely trying to start postgres. `patronictl` didn't provide any commands to cancel such long running actions and the only (dangerous) workarond was removing a data directory manually. The new implementation of `reinit` forcefully cancells other long-running actions before proceeding with reinit. + Sometimes ``patronictl reinit`` refused to proceed when Patroni was busy with other actions, namely trying to start postgres. `patronictl` didn't provide any commands to cancel such long running actions and the only (dangerous) workarond was removing a data directory manually. The new implementation of `reinit` forcefully cancels other long-running actions before proceeding with reinit. - Implement ``--wait`` flag in ``patronictl pause`` and ``patronictl resume`` (Alexander Kukushkin) @@ -2834,7 +2834,7 @@ In addition to using Endpoints, Patroni supports ConfigMaps. You can find more i - Add new /sync and /async endpoints (Alexander Kukushkin, Oleksii Kliukin) - Those endpoints (also accessible as /synchronous and /asynchronous) return 200 only for synchronous and asynchronous replicas correspondingly (exclusing those marked as `noloadbalance`). + Those endpoints (also accessible as /synchronous and /asynchronous) return 200 only for synchronous and asynchronous replicas correspondingly (excluding those marked as `noloadbalance`). **Allow multiple hosts for Etcd** @@ -3015,7 +3015,7 @@ at the end. Allow custom bootstrap scripts instead of ``initdb`` when initializing the very first node in the cluster. The bootstrap command receives the name of the cluster and the path to the data directory. The resulting cluster can be configured to perform recovery, making it possible to bootstrap from a backup and do point in time recovery. Refer - to the :ref:`documentaton page ` for more detailed description of this feature. + to the :ref:`documentation page ` for more detailed description of this feature. **Smarter pg_rewind support** diff --git a/docs/yaml_configuration.rst b/docs/yaml_configuration.rst index e05142f3..e837f5f0 100644 --- a/docs/yaml_configuration.rst +++ b/docs/yaml_configuration.rst @@ -106,7 +106,7 @@ Most of the parameters are optional, but you have to specify one of the **host** - **register\_service**: (optional) whether or not to register a service with the name defined by the scope parameter and the tag master, primary, replica, or standby-leader depending on the node's role. Defaults to **false**. - **service\_tags**: (optional) additional static tags to add to the Consul service apart from the role (``primary``/``replica``/``standby-leader``). By default an empty list is used. - **service\_check\_interval**: (optional) how often to perform health check against registered url. Defaults to '5s'. -- **service\_check\_tls\_server\_name**: (optional) overide SNI host when connecting via TLS, see also `consul agent check API reference `__. +- **service\_check\_tls\_server\_name**: (optional) override SNI host when connecting via TLS, see also `consul agent check API reference `__. The ``token`` needs to have the following ACL permissions: @@ -239,7 +239,7 @@ PostgreSQL - **sslkey**: (optional) maps to the `sslkey `__ connection parameter, which specifies the location of the secret key used with the client's certificate. - **sslpassword**: (optional) maps to the `sslpassword `__ connection parameter, which specifies the password for the secret key specified in ``sslkey``. - **sslcert**: (optional) maps to the `sslcert `__ connection parameter, which specifies the location of the client certificate. - - **sslrootcert**: (optional) maps to the `sslrootcert `__ connection parameter, which specifies the location of a file containing one ore more certificate authorities (CA) certificates that the client will use to verify a server's certificate. + - **sslrootcert**: (optional) maps to the `sslrootcert `__ connection parameter, which specifies the location of a file containing one or more certificate authorities (CA) certificates that the client will use to verify a server's certificate. - **sslcrl**: (optional) maps to the `sslcrl `__ connection parameter, which specifies the location of a file containing a certificate revocation list. A client will reject connecting to any server that has a certificate present in this list. - **sslcrldir**: (optional) maps to the `sslcrldir `__ connection parameter, which specifies the location of a directory with files containing a certificate revocation list. A client will reject connecting to any server that has a certificate present in this list. - **sslnegotiation**: (optional) maps to the `sslnegotiation `__ connection parameter, which controls how SSL encryption is negotiated with the server, if SSL is used. @@ -253,7 +253,7 @@ PostgreSQL - **sslkey**: (optional) maps to the `sslkey `__ connection parameter, which specifies the location of the secret key used with the client's certificate. - **sslpassword**: (optional) maps to the `sslpassword `__ connection parameter, which specifies the password for the secret key specified in ``sslkey``. - **sslcert**: (optional) maps to the `sslcert `__ connection parameter, which specifies the location of the client certificate. - - **sslrootcert**: (optional) maps to the `sslrootcert `__ connection parameter, which specifies the location of a file containing one ore more certificate authorities (CA) certificates that the client will use to verify a server's certificate. + - **sslrootcert**: (optional) maps to the `sslrootcert `__ connection parameter, which specifies the location of a file containing one or more certificate authorities (CA) certificates that the client will use to verify a server's certificate. - **sslcrl**: (optional) maps to the `sslcrl `__ connection parameter, which specifies the location of a file containing a certificate revocation list. A client will reject connecting to any server that has a certificate present in this list. - **sslcrldir**: (optional) maps to the `sslcrldir `__ connection parameter, which specifies the location of a directory with files containing a certificate revocation list. A client will reject connecting to any server that has a certificate present in this list. - **sslnegotiation**: (optional) maps to the `sslnegotiation `__ connection parameter, which controls how SSL encryption is negotiated with the server, if SSL is used. @@ -267,7 +267,7 @@ PostgreSQL - **sslkey**: (optional) maps to the `sslkey `__ connection parameter, which specifies the location of the secret key used with the client's certificate. - **sslpassword**: (optional) maps to the `sslpassword `__ connection parameter, which specifies the password for the secret key specified in ``sslkey``. - **sslcert**: (optional) maps to the `sslcert `__ connection parameter, which specifies the location of the client certificate. - - **sslrootcert**: (optional) maps to the `sslrootcert `__ connection parameter, which specifies the location of a file containing one ore more certificate authorities (CA) certificates that the client will use to verify a server's certificate. + - **sslrootcert**: (optional) maps to the `sslrootcert `__ connection parameter, which specifies the location of a file containing one or more certificate authorities (CA) certificates that the client will use to verify a server's certificate. - **sslcrl**: (optional) maps to the `sslcrl `__ connection parameter, which specifies the location of a file containing a certificate revocation list. A client will reject connecting to any server that has a certificate present in this list. - **sslcrldir**: (optional) maps to the `sslcrldir `__ connection parameter, which specifies the location of a directory with files containing a certificate revocation list. A client will reject connecting to any server that has a certificate present in this list. - **sslnegotiation**: (optional) maps to the `sslnegotiation `__ connection parameter, which controls how SSL encryption is negotiated with the server, if SSL is used. diff --git a/features/environment.py b/features/environment.py index fb4220d0..9f9adfd2 100644 --- a/features/environment.py +++ b/features/environment.py @@ -1123,12 +1123,12 @@ def before_feature(context, feature): elif feature.name == 'citus': lib = subprocess.check_output(['pg_config', '--pkglibdir']).decode('utf-8').strip() if not os.path.exists(os.path.join(lib, 'citus.so')): - return feature.skip("Citus extenstion isn't available") + return feature.skip("Citus extension isn't available") context.pctl.create_and_set_output_directory(feature.name) def after_feature(context, feature): - """ send SIGCONT to a dcs if neccessary, + """ send SIGCONT to a dcs if necessary, stop all Patronis remove their data directory and cleanup the keys in etcd """ context.dcs_ctl.stop_outage() context.pctl.stop_all() diff --git a/features/steps/basic_replication.py b/features/steps/basic_replication.py index c6529150..58fae33b 100644 --- a/features/steps/basic_replication.py +++ b/features/steps/basic_replication.py @@ -136,8 +136,8 @@ def check_patroni_log(context, message_list, level, node, timeout): message_list = json.loads(message_list) for _ in range(int(timeout)): - messsages_of_level = context.pctl.read_patroni_log(node, level) - if any(any(message in line for line in messsages_of_level) for message in message_list): + messages_of_level = context.pctl.read_patroni_log(node, level) + if any(any(message in line for line in messages_of_level) for message in message_list): break sleep(1) else: diff --git a/kubernetes/openshift-example/templates/template_patroni_ephemeral.yml b/kubernetes/openshift-example/templates/template_patroni_ephemeral.yml index 76dbd186..ee6f7cd3 100644 --- a/kubernetes/openshift-example/templates/template_patroni_ephemeral.yml +++ b/kubernetes/openshift-example/templates/template_patroni_ephemeral.yml @@ -310,7 +310,7 @@ parameters: name: PATRONI_SUPERUSER_USERNAME value: postgres - description: Password of the superuser account for initialization. - displayName: Superuser Passsword + displayName: Superuser Password name: PATRONI_SUPERUSER_PASSWORD value: postgres - description: Username of the replication account for initialization. @@ -318,7 +318,7 @@ parameters: name: PATRONI_REPLICATION_USERNAME value: postgres - description: Password of the replication account for initialization. - displayName: Repication Passsword + displayName: Repication Password name: PATRONI_REPLICATION_PASSWORD value: postgres - description: Service account name used for pods and rolebindings to form a cluster in the project. diff --git a/kubernetes/openshift-example/templates/template_patroni_persistent.yaml b/kubernetes/openshift-example/templates/template_patroni_persistent.yaml index 94c38184..6fa764c1 100644 --- a/kubernetes/openshift-example/templates/template_patroni_persistent.yaml +++ b/kubernetes/openshift-example/templates/template_patroni_persistent.yaml @@ -334,7 +334,7 @@ parameters: name: PATRONI_SUPERUSER_USERNAME value: postgres - description: Password of the superuser account for initialization. - displayName: Superuser Passsword + displayName: Superuser Password name: PATRONI_SUPERUSER_PASSWORD value: postgres - description: Username of the replication account for initialization. @@ -342,7 +342,7 @@ parameters: name: PATRONI_REPLICATION_USERNAME value: postgres - description: Password of the replication account for initialization. - displayName: Repication Passsword + displayName: Repication Password name: PATRONI_REPLICATION_PASSWORD value: postgres - description: Service account name used for pods and rolebindings to form a cluster in the project. diff --git a/patroni/api.py b/patroni/api.py index 003de2ec..87d92208 100644 --- a/patroni/api.py +++ b/patroni/api.py @@ -1146,7 +1146,7 @@ class RestApiHandler(BaseHTTPRequestHandler): data = 'Switchover is possible only to a specific candidate in a paused state' if action == 'failover' and leader: - logger.warning('received failover request with leader specifed - performing switchover instead') + logger.warning('received failover request with leader specified - performing switchover instead') action = 'switchover' if not data and leader == candidate: diff --git a/patroni/config_generator.py b/patroni/config_generator.py index 6648dc15..358d656e 100644 --- a/patroni/config_generator.py +++ b/patroni/config_generator.py @@ -54,7 +54,7 @@ def get_address() -> Tuple[str, str]: :returns: tuple consisting of the hostname returned by :func:`~socket.gethostname` and the first element in the sorted list of the addresses returned by :func:`~socket.getaddrinfo`. Sorting guarantees it will prefer IPv4. - If an exception occured, hostname and ip values are equal to :data:`~patroni.config_generator.NO_VALUE_MSG`. + If an exception occurred, hostname and ip values are equal to :data:`~patroni.config_generator.NO_VALUE_MSG`. """ hostname = None try: @@ -229,7 +229,7 @@ class AbstractConfigGenerator(abc.ABC): class SampleConfigGenerator(AbstractConfigGenerator): """Object representing the generated sample Patroni config. - Sane defults are used based on the gathered PG version. + Sane defaults are used based on the gathered PG version. """ @property @@ -314,7 +314,7 @@ class RunningClusterConfigGenerator(AbstractConfigGenerator): @property def _required_pg_params(self) -> List[str]: - """PG configuration prameters that have to be always present in the generated config. + """PG configuration parameters that have to be always present in the generated config. :returns: list of the parameter names. """ @@ -330,7 +330,7 @@ class RunningClusterConfigGenerator(AbstractConfigGenerator): :exc:`~patroni.exceptions.PatroniException`: if: * pid could not be obtained from the ``postmaster.pid`` file; or - * :exc:`OSError` occured during ``postmaster.pid`` file handling; or + * :exc:`OSError` occurred during ``postmaster.pid`` file handling; or * the obtained postmaster pid doesn't exist. """ postmaster_pid = None @@ -353,7 +353,7 @@ class RunningClusterConfigGenerator(AbstractConfigGenerator): """Get cursor for the PG connection established based on the stored information. :raises: - :exc:`~patroni.exceptions.PatroniException`: if :exc:`psycopg.Error` occured. + :exc:`~patroni.exceptions.PatroniException`: if :exc:`psycopg.Error` occurred. """ try: conn = psycopg.connect(dsn=self.dsn, @@ -439,7 +439,7 @@ class RunningClusterConfigGenerator(AbstractConfigGenerator): are located outside of ``PGDATA`` and Patroni doesn't have write permissions for them. :raises: - :exc:`~patroni.exceptions.PatroniException`: if :exc:`OSError` occured during the conf files handling. + :exc:`~patroni.exceptions.PatroniException`: if :exc:`OSError` occurred during the conf files handling. """ default_hba_path = os.path.join(self.config['postgresql']['data_dir'], 'pg_hba.conf') if self.config['postgresql']['parameters']['hba_file'] == default_hba_path: diff --git a/patroni/ctl.py b/patroni/ctl.py index 73d0614a..d775c6ad 100644 --- a/patroni/ctl.py +++ b/patroni/ctl.py @@ -301,7 +301,7 @@ def ctl(ctx: click.Context, config_file: str, dcs_url: Optional[str], insecure: .. note:: Besides *dcs_url* and *insecure*, which are used to override DCS configuration section and ``ctl.insecure`` setting, you can also override the value of ``log.level``, by default ``WARNING``, through either of these - environemnt variables: + environment variables: * ``LOGLEVEL`` * ``PATRONI_LOGLEVEL`` * ``PATRONI_LOG_LEVEL`` @@ -310,7 +310,7 @@ def ctl(ctx: click.Context, config_file: str, dcs_url: Optional[str], insecure: :param config_file: path to the configuration file. :param dcs_url: the DCS URL in the format ``DCS://HOST:PORT``, e.g. ``etcd3://random.com:2399``. If given override whatever DCS is set in the configuration file. - :param insecure: if ``True`` allow SSL connections without client certiticates. Override what is configured through + :param insecure: if ``True`` allow SSL connections without client certificates. Override what is configured through ``ctl.insecure` in the configuration file. """ level = 'WARNING' @@ -965,7 +965,7 @@ def check_response(response: urllib3.response.HTTPResponse, member_name: str, :param action_name: action associated with the *response*. :param silent_success: if a status message should be skipped upon a successful *response*. - :returns: ``True`` if the response indicates a sucessful operation (HTTP status < ``400``), ``False`` otherwise. + :returns: ``True`` if the response indicates a successful operation (HTTP status < ``400``), ``False`` otherwise. """ if response.status >= 400: click.echo('Failed: {0} for member {1}, status code={2}, ({3})'.format( @@ -1429,7 +1429,7 @@ def generate_topology(level: int, member: Dict[str, Any], + postgresql2 :param level: the current level being inspected in the *topology*. - :param member: information about the current member being inspected in *level* of *topology*. Should countain at + :param member: information about the current member being inspected in *level* of *topology*. Should contain at least this key: * ``name``: name of the node, according to ``name`` configuration; @@ -1456,7 +1456,7 @@ def generate_topology(level: int, member: Dict[str, Any], def topology_sort(members: List[Dict[str, Any]]) -> Iterator[Dict[str, Any]]: """Sort *members* according to their level in the replication topology tree. - :param members: list of members in the cluster. Each item should countain at least these keys: + :param members: list of members in the cluster. Each item should contain at least these keys: * ``name``: name of the node, according to ``name`` configuration; * ``role``: ``leader``, ``standby_leader`` or ``replica``. @@ -2023,7 +2023,7 @@ def invoke_editor(before_editing: str, cluster_name: str) -> Tuple[str, Dict[str .. note:: Requires an editor program, and uses first found among: - * Program given by ``EDITOR`` environemnt variable; or + * Program given by ``EDITOR`` environment variable; or * ``editor``; or * ``vi``. diff --git a/patroni/daemon.py b/patroni/daemon.py index e160ce46..d4cce10e 100644 --- a/patroni/daemon.py +++ b/patroni/daemon.py @@ -132,7 +132,7 @@ class AbstractPatroniDaemon(abc.ABC): """Run the daemon process. Start the logger thread and keep running execution cycles until a SIGTERM is eventually received. Also reload - configuration uppon receiving SIGHUP. + configuration upon receiving SIGHUP. """ self.logger.start() while not self.received_sigterm: diff --git a/patroni/dcs/__init__.py b/patroni/dcs/__init__.py index 144f2cdd..4a351642 100644 --- a/patroni/dcs/__init__.py +++ b/patroni/dcs/__init__.py @@ -1162,7 +1162,7 @@ class Cluster(NamedTuple('Cluster', return {} # we always want to exclude the member with our name from the list, - # also exlude members with disabled WAL streaming + # also exclude members with disabled WAL streaming members = filter(lambda m: m.name != name and not m.nostream, self.members) def leader_filter(member: Member) -> bool: diff --git a/patroni/dcs/consul.py b/patroni/dcs/consul.py index 9799c6c1..f1ce0980 100644 --- a/patroni/dcs/consul.py +++ b/patroni/dcs/consul.py @@ -682,7 +682,7 @@ class Consul(AbstractDCS): def set_sync_state_value(self, value: str, version: Optional[int] = None) -> Union[int, bool]: retry = self._retry.copy() ret = retry(self._client.kv.put, self.sync_path, value, cas=version) - if ret: # We have no other choise, only read after write :( + if ret: # We have no other choice, only read after write :( if not retry.ensure_deadline(0.5): return False _, ret = self.retry(self._client.kv.get, self.sync_path, consistency='consistent') diff --git a/patroni/dcs/kubernetes.py b/patroni/dcs/kubernetes.py index b2b54b28..4b9cedef 100644 --- a/patroni/dcs/kubernetes.py +++ b/patroni/dcs/kubernetes.py @@ -1050,7 +1050,7 @@ class Kubernetes(AbstractDCS): return False def __target_ref(self, leader_ip: str, latest_subsets: List[K8sObject], pod: K8sObject) -> K8sObject: - # we want to re-use existing target_ref if possible + # we want to reuse existing target_ref if possible empty_addresses: List[K8sObject] = [] for subset in latest_subsets: for address in subset.addresses or empty_addresses: diff --git a/patroni/ha.py b/patroni/ha.py index f08d6483..3b2c7d6e 100644 --- a/patroni/ha.py +++ b/patroni/ha.py @@ -608,7 +608,7 @@ class Ha(object): - postgres was running as ``replica`` wasn't ``shut down in recovery`` (cleanly) and we need to run ``pg_rewind`` to join back to the cluster. - - ``pg_rewind`` is executed if it is necessary, or optinally, the data directory could + - ``pg_rewind`` is executed if it is necessary, or optionally, the data directory could be removed if it is allowed by configuration. - after ``crash recovery`` and/or ``pg_rewind`` are executed, postgres is started in recovery. @@ -1225,7 +1225,7 @@ class Ha(object): members = [RemoteMember(name, {'api_url': url}) for name, url in failsafe.items() if name != self.state_handler.name] - if not members: # A sinlge node cluster + if not members: # A single node cluster return True pool = ThreadPool(len(members)) call_failsafe_member = functools.partial(self.call_failsafe_member, data) @@ -2389,7 +2389,7 @@ class Ha(object): :param exclude_failover_candidate: if ``True``, exclude :attr:`failover.candidate` from the candidates. - :returns: a list of :class:`Member` ojects or an empty list if there is no candidate available. + :returns: a list of :class:`Member` objects or an empty list if there is no candidate available. """ failover = self.cluster.failover exclude = [self.state_handler.name] + ([failover.candidate] if failover and exclude_failover_candidate else []) diff --git a/patroni/postgresql/__init__.py b/patroni/postgresql/__init__.py index 33a6cc4b..93bafd7d 100644 --- a/patroni/postgresql/__init__.py +++ b/patroni/postgresql/__init__.py @@ -302,7 +302,7 @@ class Postgresql(object): def pg_isready(self) -> str: """Runs pg_isready to see if PostgreSQL is accepting connections. - :returns: 'ok' if PostgreSQL is up, 'reject' if starting up, 'no_resopnse' if not up.""" + :returns: 'ok' if PostgreSQL is up, 'reject' if starting up, 'no_response' if not up.""" r = self.connection_pool.conn_kwargs cmd = [self.pgcommand('pg_isready'), '-p', r['port'], '-d', self._database] @@ -540,7 +540,7 @@ class Postgresql(object): """Figure out the replication state from input parameters. .. note:: - This method could be only called when Postgres is up, running and queries are successfuly executed. + This method could be only called when Postgres is up, running and queries are successfully executed. :is_primary: `True` is postgres is not running in recovery :receiver_state: value from `pg_stat_get_wal_receiver.state` or None if Postgres is older than 9.6 @@ -830,7 +830,7 @@ class Postgresql(object): cur.execute('CHECKPOINT') except psycopg.Error: logger.exception('Exception during CHECKPOINT') - return 'not accessible or not healty' + return 'not accessible or not healthy' def stop(self, mode: str = 'fast', block_callbacks: bool = False, checkpoint: Optional[bool] = None, on_safepoint: Optional[Callable[..., Any]] = None, on_shutdown: Optional[Callable[[int, int], Any]] = None, diff --git a/patroni/postgresql/bootstrap.py b/patroni/postgresql/bootstrap.py index 99d09b6f..c0606b4e 100644 --- a/patroni/postgresql/bootstrap.py +++ b/patroni/postgresql/bootstrap.py @@ -447,7 +447,7 @@ END;$$""".format(f, quote_ident(rewind['username'], postgresql.connection())) if config.get('users'): logger.error('User creation is not be supported starting from v4.0.0. ' - 'Please use "boostrap.post_bootstrap" script to create users.') + 'Please use "bootstrap.post_bootstrap" script to create users.') # We were doing a custom bootstrap instead of running initdb, therefore we opened trust # access from certain addresses to be able to reach cluster and change password diff --git a/patroni/postgresql/config.py b/patroni/postgresql/config.py index 55d4176f..89b7af49 100644 --- a/patroni/postgresql/config.py +++ b/patroni/postgresql/config.py @@ -279,7 +279,7 @@ def get_param_diff(old_value: Any, new_value: Any, """Get a dictionary representing a single PG parameter's value diff. :param old_value: current :class:`str` parameter value. - :param new_value: :class:`str` value of the paramater after a restart. + :param new_value: :class:`str` value of the parameter after a restart. :param vartype: the target type to parse old/new_value. See ``vartype`` argument of :func:`~patroni.utils.maybe_convert_from_base_unit`. :param unit: unit of *old/new_value*. See ``base_unit`` argument of @@ -376,7 +376,7 @@ class ConfigHandler(object): # We also want to load current settings of recovery parameters, including primary_conninfo # and primary_slot_name, otherwise patronictl restart will update postgresql.conf # and remove them, what in the worst case will cause another restart. - # We are doing it only for PostgresSQL v12 onwards, because older version still have recovery.conf + # We are doing it only for PostgreSQL v12 onwards, because older version still have recovery.conf if not self._postgresql.is_primary() and self._postgresql.major_version >= 120000: # primary_conninfo is expected to be a dict, therefore we need to parse it recovery_params['primary_conninfo'] = parse_dsn(recovery_params.pop('primary_conninfo', '')) or {} @@ -876,7 +876,7 @@ class ConfigHandler(object): and not self._postgresql.cb_called and not self._postgresql.is_starting())} - def record_missmatch(mtype: bool) -> None: + def record_mismatch(mtype: bool) -> None: required['restart' if mtype else 'reload'] += 1 wanted_recovery_params = self.build_recovery_params(member) @@ -889,16 +889,16 @@ class ConfigHandler(object): continue if param == 'recovery_min_apply_delay': if not compare_values('integer', 'ms', value[0], wanted_recovery_params.get(param, 0)): - record_missmatch(value[1]) + record_mismatch(value[1]) elif param == 'standby_mode': if not compare_values('bool', None, value[0], wanted_recovery_params.get(param, 'on')): - record_missmatch(value[1]) + record_mismatch(value[1]) elif param == 'primary_conninfo': if not self._check_primary_conninfo(value[0], wanted_recovery_params.get('primary_conninfo', {})): - record_missmatch(value[1]) + record_mismatch(value[1]) elif (param != 'primary_slot_name' or wanted_recovery_params.get('primary_conninfo')) \ and str(value[0]) != str(wanted_recovery_params.get(param, '')): - record_missmatch(value[1]) + record_mismatch(value[1]) return required['restart'] + required['reload'] > 0, required['restart'] > 0 @staticmethod @@ -1030,7 +1030,7 @@ class ConfigHandler(object): if parameters.get('wal_level') == ('hot_standby' if self._postgresql.major_version >= 90600 else 'replica'): parameters['wal_level'] = 'replica' if self._postgresql.major_version >= 90600 else 'hot_standby' - # Try to recalcualte wal_keep_segments <-> wal_keep_size assuming that typical wal_segment_size is 16MB. + # Try to recalculate wal_keep_segments <-> wal_keep_size assuming that typical wal_segment_size is 16MB. # The real segment size could be estimated from pg_control, but we don't really care, because the only goal of # this exercise is improving cross version compatibility and user must set the correct parameter in the config. if self._postgresql.major_version >= 130000: @@ -1084,7 +1084,7 @@ class ConfigHandler(object): ``postgresql.parameters.unix_socket_directories``, we omit a ``host`` in connection parameters relying on the ability of ``libpq`` to connect via some default unix socket directory. - If unix sockets are not requested we "switch" to TCP, prefering to use ``localhost`` if it is possible + If unix sockets are not requested we "switch" to TCP, preferring to use ``localhost`` if it is possible to deduce that Postgres is listening on a local interface address. Otherwise we just used the first address specified in the ``listen_addresses`` GUC. diff --git a/patroni/postgresql/connection.py b/patroni/postgresql/connection.py index b48d1da1..268f6303 100644 --- a/patroni/postgresql/connection.py +++ b/patroni/postgresql/connection.py @@ -75,7 +75,7 @@ class NamedConnection: return cursor.fetchall() if cursor.rowcount and cursor.rowcount > 0 else [] except psycopg.Error as exc: if cursor and cursor.connection.closed == 0: - # When connected via unix socket, psycopg2 can't recoginze 'connection lost' and leaves + # When connected via unix socket, psycopg2 can't recognize 'connection lost' and leaves # `self._connection.closed == 0`, but the generic exception is raised. It doesn't make # sense to continue with existing connection and we will close it, to avoid its reuse. if type(exc) in (psycopg.DatabaseError, psycopg.OperationalError): diff --git a/patroni/postgresql/mpp/citus.py b/patroni/postgresql/mpp/citus.py index 9b7bf906..fe945084 100644 --- a/patroni/postgresql/mpp/citus.py +++ b/patroni/postgresql/mpp/citus.py @@ -112,7 +112,7 @@ class PgDistGroup(Set[PgDistNode]): """Creates a :class:`PgDistGroup` object based on given arguments. :param groupid: the groupid from "pg_dist_node". - :param nodes: a collection of :class:`PgDistNode` objects that belog to a *groupid*. + :param nodes: a collection of :class:`PgDistNode` objects that belong to a *groupid*. """ self.failover = False self.groupid = groupid @@ -315,7 +315,7 @@ class PgDistTask(PgDistGroup): """Create a :class:`PgDistTask` object based on given arguments. :param groupid: the groupid from "pg_dist_node". - :param nodes: a collection of :class:`PgDistNode` objects that belog to a *groupid*. + :param nodes: a collection of :class:`PgDistNode` objects that belong to a *groupid*. :param event: an "event" that resulted in creating this task. :param timeout: a transaction timeout if the task resulted in starting a transaction. :param cooldown: the cooldown value for ``citus_update_node()`` UDF call. @@ -460,7 +460,7 @@ class CitusHandler(Citus, AbstractMPPHandler, Thread): We can't always rely on REST API calls from worker nodes in order to maintain `pg_dist_node`, therefore at least once per heartbeat - loop we make sure that workes registered in `self._pg_dist_group` + loop we make sure that works registered in `self._pg_dist_group` cache are matching the cluster view from DCS by creating tasks the same way as it is done from the REST API.""" @@ -554,7 +554,7 @@ class CitusHandler(Citus, AbstractMPPHandler, Thread): Read access to `self._in_flight` isn't protected because we know it can't be changed outside of our thread. :param task: reference to a :class:`PgDistTask` object that represents a row to be updated/created. - :returns: ``True`` if the row was succesfully created/updated or transaction in progress + :returns: ``True`` if the row was successfully created/updated or transaction in progress was committed as an indicator that the `self._pg_dist_group` cache should be updated, or, if the new transaction was opened, this method returns `False`. """ diff --git a/patroni/postgresql/rewind.py b/patroni/postgresql/rewind.py index 762e65e2..ee8e801f 100644 --- a/patroni/postgresql/rewind.py +++ b/patroni/postgresql/rewind.py @@ -99,7 +99,7 @@ class Rewind(object): return 'leader has not run a checkpoint yet' except Exception: logger.exception('Exception when working with leader') - return 'not accessible or not healty' + return 'not accessible or not healthy' def _get_checkpoint_end(self, timeline: int, lsn: int) -> int: """Get the end of checkpoint record from WAL. @@ -317,7 +317,7 @@ class Rewind(object): def checkpoint_after_promote(self) -> bool: return self._state == REWIND_STATUS.CHECKPOINT - def _buid_archiver_command(self, command: str, wal_filename: str) -> str: + def _build_archiver_command(self, command: str, wal_filename: str) -> str: """Replace placeholders in the given archiver command's template. Applicable for archive_command and restore_command. Can also be used for archive_cleanup_command and recovery_end_command, @@ -346,7 +346,7 @@ class Rewind(object): return cmd def _fetch_missing_wal(self, restore_command: str, wal_filename: str) -> bool: - cmd = self._buid_archiver_command(restore_command, wal_filename) + cmd = self._build_archiver_command(restore_command, wal_filename) logger.info('Trying to fetch the missing wal: %s', cmd) return self._postgresql.cancellable.call(shlex.split(cmd)) == 0 @@ -385,9 +385,9 @@ class Rewind(object): # skip fsync, as postgres --single or pg_rewind will anyway run it for wal in sorted(wals_to_archive): old_name = os.path.join(status_dir, wal + '.ready') - # wal file might have alredy been archived + # wal file might have already been archived if os.path.isfile(old_name) and os.path.isfile(os.path.join(self._postgresql.wal_dir, wal)): - cmd = self._buid_archiver_command(archive_cmd, wal) + cmd = self._build_archiver_command(archive_cmd, wal) # it is the author of archive_command, who is responsible # for not overriding the WALs already present in archive logger.info('Trying to archive %s: %s', wal, cmd) @@ -509,7 +509,7 @@ class Rewind(object): if not self.can_rewind: # It is possible that the previous attempt damaged pg_control file! self._state = REWIND_STATUS.FAILED else: - logger.error('Failed to rewind from healty primary: %s', leader.name) + logger.error('Failed to rewind from healthy primary: %s', leader.name) self._state = REWIND_STATUS.FAILED if self.failed: diff --git a/patroni/postgresql/sync.py b/patroni/postgresql/sync.py index b49756be..14778e95 100644 --- a/patroni/postgresql/sync.py +++ b/patroni/postgresql/sync.py @@ -92,27 +92,27 @@ def parse_sync_standby_names(value: str) -> _SSN: >>> parse_sync_standby_names('1') # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... - ValueError: Unparseable synchronous_standby_names value + ValueError: Unparsable synchronous_standby_names value >>> parse_sync_standby_names('a,') # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... - ValueError: Unparseable synchronous_standby_names value + ValueError: Unparsable synchronous_standby_names value >>> parse_sync_standby_names('ANY 4("a" b,"c c")') # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... - ValueError: Unparseable synchronous_standby_names value + ValueError: Unparsable synchronous_standby_names value >>> parse_sync_standby_names('FIRST 4("a",)') # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... - ValueError: Unparseable synchronous_standby_names value + ValueError: Unparsable synchronous_standby_names value >>> parse_sync_standby_names('2 (,)') # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... - ValueError: Unparseable synchronous_standby_names value + ValueError: Unparsable synchronous_standby_names value """ tokens = [(m.lastgroup, m.group(0), m.start()) for m in SYNC_REP_PARSER_RE.finditer(value) @@ -142,10 +142,10 @@ def parse_sync_standby_names(value: str) -> _SSN: for i, (a_type, a_value, a_pos) in enumerate(synclist): if i % 2 == 1: # odd elements are supposed to be commas if len(synclist) == i + 1: # except the last token - raise ValueError("Unparseable synchronous_standby_names value %r: Unexpected token %s %r at %d" % + raise ValueError("Unparsable synchronous_standby_names value %r: Unexpected token %s %r at %d" % (value, a_type, a_value, a_pos)) if a_type != 'comma': - raise ValueError("Unparseable synchronous_standby_names value %r: ""Got token %s %r while" + raise ValueError("Unparsable synchronous_standby_names value %r: ""Got token %s %r while" " expecting comma at %d" % (value, a_type, a_value, a_pos)) elif a_type in {'ident', 'first', 'any'}: members.add(a_value) @@ -155,7 +155,7 @@ def parse_sync_standby_names(value: str) -> _SSN: elif a_type == 'dquot': members.add(a_value[1:-1].replace('""', '"')) else: - raise ValueError("Unparseable synchronous_standby_names value %r: Unexpected token %s %r at %d" % + raise ValueError("Unparsable synchronous_standby_names value %r: Unexpected token %s %r at %d" % (value, a_type, a_value, a_pos)) return _SSN(sync_type, has_star, num, members) @@ -203,7 +203,7 @@ class _ReplicaList(List[_Replica]): Values are reverse ordered by ``_Replica.sync_state`` and ``_Replica.lsn``. That is, first there will be replicas that have ``sync_state`` == ``sync``, even if they are not - the most up-to-date in term of write/flush/replay LSN. It helps to keep the result of chosing new + the most up-to-date in term of write/flush/replay LSN. It helps to keep the result of choosing new synchronous nodes consistent in case if a synchronous standby member is slowed down OR async node is receiving changes faster than the sync member. Such cases would trigger sync standby member swapping, but only if lag on this member is exceeding a threshold (``maximum_lag_on_syncnode``). @@ -413,7 +413,7 @@ END;$$""") and self._postgresql.state == 'running' and self._postgresql.is_primary()) or has_asterisk: return - time.sleep(0.1) # Usualy it takes 1ms to reload postgresql.conf, but we will give it 100ms + time.sleep(0.1) # Usually it takes 1ms to reload postgresql.conf, but we will give it 100ms # Reset internal cache to query fresh values self._postgresql.reset_cluster_info_state(None) diff --git a/patroni/validator.py b/patroni/validator.py index c3369621..cb7b6452 100644 --- a/patroni/validator.py +++ b/patroni/validator.py @@ -439,7 +439,7 @@ class Or(object): class AtMostOne(object): - """Mark that at most one option from a :class:`Case` can be suplied. + """Mark that at most one option from a :class:`Case` can be supplied. Represents a list of possible configuration options in a given scope, where at most one can actually be provided. diff --git a/tests/test_aws.py b/tests/test_aws.py index f63f188c..d5e8ea20 100644 --- a/tests/test_aws.py +++ b/tests/test_aws.py @@ -63,7 +63,7 @@ class TestAWSConnection(unittest.TestCase): self.assertFalse(conn.on_role_change("primary")) @patch.object(botocore.awsrequest.AWSResponse, 'text', PropertyMock(return_value='boo')) - def test_aws_bizare_response(self): + def test_aws_bizarre_response(self): conn = AWSConnection('test') self.assertFalse(conn.aws_available()) diff --git a/tests/test_bootstrap.py b/tests/test_bootstrap.py index d93e312c..60004dc6 100644 --- a/tests/test_bootstrap.py +++ b/tests/test_bootstrap.py @@ -258,7 +258,7 @@ class TestBootstrap(BaseTestPostgresql): self.b.post_bootstrap({'users': 1}, task) self.assertEqual(mock_logger.call_args_list[0][0][0], 'User creation is not be supported starting from v4.0.0. ' - 'Please use "boostrap.post_bootstrap" script to create users.') + 'Please use "bootstrap.post_bootstrap" script to create users.') self.assertTrue(task.result) self.b.bootstrap(config) diff --git a/tests/test_citus.py b/tests/test_citus.py index 42cf6d2f..0389f07a 100644 --- a/tests/test_citus.py +++ b/tests/test_citus.py @@ -98,7 +98,7 @@ class TestCitus(BaseTestPostgresql): self.c.add_task('after_promote', 0, self.cluster, self.cluster.leader_name, 'postgres://host1:5432/postgres') with patch.object(CitusHandler, 'update_node') as mock_update_node: self.c.process_tasks() - # process_task() shouln't be called because pick_task double checks with _pg_dist_group + # process_task() shouldn't be called because pick_task double checks with _pg_dist_group mock_update_node.assert_not_called() def test_process_task(self): diff --git a/tests/test_config_generator.py b/tests/test_config_generator.py index 7e0e14ef..1fab6e04 100644 --- a/tests/test_config_generator.py +++ b/tests/test_config_generator.py @@ -337,7 +337,7 @@ class TestGenerateConfig(unittest.TestCase): _main() self.assertIn('Failed to read pg_ident.conf', e.exception.code) - # 9. Failed PG connecttion + # 9. Failed PG connection from . import psycopg with patch('patroni.psycopg.connect', side_effect=psycopg.Error), \ self.assertRaises(SystemExit) as e: diff --git a/tests/test_ha.py b/tests/test_ha.py index 3f03e4b4..9b6f90b6 100644 --- a/tests/test_ha.py +++ b/tests/test_ha.py @@ -1587,7 +1587,7 @@ class TestHa(PostgresInit): self.ha.cluster = get_cluster_initialized_with_leader() self.ha.watch(0) - def test_wakup(self): + def test_wakeup(self): self.ha.wakeup() def test_shutdown(self): diff --git a/tests/test_postgresql.py b/tests/test_postgresql.py index 19ab2968..b811ff25 100644 --- a/tests/test_postgresql.py +++ b/tests/test_postgresql.py @@ -274,7 +274,7 @@ class TestPostgresql(BaseTestPostgresql): self.assertEqual(self.p.checkpoint({'user': 'postgres'}), 'is_in_recovery=true') with patch.object(MockCursor, 'execute', Mock(return_value=None)): self.assertIsNone(self.p.checkpoint()) - self.assertEqual(self.p.checkpoint(timeout=10), 'not accessible or not healty') + self.assertEqual(self.p.checkpoint(timeout=10), 'not accessible or not healthy') @patch('patroni.postgresql.config.mtime', mock_mtime) @patch('patroni.postgresql.config.ConfigHandler._get_pg_settings') diff --git a/tests/test_quorum.py b/tests/test_quorum.py index 2ae380fe..3e2d20d2 100644 --- a/tests/test_quorum.py +++ b/tests/test_quorum.py @@ -264,7 +264,7 @@ class QuorumTest(unittest.TestCase): self.check_state_transitions(leader=leader, quorum=2, voters=set('bcde'), numsync=2, sync=set('bcde'), numsync_confirmed=2, active=set('bcd'), sync_wanted=3, leader_wanted=leader, expected=[ - # node e removed from sync wth replication factor increase + # node e removed from sync with replication factor increase ('sync', leader, 3, set('bcd')), # node e removed from voters with quorum decrease ('quorum', leader, 1, set('bcd')), diff --git a/tests/test_validator.py b/tests/test_validator.py index 82f9fa17..193aae10 100644 --- a/tests/test_validator.py +++ b/tests/test_validator.py @@ -235,7 +235,7 @@ class TestValidator(unittest.TestCase): self.assertEqual(['consul.host', 'etcd.host', 'postgresql.bin_dir', 'postgresql.data_dir', 'postgresql.listen', 'raft.bind_addr', 'raft.self_addr', 'restapi.connect_address'], parse_output(output)) - def test_bin_dir_is_empty_string_excutables_in_path(self, mock_out, mock_err): + def test_bin_dir_is_empty_string_executables_in_path(self, mock_out, mock_err): binaries.extend(required_binaries) c = copy.deepcopy(config) c["postgresql"]["bin_dir"] = "" @@ -259,7 +259,7 @@ class TestValidator(unittest.TestCase): self.assertEqual(['raft.bind_addr', 'raft.self_addr'], parse_output(output)) @patch('subprocess.check_output', Mock(return_value=b"postgres (PostgreSQL) 12.1")) - def test_pg_version_missmatch(self, mock_out, mock_err): + def test_pg_version_mismatch(self, mock_out, mock_err): directories.append(config["postgresql"]["data_dir"]) directories.append(config["postgresql"]["bin_dir"]) directories.append(os.path.join(config["postgresql"]["data_dir"], "pg_wal"))