Skip to content
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

Merged
merged 9 commits into from
May 24, 2024

Conversation

sundongkim-dev
Copy link
Contributor

resolve #1942

@sundongkim-dev sundongkim-dev marked this pull request as ready for review May 12, 2024 09:10
@pol-o
Copy link

pol-o commented May 13, 2024

Could you give me an advice for test codes?
All test cases are assuming that 'wal_log_hints' is 'on'. Pretty hard to naming test cases

Copy link
Collaborator

@CyberDem0n CyberDem0n left a 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:

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.

Comment on lines 271 to 272
self.config['bootstrap']['dcs']['postgresql']['use_pg_rewind'] = True \
if self.config['bootstrap']['dcs']['postgresql']['parameters']['wal_log_hints'] == "on" else False
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will fix it 👍

@pol-o
Copy link

pol-o commented May 13, 2024

Do you want me to add the following contents as comments?

  • "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."

I will commit an example for your request. Check plz.

@pol-o
Copy link

pol-o commented May 15, 2024

@CyberDem0n
It seems like I've fixed everything as you mentioned, could you check it for me?

@@ -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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **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.

Comment on lines 50 to 54





Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated change

Suggested change

Comment on lines 83 to 88






Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

@@ -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 \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pol-o
Copy link

pol-o commented May 16, 2024

@CyberDem0n
Thx for review. I hope these commits fulfill the intended purpose :)

pol-o

This comment was marked as duplicate.

@@ -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)
Copy link
Member

@hughcapet hughcapet May 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx for review :)

@pol-o
Copy link

pol-o commented May 22, 2024

@CyberDem0n @hughcapet
Check again please :D

@coveralls
Copy link

Pull Request Test Coverage Report for Build 9185084497

Warning: 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

  • 2 of 2 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 99.862%

Totals Coverage Status
Change from base Build 8981687326: 0.0%
Covered Lines: 13760
Relevant Lines: 13779

💛 - Coveralls

@hughcapet hughcapet added this to the Sprint 2024.08 milestone May 22, 2024
@hughcapet
Copy link
Member

👍

1 similar comment
@CyberDem0n
Copy link
Collaborator

👍

@CyberDem0n CyberDem0n merged commit 0a6c09e into zalando:master May 24, 2024
24 checks passed
CyberDem0n pushed a commit that referenced this pull request May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"wal_log_hints" parameter is not configurable
5 participants