-
Notifications
You must be signed in to change notification settings - Fork 813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make wal_log_hints configurable #3063
Make wal_log_hints configurable #3063
Conversation
Could you give me an advice for test codes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are making an assumption that wal_log_hints are always enabled because it might be required for pg_rewind to work (if Data page checksum
are not enabled) and we want to test that pg_rewind works correctly.
The code implementing pg_rewind support can already handle if wal_log_hints is not set, there is no additional testing required:
patroni/patroni/postgresql/rewind.py
Line 41 in ff99d29
return data.get('wal_log_hints setting', 'off') == 'on' or data.get('Data page checksum version', '0') != '0' |
What is actually required - fixing the documentation and writing in all places where pg_rewind is mentioned, that either the cluster must be initialized with Data page checksums
(--data-checksums
option for initdb
) and/or wal_log_hints
must be set to on
, or pg_rewind will not work. Having wal_log_hints
enabled in addition to Data page checksums
doesn't create any overhead.
P.S. it is highly recommended to have Data page checksums
enabled.
patroni/config_generator.py
Outdated
self.config['bootstrap']['dcs']['postgresql']['use_pg_rewind'] = True \ | ||
if self.config['bootstrap']['dcs']['postgresql']['parameters']['wal_log_hints'] == "on" else False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.config['bootstrap']['dcs']['postgresql']['use_pg_rewind'] = True \ | |
if self.config['bootstrap']['dcs']['postgresql']['parameters']['wal_log_hints'] == "on" else False | |
self.config['bootstrap']['dcs']['postgresql']['use_pg_rewind'] = \ | |
parse_bool(self.config['bootstrap']['dcs']['postgresql']['parameters']['wal_log_hints']) is True |
But, TBH there is no need to do that, because we are not changing the default value of wal_log_hints
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will fix it 👍
Do you want me to add the following contents as comments?
I will commit an example for your request. Check plz. |
…he value of wal_log_hints
…ecomes configurable
@CyberDem0n |
docs/dynamic_configuration.rst
Outdated
@@ -30,7 +30,7 @@ In order to change the dynamic configuration you can use either :ref:`patronictl | |||
- **failsafe\_mode**: Enables :ref:`DCS Failsafe Mode <dcs_failsafe_mode>`. Defaults to `false`. | |||
- **postgresql**: | |||
|
|||
- **use\_pg\_rewind**: whether or not to use pg_rewind. Defaults to `false`. | |||
- **use\_pg\_rewind**: whether or not to use pg_rewind. Defaults to `false`. Note that either the cluster must be initialized with Data page checksums (--data-checksums option for initdb) and/or wal_log_hints must be set to on, or pg_rewind will not work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- **use\_pg\_rewind**: whether or not to use pg_rewind. Defaults to `false`. Note that either the cluster must be initialized with Data page checksums (--data-checksums option for initdb) and/or wal_log_hints must be set to on, or pg_rewind will not work. | |
- **use\_pg\_rewind**: whether or not to use pg_rewind. Defaults to `false`. Note that either the cluster must be initialized with ``data page checksums`` (``--data-checksums`` option for ``initdb``) and/or ``wal_log_hints`` must be set to ``on``, or ``pg_rewind`` will not work. |
Please also change other occurrences.
docs/ha_multi_dc.rst
Outdated
|
||
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated change
docs/replication_modes.rst
Outdated
|
||
|
||
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests/test_config_generator.py
Outdated
@@ -56,7 +56,8 @@ def setUp(self): | |||
dynamic_config['postgresql']['parameters'] = dict(dynamic_config['postgresql']['parameters']) | |||
del dynamic_config['standby_cluster'] | |||
dynamic_config['postgresql']['parameters']['wal_keep_segments'] = 8 | |||
dynamic_config['postgresql']['use_pg_rewind'] = True | |||
dynamic_config['postgresql']['use_pg_rewind'] = True \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the construction similar to https://github.com/zalando/patroni/pull/3063/files#diff-cfee4a0506f1e512ce4c1fb59d7f7bac2f7924ad20e7d6a679044f4c5f4d6c88R271-R272
…he value of wal_log_hints
@CyberDem0n |
@@ -325,7 +325,7 @@ class ConfigHandler(object): | |||
'track_commit_timestamp': ('off', _bool_validator, 90500), | |||
'max_replication_slots': (10, IntValidator(min=4), 90400), | |||
'max_worker_processes': (8, IntValidator(min=2), 90400), | |||
'wal_log_hints': ('on', _bool_is_true_validator, 90400) | |||
'wal_log_hints': ('on', _bool_validator, 90400) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
patroni/patroni/postgresql/config.py
Line 1104 in ff31f45
params_skip_changes = CaseInsensitiveSet((*self._RECOVERY_PARAMETERS, 'hot_standby', 'wal_log_hints')) |
we should also remove wal_log_hints
from here, as it is now configurable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx for review :)
@CyberDem0n @hughcapet |
Pull Request Test Coverage Report for Build 9185084497Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
👍 |
1 similar comment
👍 |
resolve #1942