Fix: pg_task / pg_task_run_history column reorder with catversion bump - #1817
Merged
Merged
Conversation
roseduan
force-pushed
the
fix/pg-task-catalog-version-bump
branch
from
June 12, 2026 02:54
b09ca97 to
38d28f2
Compare
Some non-varlen fields (int32 nodeport, bool active in pg_task; timestamptz start_time / end_time in pg_task_run_history) were declared after CATALOG_VARLEN, which trips LLVM bitcode emission during JIT compilation. Move them ahead of the varlen block. Because this rearranges the on-disk pg_attribute layout, bump CATALOG_VERSION_NO so an upgraded binary refuses to start against a pre-reorder cluster instead of crashing at runtime with SIGSEGV in heap_form_tuple on the first CREATE TASK. Adjust ruleutils.c pg_get_dynamic_table_schedule() to fetch the schedule via heap_getattr() since &task->schedule on the Form struct is no longer valid for varlen-section fields.
roseduan
force-pushed
the
fix/pg-task-catalog-version-bump
branch
from
June 15, 2026 08:38
38d28f2 to
bddb9b0
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes a system-catalog layout issue where fixed-length fields were declared after the varlen boundary in pg_task and pg_task_run_history, which can break LLVM bitcode emission during JIT. It reorders the affected columns, bumps CATALOG_VERSION_NO to prevent unsafe in-place upgrades, and updates pg_get_dynamic_table_schedule() to fetch schedule via heap_getattr() since varlen fields are no longer addressable through the FormData_pg_task struct.
Changes:
- Reorder
pg_taskandpg_task_run_historycolumns so fixed-length fields precede theCATALOG_VARLENsection. - Bump
CATALOG_VERSION_NOto force version mismatch on pre-reorder clusters. - Update
pg_get_dynamic_table_schedule()to readschedulewithheap_getattr().
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/include/catalog/pg_task.h | Moves nodeport/active ahead of the varlen block and marks varlen fields under CATALOG_VARLEN. |
| src/include/catalog/pg_task_run_history.h | Moves start_time/end_time ahead of the varlen block; keeps varlen fields under CATALOG_VARLEN. |
| src/include/catalog/catversion.h | Bumps CATALOG_VERSION_NO to reflect on-disk catalog layout change. |
| src/backend/utils/adt/ruleutils.c | Switches schedule extraction to heap_getattr() for varlen safety. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Some non-varlen fields (int32 nodeport, bool active in pg_task; timestamptz start_time / end_time in pg_task_run_history) were declared after CATALOG_VARLEN, which trips LLVM bitcode emission during JIT compilation.
Move them ahead of the varlen block. Because this rearranges the on-disk pg_attribute layout, bump CATALOG_VERSION_NO so an upgraded binary refuses to start against a pre-reorder cluster instead of crashing at runtime with SIGSEGV in heap_form_tuple on the first CREATE TASK.
Adjust ruleutils.c pg_get_dynamic_table_schedule() to fetch the schedule via heap_getattr() since &task->schedule on the Form struct is no longer valid for varlen-section fields.
Fixes #ISSUE_Number
What does this PR do?
Type of Change
Breaking Changes
Test Plan
make installcheckmake -C src/test installcheck-cbdb-parallelImpact
Performance:
User-facing changes:
Dependencies:
Checklist
Additional Context
CI Skip Instructions