Skip to content

Commit

Permalink
support configuring broker tags even when cluster is configured for s…
Browse files Browse the repository at this point in the history
…ingle tenant
  • Loading branch information
dang-stripe committed Jan 16, 2025
1 parent fe7e9e2 commit 3b21b15
Showing 1 changed file with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -512,22 +512,21 @@ private void updateInstanceConfigAndBrokerResourceIfNeeded() {
boolean shouldUpdateBrokerResource = false;
List<String> instanceTags = instanceConfig.getTags();
if (instanceTags.isEmpty()) {
// This is a new broker (first time joining the cluster)
if (ZKMetadataProvider.getClusterTenantIsolationEnabled(_propertyStore)) {
// This is a new broker (first time joining the cluster). We allow configuring initial broker tags regardless of
// tenant isolation mode since it defaults to true and is relatively obscure.
String instanceTagsConfig = _brokerConf.getProperty(Broker.CONFIG_OF_BROKER_INSTANCE_TAGS);
if (StringUtils.isNotEmpty(instanceTagsConfig)) {
for (String instanceTag : StringUtils.split(instanceTagsConfig, ',')) {
Preconditions.checkArgument(TagNameUtils.isBrokerTag(instanceTag), "Illegal broker instance tag: %s",
instanceTag);
instanceConfig.addTag(instanceTag);
}
shouldUpdateBrokerResource = true;
} else if (ZKMetadataProvider.getClusterTenantIsolationEnabled(_propertyStore)) {
instanceConfig.addTag(TagNameUtils.getBrokerTagForTenant(null));
shouldUpdateBrokerResource = true;
} else {
String instanceTagsConfig = _brokerConf.getProperty(Broker.CONFIG_OF_BROKER_INSTANCE_TAGS);
if (StringUtils.isNotEmpty(instanceTagsConfig)) {
for (String instanceTag : StringUtils.split(instanceTagsConfig, ',')) {
Preconditions.checkArgument(TagNameUtils.isBrokerTag(instanceTag), "Illegal broker instance tag: %s",
instanceTag);
instanceConfig.addTag(instanceTag);
}
shouldUpdateBrokerResource = true;
} else {
instanceConfig.addTag(Helix.UNTAGGED_BROKER_INSTANCE);
}
instanceConfig.addTag(Helix.UNTAGGED_BROKER_INSTANCE);
}
instanceTags = instanceConfig.getTags();
updated = true;
Expand Down

0 comments on commit 3b21b15

Please sign in to comment.