Version new#16
Conversation
…ntinuous aggregates, background jobs, and replication tiering
…improve shellcheck coverage, and implement environment-driven skip guards for tests
There was a problem hiding this comment.
Pull request overview
This PR expands CI/test automation for the repo’s shell/SQL toolchain (broader ShellCheck + more reliable SQL validation in restricted environments) and adds a new set of TimescaleDB-focused diagnostic SQL scripts.
Changes:
- Add TimescaleDB diagnostics scripts +
timescaledb/README.mdquick reference. - Refactor
automation/test_pgtools.shSQL syntax sweep to scan multiple directories and skip unsupported scripts based on detected DB capabilities. - Expand CI + local precommit checks to ShellCheck more directories and run HOT checklist validations.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/ci.yml |
Runs broader ShellCheck, enables pg_stat_statements, and adds HOT checklist validations in CI. |
automation/test_pgtools.sh |
Adds environment capability detection and expands SQL syntax validation scope/skip logic. |
scripts/precommit_checks.sh |
Aligns local ShellCheck coverage with CI (more directories). |
maintenance/auto_maintenance.sh |
Shell style tweaks + targeted ShellCheck disables + safer prompts/quoting changes. |
integration/prometheus_exporter.sh |
Shell style refactor (separate declaration/assignment). |
integration/grafana_dashboard_generator.sh |
Shell style refactor (separate declaration/assignment). |
configuration/parameter_tuner.sh |
Shell style refactor (separate declaration/assignment). |
timescaledb/chunk_health.sql |
New TimescaleDB chunk sizing/count diagnostics. |
timescaledb/compression_diagnostics.sql |
New TimescaleDB compression configuration/effectiveness/backlog diagnostics. |
timescaledb/continuous_aggregates.sql |
New TimescaleDB CAGG health + refresh policy diagnostics. |
timescaledb/background_jobs.sql |
New TimescaleDB background job failure/saturation diagnostics. |
timescaledb/replication_tiering.sql |
New Tiger Lake / tiered storage replication slot lag diagnostics. |
timescaledb/README.md |
Documents TimescaleDB scripts and a triage flow. |
timescaledb.txt |
Adds a TimescaleDB “cheatsheet” document (currently written as conversational transcript). |
Comments suppressed due to low confidence (1)
maintenance/auto_maintenance.sh:264
SCHEMA_PATTERNandTARGET_TABLESpatterns are interpolated directly into the SQL string (schemaname = '$SCHEMA_PATTERN'andtablename LIKE '${pattern}'). If either value contains a single quote (or other special characters), the query can break and also enables SQL injection against the connected database. Prefer passing values viapsql -vand using psql’s SQL-literal substitution (:'var'), or at minimum escape single quotes in user-supplied patterns before embedding them.
else
schema_filter="AND schemaname NOT IN ('information_schema', 'pg_catalog')"
fi
local table_filter=""
if [[ -n "$TARGET_TABLES" ]]; then
# Convert comma-separated patterns to SQL LIKE conditions
# shellcheck disable=SC2206 # intentional word-split of comma-separated list
local patterns=(${TARGET_TABLES//,/ })
local conditions=()
for pattern in "${patterns[@]}"; do
conditions+=("tablename LIKE '${pattern}'")
done
# shellcheck disable=SC2124 # join-with-IFS idiom uses [*] by design
table_filter="AND ($(IFS=' OR '; echo "${conditions[*]}"))"
fi
psql -t -c "
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: HOT checklist JSON validation | ||
| run: ./automation/run_hot_update_report.sh --format json --database "$PGDATABASE" --stdout | ||
|
|
||
| # - name: HOT checklist text validation | ||
| # run: ./automation/run_hot_update_report.sh --format text --database "$PGDATABASE" --stdout | ||
| - name: HOT checklist text validation | ||
| run: ./automation/run_hot_update_report.sh --format text --database "$PGDATABASE" --stdout |
There was a problem hiding this comment.
CI runs run_hot_update_report.sh --stdout without --quiet, which causes the script to print local “Next steps” instructions (paths/tooling) into CI logs. Consider adding --quiet in CI to keep logs focused on validation output.
| # Files that require pg_stat_statements or pg_buffercache to be installed as | ||
| # extensions. Skipped when SKIP_EXTENSION_SCRIPTS is true. | ||
| SQL_REQUIRES_EXTENSIONS=( | ||
| "performance/query_performance_profiler.sql" | ||
| "performance/wait_event_analysis.sql" | ||
| "monitoring/buffer_troubleshoot.sql" | ||
| ) |
There was a problem hiding this comment.
SQL_REQUIRES_EXTENSIONS is not comprehensive for pg_stat_statements-dependent scripts. For example, optimization/missing_indexes.sql and multiple troubleshooting/* packs query pg_stat_statements unconditionally, so when pg_stat_statements isn’t installed the new syntax sweep will fail even though SKIP_EXTENSION_SCRIPTS is true. Either add all extension-dependent scripts to the allowlist, or make the skip logic data-driven (e.g., skip files containing pg_stat_statements/pg_buffercache references when the corresponding extension isn’t installed, unless the script self-guards).
… table references, enhance performance metrics, and streamline maintenance analysis
…pg_buffercache extensions, improve SQL scripts for maintenance scheduling and resource monitoring, and refine wait event analysis query
…l and improve background writer metrics handling
…sis and provide installation instructions
…d_preload_libraries and update installation instructions
… verify pg_stat_statements configuration
This pull request introduces several improvements to the shell script automation and CI workflow, focusing on more robust environment detection, improved test reliability, and enhanced code quality. The primary changes are grouped into CI/test automation enhancements and shell scripting style improvements.
CI and Test Automation Enhancements:
automation/test_pgtools.shto skip SQL syntax tests that require unavailable superuser privileges or missing extensions, avoiding false failures in restricted CI environments. (automation/test_pgtools.sh) [1] [2] [3]automation/test_pgtools.sh)pg_stat_statementsextension and run a broader set of ShellCheck validations and test suites, including HOT checklist validations. (.github/workflows/ci.yml)automation/test_pgtools.sh)Shell Scripting Style and Safety Improvements:
shellcheckdisables and improved quoting/word-splitting to prevent false positives and ensure robust handling of user input in maintenance scripts. (maintenance/auto_maintenance.sh) [1] [2]read -rpfor confirmation prompts). (maintenance/auto_maintenance.sh)pg_size_pretty. (maintenance/auto_maintenance.sh) [1] [2] [3] [4] [5]These updates collectively make the automation and maintenance scripts more reliable, maintainable, and CI-friendly.