KKcorps commented on code in PR #17089:
URL: https://github.com/apache/pinot/pull/17089#discussion_r2471887847
##########
pinot-server/src/main/java/org/apache/pinot/server/starter/helix/FreshnessBasedConsumptionStatusChecker.java:
##########
@@ -73,29 +78,40 @@ protected boolean isSegmentCaughtUp(String segmentName,
RealtimeSegmentDataManag
// message is too old to pass the freshness check. We check this condition
separately to avoid hitting
// the stream consumer to check partition count if we're already caught up.
StreamPartitionMsgOffset currentOffset =
rtSegmentDataManager.getCurrentOffset();
- StreamPartitionMsgOffset latestStreamOffset =
rtSegmentDataManager.fetchLatestStreamOffset(5000);
+
+ StreamMetadataProvider streamMetadataProvider =
+
realtimeTableDataManager.getStreamMetadataProvider(rtSegmentDataManager);
+ StreamPartitionMsgOffset latestStreamOffset;
+ try {
+ int partitionId = rtSegmentDataManager.getPartitionGroupId();
+ Map<Integer, StreamPartitionMsgOffset> partitionMsgOffsetMap =
+
streamMetadataProvider.fetchLatestStreamOffset(Collections.singleton(partitionId),
Review Comment:
the `rtSegmentDataManager.getPartitionGroupId()` returns logical partition
id and not actual partition id in case of multi stream ingestion
we need to translate it to actual partition id before passing it to
`streamMetadataProvider.fetchLatestStreamOffset` imo
From RealtimeSegmentDataManager:
```
_partitionGroupId = llcSegmentName.getPartitionGroupId();
List<Map<String, String>> streamConfigMaps =
IngestionConfigUtils.getStreamConfigMaps(_tableConfig);
int numStreams = streamConfigMaps.size();
if (numStreams == 1) {
// Single stream
// NOTE: We skip partition id translation logic to handle cases where
custom stream might return partition id
// larger than 10000.
_streamPartitionId = _partitionGroupId;
_streamConfig = new StreamConfig(_tableNameWithType,
streamConfigMaps.get(0));
} else {
// Multiple streams
_streamPartitionId =
IngestionConfigUtils.getStreamPartitionIdFromPinotPartitionId(_partitionGroupId);
int index =
IngestionConfigUtils.getStreamConfigIndexFromPinotPartitionId(_partitionGroupId);
Preconditions.checkState(numStreams > index, "Cannot find stream
config of index: %s for table: %s", index,
_tableNameWithType);
_streamConfig = new StreamConfig(_tableNameWithType,
streamConfigMaps.get(index));
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]