-
Notifications
You must be signed in to change notification settings - Fork 20
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
[MISC] Add experimental max_connections config #472
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1468,7 +1468,7 @@ def _restart(self, event: RunWithLock) -> None: | |
return | ||
|
||
try: | ||
for attempt in Retrying(wait=wait_fixed(3), stop_after_delay=stop_after_delay(300)): | ||
for attempt in Retrying(wait=wait_fixed(3), stop=stop_after_delay(300)): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo™ |
||
with attempt: | ||
if not self._can_connect_to_postgresql: | ||
assert False | ||
|
@@ -1547,8 +1547,14 @@ def update_config(self, is_creating_backup: bool = False) -> bool: | |
logger.warning("Early exit update_config: Cannot connect to Postgresql") | ||
return False | ||
|
||
# Use config value if set, calculate otherwise | ||
if self.config.experimental_max_connections: | ||
max_connections = self.config.experimental_max_connections | ||
else: | ||
max_connections = max(4 * os.cpu_count(), 100) | ||
|
||
Comment on lines
+1550
to
+1555
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doing this only here would trigger a restart on deploy with |
||
self._patroni.bulk_update_parameters_controller_by_patroni({ | ||
"max_connections": max(4 * os.cpu_count(), 100), | ||
"max_connections": max_connections, | ||
"max_prepared_transactions": self.config.memory_max_prepared_transactions, | ||
}) | ||
|
||
|
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.
Should we add some kind of validation here?
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.
should we maybe enforce an upper limit?
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.
It's a footgun config.