You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/11/10 06:05:49 UTC

[GitHub] [pinot] snleee commented on a diff in pull request #9774: Fix the null pointer exception for segment assignment strategy in reassigning tiers (Table rebalance)

snleee commented on code in PR #9774:
URL: https://github.com/apache/pinot/pull/9774#discussion_r1018655342


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/assignment/segment/BaseSegmentAssignment.java:
##########
@@ -126,6 +127,15 @@ protected Pair<List<Map<String, Map<String, String>>>, Map<String, Map<String, S
 
       _logger.info("Rebalancing tier: {} for table: {} with bootstrap: {}, instance partitions: {}", tierName,
           _tableNameWithType, bootstrap, tierInstancePartitions);
+
+      // Set the default assignment strategy in case if it not set already
+      // Assuming all tiers use the same assignment strategy
+      if (segmentAssignmentStrategy == null) {

Review Comment:
   Given that `segmentAssignmentStrategy` is not annotated as `@Nullable`, we can assume that `segmentAssignmentStrategy` will never be `null` in the perspective of `BaseSegmentAssignment`. IMO, we should handle this null issue in the caller of this function, which is `RealtimeSegmentAssignment`. 
   
   In `RealtimeSegmentAssignment`, we correctly handle for `OFFLINE/COMPLETED`; however, I think that the current code can pass `null` for `rebalanceTiers()` function.
   
   We should update the following part `RealtimeSegmentAssignment:L193`:
   ```
       SegmentAssignmentStrategy segmentAssignmentStrategy = null;
       if (completedInstancePartitions != null) {
         // Gets Segment assignment strategy for instance partitions
         segmentAssignmentStrategy = SegmentAssignmentStrategyFactory
             .getSegmentAssignmentStrategy(_helixManager, _tableConfig, InstancePartitionsType.COMPLETED.toString(),
                 completedInstancePartitions);
       }
   ```



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org