Skip to content

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

Draft
rseetham wants to merge 3 commits into
apache:masterfrom
rseetham:pr2-topicpartitionid-internal
Draft

Use TopicPartitionId as primary partition identity across all internal code#18949
rseetham wants to merge 3 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.

Note: this PR's commit list will show 2 commits (the #18913 commit plus this PR's own commit) because GitHub doesn't support basing a PR on another fork's branch — the diff is against master until #18913 merges. Once #18913 merges, this PR's diff/commit list will automatically shrink to just this PR's own commit (Use TopicPartitionId as primary partition identity...). TopicPartitionId.java is only created once, in #18913's commit; it is not duplicated.

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).

rseetham added 3 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.
# Conflicts:
#	pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeSegmentDataManager.java
@codecov-commenter

codecov-commenter commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 61.02719% with 129 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.92%. Comparing base (849c620) to head (bb3e642).

Files with missing lines Patch % Lines
...e/data/manager/realtime/IngestionDelayTracker.java 53.44% 26 Missing and 1 partial ⚠️
.../core/realtime/PinotLLCRealtimeSegmentManager.java 72.09% 20 Missing and 4 partials ⚠️
...ata/manager/realtime/RealtimeTableDataManager.java 23.07% 18 Missing and 2 partials ⚠️
.../plugin/minion/tasks/purge/PurgeTaskGenerator.java 0.00% 9 Missing ⚠️
...va/org/apache/pinot/common/utils/SegmentUtils.java 12.50% 7 Missing ⚠️
...rg/apache/pinot/common/utils/TopicPartitionId.java 70.83% 3 Missing and 4 partials ⚠️
...ler/api/resources/PinotSegmentRestletResource.java 40.00% 6 Missing ⚠️
...a/manager/realtime/RealtimeSegmentDataManager.java 53.84% 5 Missing and 1 partial ⚠️
...ealtime/writer/StatelessRealtimeSegmentWriter.java 0.00% 6 Missing ⚠️
...ertedindex/MultiColumnRealtimeLuceneTextIndex.java 0.00% 5 Missing ⚠️
... and 10 more
Additional details and impacted files
@@            Coverage Diff             @@
##             master   #18949    +/-   ##
==========================================
  Coverage     64.92%   64.92%            
  Complexity     1347     1347            
==========================================
  Files          3395     3396     +1     
  Lines        212564   212682   +118     
  Branches      33518    33532    +14     
==========================================
+ Hits         137998   138087    +89     
- Misses        63424    63456    +32     
+ Partials      11142    11139     -3     
Flag Coverage Δ
custom-integration1 ?
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-21 64.92% <61.02%> (+<0.01%) ⬆️
temurin 64.92% <61.02%> (+<0.01%) ⬆️
unittests 64.92% <61.02%> (+<0.01%) ⬆️
unittests1 56.95% <45.50%> (+<0.01%) ⬆️
unittests2 37.26% <49.24%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants