mayankshriv commented on code in PR #13954:
URL: https://github.com/apache/pinot/pull/13954#discussion_r1750606115


##########
pinot-common/src/main/java/org/apache/pinot/common/utils/helix/HelixHelper.java:
##########
@@ -542,6 +549,12 @@ public static List<String> 
getInstancesWithTag(List<InstanceConfig> instanceConf
     return 
instancesWithTag.stream().map(InstanceConfig::getInstanceName).collect(Collectors.toList());
   }
 
+  public static List<String> getInstancesWithoutTag(List<InstanceConfig> 
instanceConfigs) {
+    List<InstanceConfig> instancesWithTag = 
getInstancesConfigsWithoutTag(instanceConfigs);

Review Comment:
   Rename variable to `instanceWIthoutTags`?



##########
pinot-controller/src/test/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManagerStatelessTest.java:
##########
@@ -1146,6 +1147,20 @@ public void testSegmentReplacementRegular()
     segmentLineage = 
SegmentLineageAccessHelper.getSegmentLineage(_propertyStore, 
OFFLINE_TABLE_NAME);
     assertNull(segmentLineage);
   }
+  @Test
+  public void testHandleEmptyServerTags()
+      throws Exception {
+    // Create an instance with no tags
+    Instance instance = new Instance("localhost", NUM_SERVER_INSTANCES , 
InstanceType.SERVER,
+        Collections.emptyList(), null, 0, 12345, 0, 0, false);
+
+    _helixResourceManager.addInstance(instance,false);
+    
addFakeServerInstanceToAutoJoinHelixClusterWithEmptyTag(SERVER_NAME_UNTAGGED, 
false);
+
+    // Verify that the server is considered untagged
+    List<String> untaggedServers = 
_helixResourceManager.getOnlineUnTaggedServerInstanceList();
+    assertTrue(untaggedServers.contains(SERVER_NAME_UNTAGGED), "Server with 
empty tags should be considered untagged");

Review Comment:
   Would be good to add the negative test as well - Servers with tag should not 
be considered untagged.



-- 
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-unsubscr...@pinot.apache.org

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


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

Reply via email to