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

Rebase custom changes over Patroni 4 #9

Merged
merged 2 commits into from
Sep 17, 2024

Conversation

alexeyklyukin
Copy link
Member

Rebase TS custom changes over the latest master

Bring in Patroni 4.0 changes and some recent bugfixes from upstream

@alexeyklyukin alexeyklyukin requested a review from a team September 16, 2024 19:36
Copy link

@graveland graveland left a comment

Choose a reason for hiding this comment

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

lgtm!

@coveralls
Copy link

coveralls commented Sep 16, 2024

Pull Request Test Coverage Report for Build 10897873136

Details

  • 27 of 40 (67.5%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.09%) to 99.784%

Changes Missing Coverage Covered Lines Changed/Added Lines %
patroni/main.py 5 6 83.33%
patroni/config.py 1 2 50.0%
patroni/dcs/kubernetes.py 18 29 62.07%
Totals Coverage Status
Change from base Build 10890483091: -0.09%
Covered Lines: 14339
Relevant Lines: 14370

💛 - Coveralls

In the past, Patroni had to update the member key every `loop_wait` interval to prevent its disappearance due to TTL. In Kubernetes, the member key won't disappear, however, Patroni still updates it regularly to propagate current xlog location.

Make those updates configurable. If `kubernetes.xlog_cache_ttl` is set to a positive value and no other member data (i.e. role or timeline) changes, do not update the member pod annotation more frequently than the value of `xlog_cache_ttl` seconds.

This reduces the load on the K8s API, as we don't have to update the pod every loop_wait interval.

If the member needs to be updated due to other reasons (i.e. role change), the xlog position is set to the up-to-date one received from Postgres.

When DEBUG logging is turned on, Patroni will emit log messages similar to the one below when the xlog-only update is withheld because of this parameter:

```
2024-06-06 11:34:36,308 DEBUG: prevented pod update, keeping cached xlog value for up to 10 seconds
```

This parameter is set to 0 by default, so this feature is disabled unless turned on explicitly by the user. The maximum value is 3600s.
Many people have to tune Patroni log level to WARNING, since messages like "no action: I am (patroni1), the leader with the lock" are emitted every HA loop run at an INFO level. Those are noisy and not terribly useful, as Patroni emits a different message anyway when the status quo changes.

This commit changes the default behavior by showing the "no action" message as an INFO for the first time, demoting subsequent repeated "no action" messages to DEBUG.
@alexeyklyukin alexeyklyukin force-pushed the oleksii/ts_changes_rebased branch from 8fd739b to 25ff390 Compare September 17, 2024 06:40
@alexeyklyukin alexeyklyukin merged commit 489af50 into master Sep 17, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants