Fix tracing lifecycle and exporter reliability - #1
Open
blast-hardcheese wants to merge 2 commits into
Open
blast-hardcheese wants to merge 2 commits into
blast-hardcheese wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Confidence Score: 3/5
Summary
Hardens tracing lifecycles and exporter retries. Local PostgreSQL 16 tests and CI 14–17 pass, but executor/shared-memory changes remain high risk and require database-owner review; the exact production image remains untested.
Important Files Changed
| File | Overview |
|---|---|
| .github/workflows/run-tests.yml | Longer timeout accommodates expanded tests |
| Makefile | Enables TAP tests in the normal test command |
| doc/pg_tracing.md | Documents reloadable timeouts and failed-export retention |
| expected/parallel.out | Expected parallel hash-join results |
| regress/16/expected/parallel.out | PostgreSQL 16 parallel hash-join expectations |
| regress/17/expected/parallel.out | PostgreSQL 17 parallel hash-join expectations |
| regress/18/expected/parallel.out | PostgreSQL 18 parallel hash-join expectations |
| sql/parallel.sql | Sampled parallel hash-join regression |
| src/pg_tracing.c | Balanced nesting, planner cleanup guards, and unavailable-text handling |
| src/pg_tracing.h | Wider nesting indices change internal shared-memory layout |
| src/pg_tracing_active_spans.c | Preserves parent data across active-span array relocation |
| src/pg_tracing_json.c | Operation names use the copied text snapshot |
| src/pg_tracing_operation_hash.c | Initializes hash keys and removes failed text insertions |
| src/pg_tracing_otel.c | Bounds request duration and rejects non-2xx delivery |
| src/pg_tracing_planstate.c | Corrects GatherMerge handling and tolerates missing plan metadata |
| src/pg_tracing_span.c | Accepts explicit text snapshots for operation names |
| src/pg_tracing_sql_functions.c | Passes lock-protected shared text to operation-name lookup |
| t/004_reliability.pl | Covers utility recovery, nesting, parallel execution, and exhausted text buffers |
| t/005_export_retry.pl | Covers HTTP rejection, request timeout, reload, and retry recovery |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Makes pg_tracing more reliable during normal query execution, tracing-buffer exhaustion, and collector interruptions. Includes the existing parallel Hash fix plus consistent plan metadata handling, corrected Gather Merge handling, stable nested-span bookkeeping, balanced utility/planner cleanup, and safe omission of unavailable span text. Exported operation names now use the same copied snapshot as the rest of the payload.
Exports have a reloadable 10-second total request timeout (
pg_tracing.otel_timeout_ms), and only HTTP 2xx responses count as successful delivery. Failed requests retain their payload for retry. Enables the existing TAP suite in the normal test command and adds lifecycle, parallel-query, small-buffer, and exporter retry coverage.Motivation
Follow-up reliability maintenance for repeated PostgreSQL process crashes with tracing enabled. The new ordinary workload regression catches a sorted parallel-query failure on the previous pinned revision and passes with this change. This does not establish that every historical production crash had the same cause.
Additional Notes
Validation on PostgreSQL 17.10 ARM64 in an isolated Docker instance:
make installcheck.pgindent --diff --checkandgit diff --checkpass.CI passed on PostgreSQL 14, 15, 16, and 17 on x86_64 (run). The exact production PostgreSQL 17.6 image has not been tested locally. Production configuration and deployment are unchanged; broader executor lifecycle redesign remains outside this patch.
Rebuild the database image at the new commit and restart PostgreSQL to load it. No extension SQL upgrade is required; the SQL interface remains at 0.1.0. Do not replace the shared library underneath running PostgreSQL processes, because internal shared-memory span layout changes in this patch.