Copilot commented on code in PR #17811:
URL: https://github.com/apache/pinot/pull/17811#discussion_r2886853164


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/realtime/PinotLLCRealtimeSegmentManager.java:
##########
@@ -400,7 +398,9 @@ public void setUpNewTable(TableConfig tableConfig, 
IdealState idealState,
     List<StreamConfig> streamConfigs = 
IngestionConfigUtils.getStreamConfigs(tableConfig);
     
streamConfigs.forEach(_flushThresholdUpdateManager::clearFlushThresholdUpdater);
     InstancePartitions instancePartitions = 
getConsumingInstancePartitions(tableConfig);
-    int numPartitionGroups = consumeMeta.size();
+    int numPartitionGroups = streamMetadataList.stream()
+        .mapToInt(sm -> sm.getPartitionGroupMetadataList().size())
+        .sum();
     int numReplicas = getNumReplicas(tableConfig, instancePartitions);
 

Review Comment:
   In `setUpNewTable(...)`, `numPartitionGroups` is derived from the size of 
the provided metadata lists rather than the per-stream `partitionCount`. When 
the caller provides designated metadata for only a subset of partitions (e.g. 
copy-table watermarks), this underestimates the real partition count and can 
cause incorrect partition metadata / assignment sizing (the `numPartitions` 
value is passed into `setupNewPartitionGroup()` -> 
`createNewSegmentZKMetadata()`). Consider computing this from 
`StreamMetadata#getPartitionCount()` (sum across streams), or clearly 
separating “partitions to create” vs “total partition count” and passing the 
right value downstream.
   ```suggestion
       int numPartitionGroups =
           
streamMetadataList.stream().mapToInt(StreamMetadata::getPartitionCount).sum();
       int numReplicas = getNumReplicas(tableConfig, instancePartitions);
   ```



-- 
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]

Reply via email to