Skip to content

Use TopicPartitionId as primary partition identity across all internal code#18948

Closed
rseetham wants to merge 2 commits into
apache:masterfrom
rseetham:pr2-topicpartitionid-internal
Closed

Use TopicPartitionId as primary partition identity across all internal code#18948
rseetham wants to merge 2 commits into
apache:masterfrom
rseetham:pr2-topicpartitionid-internal

Conversation

@rseetham

@rseetham rseetham commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Stacked on #18913 (TopicPartitionId introduction) — please review/merge that one first. This PR migrates internal partition-identity handling from raw int/Integer partition IDs to the TopicPartitionId composite key introduced in the prior PR, in preparation for supporting multiple Kafka topics per Pinot table.

  • Add context-aware LLCSegmentName(String, boolean hasMultipleStreams) that decomposes old-format composite partition IDs (e.g. 10003 -> topic 1, partition 3) at parse time when the table has multiple streams, so TopicPartitionId is always canonical regardless of segment format.
  • Migrate internal maps from Map<Integer, ...> to Map<TopicPartitionId, ...> across controller, server, query planner, segment-local, and minion tasks.
  • Change assignConsumingSegment, computeStartOffset, and other internal methods to accept TopicPartitionId directly instead of raw partition ints.
  • Thread hasMultipleStreams through RealtimeSegmentConfig, MutableIndexContext, and Lucene index constructors.
  • Add TopicPartitionId.fromPartitionGroupMetadata() for SPI boundary wrapping and SegmentUtils.getTopicPartitionIdFromSegmentName() as the new API.
  • Deprecate the now-superseded IngestionConfigUtils encode/decode helpers (kept for external/legacy call sites not covered by this migration).

Test plan

  • test-compile across pinot-spi, pinot-common, pinot-controller, pinot-core, pinot-segment-local, pinot-query-planner passes cleanly
  • PinotLLCRealtimeSegmentManagerTest — 42/42 pass
  • IngestionDelayTrackerTest — 9/9 pass
  • PinotSegmentRestletResourceTest — 8/8 pass

rseetham added 2 commits July 2, 2026 14:38
…entity (Part 1 of multi-topic segment naming)

This is part 1 of the multi-topic segment name format work. It introduces
TopicPartitionId as a composite key holding topicId and partitionId, and
adds getTopicPartitionId() to LLCSegmentName returning it. The original
getPartitionGroupId() returning int is preserved as deprecated for binary
compatibility during rolling upgrades.

All call sites are migrated to use getTopicPartitionId().getPartitionId().
…l code

Add context-aware LLCSegmentName(String, boolean hasMultipleStreams) that
decomposes old-format composite partition IDs (e.g. 10003 -> topic 1,
partition 3) at parse time when the table has multiple streams. This
ensures TopicPartitionId is always canonical regardless of segment format.

Migrate all internal maps from Map<Integer, ...> to Map<TopicPartitionId, ...>
across controller, server, query planner, segment-local, and minion tasks.
Change assignConsumingSegment, computeStartOffset, and other internal methods
to accept TopicPartitionId directly. Thread hasMultipleStreams through
RealtimeSegmentConfig, MutableIndexContext, and Lucene index constructors.

Add TopicPartitionId.fromPartitionGroupMetadata() for SPI boundary wrapping
and SegmentUtils.getTopicPartitionIdFromSegmentName() as the new API.
Deprecate IngestionConfigUtils encode/decode helpers.
@rseetham

rseetham commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Closing to recreate with correct base branch (was diffing against master instead of the stacked PR1 branch, causing PR1's commit to appear duplicated here).

@rseetham rseetham closed this Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant