From 75e52226a848d64317ac98264234e62706fd762c Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 6 Jul 2021 10:01:30 +0200 Subject: [PATCH] Fix typos discovered by codespell (#1997) --- README.rst | 2 +- docs/README.rst | 2 +- docs/SETTINGS.rst | 2 +- docs/releases.rst | 22 +++++++++++----------- docs/rest_api.rst | 2 +- features/environment.py | 2 +- patroni/api.py | 2 +- patroni/config.py | 2 +- patroni/dcs/__init__.py | 2 +- patroni/dcs/consul.py | 2 +- patroni/ha.py | 2 +- patroni/postgresql/__init__.py | 2 +- patroni/postgresql/bootstrap.py | 2 +- patroni/postgresql/cancellable.py | 2 +- patroni/postgresql/config.py | 6 +++--- patroni/postgresql/misc.py | 2 +- patroni/postgresql/rewind.py | 2 +- patroni/scripts/wale_restore.py | 4 ++-- tests/test_ha.py | 2 +- 19 files changed, 32 insertions(+), 32 deletions(-) diff --git a/README.rst b/README.rst index b26cfafe..e40abb76 100644 --- a/README.rst +++ b/README.rst @@ -119,7 +119,7 @@ For example, the command in order to install Patroni together with dependencies pip install patroni[etcd,aws] -Note that external tools to call in the replica creation or custom bootstap scripts (i.e. WAL-E) should be installed independently of Patroni. +Note that external tools to call in the replica creation or custom bootstrap scripts (i.e. WAL-E) should be installed independently of Patroni. ======================= Running and Configuring diff --git a/docs/README.rst b/docs/README.rst index f0aab0fd..ee8f0c20 100644 --- a/docs/README.rst +++ b/docs/README.rst @@ -166,7 +166,7 @@ When connecting from an application, always use a non-superuser. Patroni require Testing Your HA Solution -------------------------------------- -Testing an HA solution is a time consuming process, with many variables. This is particularly true considering a cross-platform application. You need a trained system administrator or a consultant to do this work. It is not something we can cover in depth in the documentaiton. +Testing an HA solution is a time consuming process, with many variables. This is particularly true considering a cross-platform application. You need a trained system administrator or a consultant to do this work. It is not something we can cover in depth in the documentation. That said, here are some pieces of your infrastructure you should be sure to test: diff --git a/docs/SETTINGS.rst b/docs/SETTINGS.rst index 64428f38..89400b03 100644 --- a/docs/SETTINGS.rst +++ b/docs/SETTINGS.rst @@ -228,7 +228,7 @@ Raft - Q: Where to get the ``syncobj_admin`` utility? - A: It is installed together with ``pysyncobj`` module (python RAFT implementation), which is Patroni dependancy. + A: It is installed together with ``pysyncobj`` module (python RAFT implementation), which is Patroni dependency. - Q: it is possible to run Patroni node without adding in to the consensus? diff --git a/docs/releases.rst b/docs/releases.rst index 6d484c4f..ea312ed0 100644 --- a/docs/releases.rst +++ b/docs/releases.rst @@ -682,7 +682,7 @@ Version 1.6.1 - Some improvements in logging infrastructure (Alexander Kukushkin) - Previously threre was a possibility to loose the last few log lines on shutdown because the logging thread was a ``daemon`` thread. + Previously there was a possibility to loose the last few log lines on shutdown because the logging thread was a ``daemon`` thread. - Use ``spawn`` multiprocessing start method on python 3.4+ (Maciej Kowalczyk) @@ -732,7 +732,7 @@ Version 1.6.1 If the method is executed from the REST API thread, it requires a separate cursor object to be created. -- Fix the problem of not promoting the sync standby that had a name contaning upper case letters (Alexander Kukushkin) +- Fix the problem of not promoting the sync standby that had a name containing upper case letters (Alexander Kukushkin) We converted the name to the lower case because Postgres was doing the same while comparing the ``application_name`` with the value in ``synchronous_standby_names``. @@ -1008,7 +1008,7 @@ Compatibility and bugfix release. - Fix broken compatibility with postgres 9.3 (Alexander) - When opening a replication connection we should specify replication=1, beacuse 9.3 does not understand replication='database' + When opening a replication connection we should specify replication=1, because 9.3 does not understand replication='database' - Make sure we refresh Consul session at least once per HA loop and improve handling of consul sessions exceptions (Alexander) @@ -1093,7 +1093,7 @@ This version enables Patroni HA cluster to operate in a standby mode, introduces - Immediately reserve the WAL position upon creation of the replication slot (Alexander Kukushkin) - Starting from 9.6, `pg_create_physical_replication_slot` function provides an additional boolean parameter `immediately_reserve`. When it is set to `false`, which is also the default, the slot doesn't reserve the WAL position until it receives the first client connection, potentially losing some segments required by the client in a time window between the slot creation and the intiial client connection. + Starting from 9.6, `pg_create_physical_replication_slot` function provides an additional boolean parameter `immediately_reserve`. When it is set to `false`, which is also the default, the slot doesn't reserve the WAL position until it receives the first client connection, potentially losing some segments required by the client in a time window between the slot creation and the initial client connection. - Fix bug in strict synchronous replication (Alexander Kukushkin) @@ -1333,7 +1333,7 @@ This version adds support for using Kubernetes as a DCS, allowing to run Patroni **Upgrade notice** -Installing Patroni via pip will no longer bring in dependencies for (such as libraries for Etcd, Zookeper, Consul or Kubernetes, or support for AWS). In order to enable them one need to list them in pip install command explicitely, for instance `pip install patroni[etcd,kubernetes]`. +Installing Patroni via pip will no longer bring in dependencies for (such as libraries for Etcd, Zookeper, Consul or Kubernetes, or support for AWS). In order to enable them one need to list them in pip install command explicitly, for instance `pip install patroni[etcd,kubernetes]`. **Kubernetes support** @@ -1352,7 +1352,7 @@ In addition to using Endpoints, Patroni supports ConfigMaps. You can find more i - Remove leader key on shutdown only when we have the lock (Ants) - Unconditional removal was generating unnecessary and missleading exceptions. + Unconditional removal was generating unnecessary and misleading exceptions. **Improvements in patronictl** @@ -1383,7 +1383,7 @@ In addition to using Endpoints, Patroni supports ConfigMaps. You can find more i - Alter the behavior of ``patronictl failover`` (Alexander) - It will work even if there is no leader, but in that case you will have to explicitely specify a node which should become the new leader. + It will work even if there is no leader, but in that case you will have to explicitly specify a node which should become the new leader. **Expose information about timeline and history** @@ -1399,7 +1399,7 @@ In addition to using Endpoints, Patroni supports ConfigMaps. You can find more i - Add new /sync and /async endpoints (Alexander, Oleksii Kliukin) - Those endpoints (also accessible as /synchronous and /asynchronous) return 200 only for synchronous and asynchornous replicas correspondingly (exclusing those marked as `noloadbalance`). + Those endpoints (also accessible as /synchronous and /asynchronous) return 200 only for synchronous and asynchronous replicas correspondingly (exclusing those marked as `noloadbalance`). **Allow multiple hosts for Etcd** @@ -1487,7 +1487,7 @@ Version 1.3.4 - Pass the consul token as a header (Andrew Colin Kissa) - Headers are now the prefered way to pass the token to the consul `API `__. + Headers are now the preferred way to pass the token to the consul `API `__. - Advanced configuration for Consul (Alexander Kukushkin) @@ -1805,7 +1805,7 @@ In addition, patronictl supports new ``pause`` and ``resume`` commands to toggle Originally, ping_timeout and connect_timeout values were calculated from the negotiated session timeout. Patroni loop_wait was not taken into account. As a result, a single retry could take more time than the session timeout, forcing Patroni to release the lock and demote. - This change set ping and connect timeout to half of the value of loop_wait, speeding up detection of connection issues and leaving enough time to retry the connection attempt before loosing the lock. + This change set ping and connect timeout to half of the value of loop_wait, speeding up detection of connection issues and leaving enough time to retry the connection attempt before losing the lock. - Update Etcd topology only after original request succeed (Alexander) @@ -1883,7 +1883,7 @@ When upgrading from v0.90 or below, always upgrade all replicas before the maste See the :ref:`dynamic configuration ` for the details on which parameters can be changed and the order of processing difference configuration sources. - The configuration file format *has changed* since the v0.90. Patroni is still compatible with the old configuration files, but in order to take advantage of the bootstrap parameters one needs to change it. Users are encourage to update them by referring to the :ref:`dynamic configuraton documentation page `. + The configuration file format *has changed* since the v0.90. Patroni is still compatible with the old configuration files, but in order to take advantage of the bootstrap parameters one needs to change it. Users are encourage to update them by referring to the :ref:`dynamic configuration documentation page `. **More flexible configuration*** diff --git a/docs/rest_api.rst b/docs/rest_api.rst index 05d579c9..79b12461 100644 --- a/docs/rest_api.rst +++ b/docs/rest_api.rst @@ -57,7 +57,7 @@ For all health check ``GET`` requests Patroni returns a JSON document with the s - ``GET /liveness``: always returns HTTP status code **200** what only indicates that Patroni is running. Could be used for ``livenessProbe``. -- ``GET /readiness``: returns HTTP status code **200** when the Patroni node is running as the leader or when PostgreSQL is up and running. The endpoint could be used for ``readinessProbe`` when it is not possible to use Kubenetes endpoints for leader elections (OpenShift). +- ``GET /readiness``: returns HTTP status code **200** when the Patroni node is running as the leader or when PostgreSQL is up and running. The endpoint could be used for ``readinessProbe`` when it is not possible to use Kubernetes endpoints for leader elections (OpenShift). Both, ``readiness`` and ``liveness`` endpoints are very light-weight and not executing any SQL. Probes should be configured in such a way that they start failing about time when the leader key is expiring. With the default value of ``ttl``, which is ``30s`` example probes would look like: diff --git a/features/environment.py b/features/environment.py index 130a5bf5..cfa16f04 100644 --- a/features/environment.py +++ b/features/environment.py @@ -869,7 +869,7 @@ class WatchdogMonitor(object): return triggered -# actions to execute on start/stop of the tests and before running invidual features +# actions to execute on start/stop of the tests and before running individual features def before_all(context): os.environ.update({'PATRONI_RESTAPI_USERNAME': 'username', 'PATRONI_RESTAPI_PASSWORD': 'password'}) context.ci = any(a in os.environ for a in ('TRAVIS_BUILD_NUMBER', 'BUILD_NUMBER', 'GITHUB_ACTIONS')) diff --git a/patroni/api.py b/patroni/api.py index e5e2baa9..e5ebb8ef 100644 --- a/patroni/api.py +++ b/patroni/api.py @@ -473,7 +473,7 @@ class RestApiHandler(BaseHTTPRequestHandler): if not cluster.failover: return 503, action.title() + ' failed' except Exception as e: - logger.debug('Exception occured during polling %s result: %s', action, e) + logger.debug('Exception occurred during polling %s result: %s', action, e) return 503, action.title() + ' status unknown' def is_failover_possible(self, cluster, leader, candidate, action): diff --git a/patroni/config.py b/patroni/config.py index ce5b840e..1308cc49 100644 --- a/patroni/config.py +++ b/patroni/config.py @@ -232,7 +232,7 @@ class Config(object): for name, value in (value or {}).items(): if name in self.__DEFAULT_CONFIG['standby_cluster']: config['standby_cluster'][name] = deepcopy(value) - elif name in config: # only variables present in __DEFAULT_CONFIG allowed to be overriden from DCS + elif name in config: # only variables present in __DEFAULT_CONFIG allowed to be overridden from DCS if name in ('synchronous_mode', 'synchronous_mode_strict'): config[name] = value else: diff --git a/patroni/dcs/__init__.py b/patroni/dcs/__init__.py index 9e0e225c..46e3bd74 100644 --- a/patroni/dcs/__init__.py +++ b/patroni/dcs/__init__.py @@ -634,7 +634,7 @@ class AbstractDCS(object): _HISTORY = 'history' _MEMBERS = 'members/' _OPTIME = 'optime' - _STATUS = 'status' # JSON, containts "leader_lsn" and confirmed_flush_lsn of logical "slots" on the leader + _STATUS = 'status' # JSON, contains "leader_lsn" and confirmed_flush_lsn of logical "slots" on the leader _LEADER_OPTIME = _OPTIME + '/' + _LEADER # legacy _SYNC = 'sync' diff --git a/patroni/dcs/consul.py b/patroni/dcs/consul.py index 6c395252..e2a0f749 100644 --- a/patroni/dcs/consul.py +++ b/patroni/dcs/consul.py @@ -111,7 +111,7 @@ class HTTPClient(object): # According to the documentation a small random amount of additional wait time is added to the # supplied maximum wait time to spread out the wake up time of any concurrent requests. This adds # up to wait / 16 additional time to the maximum duration. Since our goal is actually getting a - # response rather read timeout we will add to the timeout a sligtly bigger value. + # response rather read timeout we will add to the timeout a slightly bigger value. kwargs['timeout'] = timeout + max(timeout/15.0, 1) else: kwargs['timeout'] = self._read_timeout diff --git a/patroni/ha.py b/patroni/ha.py index 42237d9b..52745110 100644 --- a/patroni/ha.py +++ b/patroni/ha.py @@ -84,7 +84,7 @@ class Ha(object): self._disable_sync = 0 # We need following property to avoid shutdown of postgres when join of Patroni to the postgres - # already running as replica was aborted due to cluster not beeing initialized in DCS. + # already running as replica was aborted due to cluster not being initialized in DCS. self._join_aborted = False # used only in backoff after failing a pre_promote script diff --git a/patroni/postgresql/__init__.py b/patroni/postgresql/__init__.py index b7059d5b..9fd1b660 100644 --- a/patroni/postgresql/__init__.py +++ b/patroni/postgresql/__init__.py @@ -1052,7 +1052,7 @@ class Postgresql(object): Current synchronous standby is always preferred, unless it has disconnected or does not want to be a synchronous standby any longer. - Parameter sync_node_maxlag(maximum_lag_on_syncnode) would help swapping unhealthy sync replica incase + Parameter sync_node_maxlag(maximum_lag_on_syncnode) would help swapping unhealthy sync replica in case if it stops responding (or hung). Please set the value high enough so it won't unncessarily swap sync standbys during high loads. Any less or equal of 0 value keep the behavior backward compatible and will not swap. Please note that it will not also swap sync standbys in case where all replicas are hung. diff --git a/patroni/postgresql/bootstrap.py b/patroni/postgresql/bootstrap.py index 2c328718..c52be97d 100644 --- a/patroni/postgresql/bootstrap.py +++ b/patroni/postgresql/bootstrap.py @@ -53,7 +53,7 @@ class Bootstrap(object): error_handler('Error when parsing {0} option {1}: value should be string value' ' or a single key-value pair'.format(tool, opt)) else: - error_handler('{0} options must be list ot dict'.format(tool)) + error_handler('{0} options must be list or dict'.format(tool)) return user_options def _initdb(self, config): diff --git a/patroni/postgresql/cancellable.py b/patroni/postgresql/cancellable.py index 8e46fbfb..09057e8e 100644 --- a/patroni/postgresql/cancellable.py +++ b/patroni/postgresql/cancellable.py @@ -36,7 +36,7 @@ class CancellableExecutor(object): with self._lock: if self._process is not None and self._process.is_running() and not self._process_children: try: - self._process.suspend() # Suspend the process before getting list of childrens + self._process.suspend() # Suspend the process before getting list of children except psutil.Error as e: logger.info('Failed to suspend the process: %s', e.msg) diff --git a/patroni/postgresql/config.py b/patroni/postgresql/config.py index c61a7695..8cae0dfb 100644 --- a/patroni/postgresql/config.py +++ b/patroni/postgresql/config.py @@ -353,7 +353,7 @@ class ConfigHandler(object): def save_configuration_files(self, check_custom_bootstrap=False): """ - copy postgresql.conf to postgresql.conf.backup to be able to retrive configuration files + copy postgresql.conf to postgresql.conf.backup to be able to retrieve configuration files - originally stored as symlinks, those are normally skipped by pg_basebackup - in case of WAL-E basebackup (see http://comments.gmane.org/gmane.comp.db.postgresql.wal-e/239) """ @@ -403,7 +403,7 @@ class ConfigHandler(object): f.write_param(name, value) # when we are doing custom bootstrap we assume that we don't know superuser password # and in order to be able to change it, we are opening trust access from a certain address - # therefore we need to make sure that hba_file is not overriden + # therefore we need to make sure that hba_file is not overridden # after changing superuser password we will "revert" all these "changes" if self._postgresql.bootstrap.running_custom_bootstrap or 'hba_file' not in self._server_parameters: f.write_param('hba_file', self._pg_hba_conf) @@ -884,7 +884,7 @@ class ConfigHandler(object): unix_local_address = {'port': port} unix_socket_directories = self._server_parameters.get('unix_socket_directories') if unix_socket_directories is not None: - # fallback to tcp if unix_socket_directories is set, but there are no sutable values + # fallback to tcp if unix_socket_directories is set, but there are no suitable values unix_local_address['host'] = self._get_unix_local_address(unix_socket_directories) or tcp_local_address tcp_local_address = {'host': tcp_local_address, 'port': port} diff --git a/patroni/postgresql/misc.py b/patroni/postgresql/misc.py index 1d93d3de..3a6faa1c 100644 --- a/patroni/postgresql/misc.py +++ b/patroni/postgresql/misc.py @@ -37,7 +37,7 @@ def postgres_version_to_int(pg_version): raise PostgresException('Invalid PostgreSQL version format: X.Y or X.Y.Z is accepted: {0}'.format(pg_version)) if len(components) == 2: - # new style verion numbers, i.e. 10.1 becomes 100001 + # new style version numbers, i.e. 10.1 becomes 100001 components.insert(1, 0) return int(''.join('{0:02d}'.format(c) for c in components)) diff --git a/patroni/postgresql/rewind.py b/patroni/postgresql/rewind.py index 03784428..506e822f 100644 --- a/patroni/postgresql/rewind.py +++ b/patroni/postgresql/rewind.py @@ -68,7 +68,7 @@ class Rewind(object): def _get_checkpoint_end(self, timeline, lsn): """The checkpoint record size in WAL depends on postgres major version and platform (memory alignment). Hence, the only reliable way to figure out where it ends, read the record from file with the help of pg_waldump - and parse the output. We are trying to read two records, and expect that it wil fail to read the second one: + and parse the output. We are trying to read two records, and expect that it will fail to read the second one: `pg_waldump: fatal: error in WAL record at 0/182E220: invalid record length at 0/182E298: wanted 24, got 0` The error message contains information about LSN of the next record, which is exactly where checkpoint ends.""" diff --git a/patroni/scripts/wale_restore.py b/patroni/scripts/wale_restore.py index b4c70991..055fc204 100755 --- a/patroni/scripts/wale_restore.py +++ b/patroni/scripts/wale_restore.py @@ -250,7 +250,7 @@ class WALERestore(object): diff_in_bytes = 0 break - # if the size of the accumulated WAL segments is more than a certan percentage of the backup size + # if the size of the accumulated WAL segments is more than a certain percentage of the backup size # or exceeds the pre-determined size - pg_basebackup is chosen instead. is_size_thresh_ok = diff_in_bytes < int(threshold_megabytes) * 1048576 threshold_pct_bytes = backup_size * threshold_percent / 100.0 @@ -308,7 +308,7 @@ class WALERestore(object): try: os.mkdir(path) except OSError: - logger.exception("coud not create missing %s directory path", dirname) + logger.exception("could not create missing %s directory path", dirname) return False return True diff --git a/tests/test_ha.py b/tests/test_ha.py index ac520c9c..9f1f0402 100644 --- a/tests/test_ha.py +++ b/tests/test_ha.py @@ -701,7 +701,7 @@ class TestHa(PostgresInit): def test_evaluate_scheduled_restart(self): self.p.postmaster_start_time = Mock(return_value=str(postmaster_start_time)) - # restart already in progres + # restart already in progress with patch('patroni.async_executor.AsyncExecutor.busy', PropertyMock(return_value=True)): self.assertIsNone(self.ha.evaluate_scheduled_restart()) # restart while the postmaster has been already restarted, fails