Skip to content

Commit

Permalink
Add max_locks_per_transaction config option
Browse files Browse the repository at this point in the history
Signed-off-by: Marcelo Henrique Neppel <[email protected]>
  • Loading branch information
marceloneppel committed Dec 18, 2024
1 parent 7da9c8c commit 44649e7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
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: 65536
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 @@ -18,6 +18,7 @@ class CharmConfig(BaseConfigModel):

durability_synchronous_commit: Optional[str]
instance_default_text_search_config: Optional[str]
instance_max_locks_per_transaction: Optional[int]
instance_password_encryption: Optional[str]
logging_log_connections: Optional[bool]
logging_log_disconnections: Optional[bool]
Expand Down Expand Up @@ -129,6 +130,15 @@ def instance_password_encryption_values(cls, value: str) -> Optional[str]:

return value

@validator("instance_max_locks_per_transaction")
@classmethod
def instance_max_locks_per_transaction_values(cls, value: int) -> Optional[int]:
"""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) -> Optional[int]:
Expand Down

0 comments on commit 44649e7

Please sign in to comment.