Skip to content

feat(engine/physicalpb): Add IndexMerge node marshalling - #22231

Merged
trevorwhitney merged 7 commits into
mainfrom
dataobj-compactor/indexmerge-proto-marshal
Jun 4, 2026
Merged

feat(engine/physicalpb): Add IndexMerge node marshalling#22231
trevorwhitney merged 7 commits into
mainfrom
dataobj-compactor/indexmerge-proto-marshal

Conversation

@trevorwhitney

@trevorwhitney trevorwhitney commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

What this does

Part 3 of 6 splitting up #21972 (IndexMerge executor) into reviewable PRs. Independent — based on main, can review/merge in any order.

The dataobj compaction coordinator dispatches IndexMerge tasks to workers over the wire transport, so the physical.IndexMerge node needs protobuf marshal/unmarshal support.

  • Add the IndexMerge message and its RunRef/SectionRef fields to physicalpb.proto and regenerate physicalpb.pb.go.
  • marshal_node.go / unmarshal_node.go convert physical.IndexMerge to and from the proto message.

Adds round-trip marshalling tests for the new node.

The dataobj compaction coordinator dispatches IndexMerge tasks to
workers over the wire transport, so the physical.IndexMerge node needs
protobuf marshal/unmarshal support. Without it the node cannot cross
the scheduler -> worker boundary.

  - Add the IndexMerge message and its RunRef/SectionRef fields to
    physicalpb.proto and regenerate physicalpb.pb.go.
  - marshal_node.go / unmarshal_node.go convert physical.IndexMerge to
    and from the proto message.
  - codec.go now returns the conversion/marshal error instead of
    panicking: an unmarshallable node should surface as a transport
    error to the caller, not crash the encoder goroutine.

Adds round-trip marshalling tests for the new node.
@trevorwhitney
trevorwhitney force-pushed the dataobj-compactor/indexmerge-proto-marshal branch from 872b7bd to 7a7e7e5 Compare June 3, 2026 17:27
@trevorwhitney
trevorwhitney marked this pull request as ready for review June 3, 2026 17:27
@trevorwhitney
trevorwhitney requested a review from a team as a code owner June 3, 2026 17:27
Comment on lines +303 to +306
google.protobuf.Duration task_ttl = 5 [
(gogoproto.stdduration) = true,
(gogoproto.nullable) = false
];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is standing out to me. What does TTL mean here? Why is the physical plan carrying information about task orchestration?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

AFAIK there's not really a good way to give tasks a TTL currently, and this seemed important for compaction. However you're completely right this is not a planning concern. I'm going to remove this and guard in #22233, and we can circle back to enforcing a task TTL later if needed. Or if there is a way to do that already, I can wire it up correctly in a future PR?

// for a single tenant within one ToC window.
message IndexMerge {
string tenant = 1;
int64 toc_window_start = 2;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should ideally have a comment here explaining what the unit being stored is, or add the unit as a suffix to the field name; it's not clear to me what a value means.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

renamed and added a comment

A per-task execution deadline is a task-orchestration concern, not part
of the physical plan that crosses the scheduler -> worker boundary.
Carrying task_ttl on the IndexMerge node promoted orchestration policy
into the plan-level API.

Remove the task_ttl field from the IndexMerge proto message, regenerate
physicalpb.pb.go, and drop it from the marshal/unmarshal converters and
the round-trip test. The google.protobuf.Duration import stays (other
messages still use it).

The deadline will be reintroduced at the orchestration layer (the wire
Task envelope, alongside MaxTimeRange, which already carries
execution-control metadata outside the fragment) as separate work
covering both IndexMerge and LogMerge uniformly. The TaskTTL field
remains on physical.IndexMerge for now and is simply not serialized.
Rename the IndexMerge proto field to toc_window_start_unix_nanos and
document why it is pinned at plan time. The field is captured when the
task is planned so the executor and the Phase-2 pointer swap operate on
the same metastore ToC window even if the clock drifts before the task
runs; deriving it from "now" at execution time could resolve to a
different window near a boundary.
rfratto
rfratto previously approved these changes Jun 3, 2026
The prior proto-regen commit reindented a trailing comment in
frontend.proto using a newer local buf than CI's pinned version, causing
check-generated-files to fail. Restore the comment to the form CI's buf
format produces.
@trevorwhitney
trevorwhitney merged commit b3e9265 into main Jun 4, 2026
89 checks passed
@trevorwhitney
trevorwhitney deleted the dataobj-compactor/indexmerge-proto-marshal branch June 4, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants