dongxiaoman commented on a change in pull request #7064: URL: https://github.com/apache/incubator-pinot/pull/7064#discussion_r660197626
########## File path: pinot-common/src/main/java/org/apache/pinot/common/utils/helix/HelixHelper.java ########## @@ -495,4 +499,104 @@ public IdealState apply(@Nullable IdealState idealState) { String tenant) { return new HashSet<>(getInstancesConfigsWithTag(instanceConfigs, TagNameUtils.getBrokerTagForTenant(tenant))); } + + /** + * Add default tags to instance if the instance has no tags Note for the getDefaultTags: it is a + * lambda so it may not be invoked if instance already has tags. * For example () -> + * ImmutableList.of("Default_tenant") + * + * @param helixManager The helix manager for update + * @param instanceId the Helix instance Id + * @param getDefaultTags the default tags lambda. Something like () -> ImmutableList.of("Default_tenant") to provide default tags + */ + public static void addDefaultTags( + HelixManager helixManager, String instanceId, Supplier<List<String>> getDefaultTags) { + InstanceConfig instanceConfig = getInstanceConfig(helixManager, instanceId); + // Add default instance tags if not exist + List<String> instanceTags = instanceConfig.getTags(); + if (instanceTags == null || instanceTags.size() == 0) { Review comment: Changed to `.isEmpty()` -- 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