Skip to content

Fixed improperly nested engine_config arguments in Postgres DB creation#778

Merged
ezilber-akamai merged 2 commits intolinode:devfrom
ezilber-akamai:TPT-3763-fix-nested-args
Jun 2, 2025
Merged

Fixed improperly nested engine_config arguments in Postgres DB creation#778
ezilber-akamai merged 2 commits intolinode:devfrom
ezilber-akamai:TPT-3763-fix-nested-args

Conversation

@ezilber-akamai
Copy link
Contributor

@ezilber-akamai ezilber-akamai commented May 29, 2025

📝 Description

Fixed the following improperly nested fields in Postgres Database Creation:

pg_partman_bgw.interval
pg_partman_bgw.role
pg_stat_monitor.pgsm_enable_query_plan
pg_stat_monitor.pgsm_max_buckets
pg_stat_statements.track

✔️ How to Test

The following test steps require that the CLI is build against the latest API spec.

Integration Testing

Run the integration test suite to ensure that this fix did not break unrelated functionality:
make test-int

Manual Testing

Run the following command and ensure that the database is properly created and json is properly printed:

linode-cli databases postgresql-create \
  --engine postgresql/16 \
  --label my-postgres-db \
  --region us-east \
  --type g6-standard-2 \
  --allow_list 172.232.164.239 \
  --cluster_size 3 \
  --ssl_connection true \
  --engine_config.pg.autovacuum_analyze_scale_factor 1 \
  --engine_config.pg.autovacuum_analyze_threshold 2147483647 \
  --engine_config.pg.autovacuum_max_workers 20 \
  --engine_config.pg.autovacuum_naptime 86400 \
  --engine_config.pg.autovacuum_vacuum_cost_delay 100 \
  --engine_config.pg.autovacuum_vacuum_cost_limit 10000 \
  --engine_config.pg.autovacuum_vacuum_scale_factor 1 \
  --engine_config.pg.autovacuum_vacuum_threshold 2147483647 \
  --engine_config.pg.bgwriter_delay 200 \
  --engine_config.pg.bgwriter_flush_after 512 \
  --engine_config.pg.bgwriter_lru_maxpages 100 \
  --engine_config.pg.bgwriter_lru_multiplier 2.5 \
  --engine_config.pg.deadlock_timeout 1000 \
  --engine_config.pg.default_toast_compression lz4 \
  --engine_config.pg.idle_in_transaction_session_timeout 604800000 \
  --engine_config.pg.jit true \
  --engine_config.pg.max_files_per_process 1024 \
  --engine_config.pg.max_locks_per_transaction 1024 \
  --engine_config.pg.max_logical_replication_workers 64 \
  --engine_config.pg.max_parallel_workers 96 \
  --engine_config.pg.max_parallel_workers_per_gather 96 \
  --engine_config.pg.max_pred_locks_per_transaction 5120 \
  --engine_config.pg.max_replication_slots 64 \
  --engine_config.pg.max_slot_wal_keep_size 1000000 \
  --engine_config.pg.max_stack_depth 2097152 \
  --engine_config.pg.max_standby_archive_delay 1 \
  --engine_config.pg.max_standby_streaming_delay 10 \
  --engine_config.pg.max_wal_senders 20 \
  --engine_config.pg.max_worker_processes 96 \
  --engine_config.pg.password_encryption scram-sha-256 \
  --engine_config.pg.pg_partman_bgw.interval 3600 \
  --engine_config.pg.pg_partman_bgw.role pg_partman_bgw \
  --engine_config.pg.pg_stat_monitor.pgsm_enable_query_plan true \
  --engine_config.pg.pg_stat_monitor.pgsm_max_buckets 10 \
  --engine_config.pg.pg_stat_statements.track top \
  --engine_config.pg.temp_file_limit 5000000 \
  --engine_config.pg.timezone Europe/Helsinki \
  --engine_config.pg.track_activity_query_size 1024 \
  --engine_config.pg.track_commit_timestamp on \
  --engine_config.pg.track_functions none \
  --engine_config.pg.track_io_timing off \
  --engine_config.pg.wal_sender_timeout 60000 \
  --engine_config.pg.wal_writer_delay 200 \
  --engine_config.pg_stat_monitor_enable true \
  --engine_config.pglookout.max_failover_replication_time_lag 10 \
  --debug --json

@ezilber-akamai ezilber-akamai added improvement for improvements in existing functionality in the changelog. do-not-merge PRs that should not be merged until the commented issue is resolved labels May 29, 2025
@ezilber-akamai ezilber-akamai marked this pull request as ready for review May 29, 2025 17:20
@ezilber-akamai ezilber-akamai requested a review from a team as a code owner May 29, 2025 17:20
@ezilber-akamai ezilber-akamai requested review from lgarber-akamai and zliang-akamai and removed request for a team May 29, 2025 17:20
Copy link
Member

@zliang-akamai zliang-akamai left a comment

Choose a reason for hiding this comment

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

Can we wrap these logic into a function without bloating the _build_request_body function?

@lgarber-akamai
Copy link
Contributor

lgarber-akamai commented May 29, 2025

@ezilber-akamai As a more generic alternative would it make sense to escape the . character for each path segment?

e.g.

engine_config.pg.pg_stat_monitor.pgsm_enable_query_plan

would be instead stored internally as

engine_config.pg.pg_stat_monitor\.pgsm_enable_query_plan

Example: lgarber-akamai@f50b8d7

@ezilber-akamai ezilber-akamai force-pushed the TPT-3763-fix-nested-args branch from ee941bf to 301e938 Compare May 30, 2025 16:41
Copy link
Contributor

@ykim-akamai ykim-akamai left a comment

Choose a reason for hiding this comment

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

LGTM, all tests passed. Nice work!

Copy link
Member

@zliang-akamai zliang-akamai left a comment

Choose a reason for hiding this comment

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

Very cool way to handle that escaping thing! Nice work!

@ezilber-akamai ezilber-akamai merged commit 2f1bb7c into linode:dev Jun 2, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge PRs that should not be merged until the commented issue is resolved improvement for improvements in existing functionality in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants