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

[DPE-6249] Add max_locks_per_transaction config option #804

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ options:
“pg_catalog.english”.
type: string
default: "pg_catalog.simple"
instance_max_locks_per_transaction:
description: |
Specifies the maximum amount of memory to be used by maintenance operations,
such as "VACUUM", "CREATE INDEX", and "ALTER TABLE ADD FOREIGN KEY".
If this value is specified without units, it is taken as kilobytes.
Allowed values are: from 64 to 2147483647.
type: int
default: 64
instance_password_encryption:
description: |
Determines the algorithm to use to encrypt the password.
Expand Down
10 changes: 10 additions & 0 deletions src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class CharmConfig(BaseConfigModel):

durability_synchronous_commit: str | None
instance_default_text_search_config: str | None
instance_max_locks_per_transaction: int | None
instance_password_encryption: str | None
logging_log_connections: bool | None
logging_log_disconnections: bool | None
Expand Down Expand Up @@ -128,6 +129,15 @@ def instance_password_encryption_values(cls, value: str) -> str | None:

return value

@validator("instance_max_locks_per_transaction")
@classmethod
def instance_max_locks_per_transaction_values(cls, value: int) -> int | None:
"""Check instance_max_locks_per_transaction config option is between 64 and 2147483647."""
if value < 64 or value > 2147483647:
raise ValueError("Value is not between 64 and 2147483647")

return value

@validator("logging_log_min_duration_statement")
@classmethod
def logging_log_min_duration_statement_values(cls, value: int) -> int | None:
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ async def test_config_parameters(ops_test: OpsTest) -> None:
{
"durability_synchronous_commit": [test_string, "on"]
}, # config option is one of `on`, `remote_apply` or `remote_write`
{
"instance_max_locks_per_transaction": ["-1", "64"]
}, # config option is between 64 and 2147483647
{
"instance_password_encryption": [test_string, "scram-sha-256"]
}, # config option is one of `md5` or `scram-sha-256`
Expand Down
Loading