xiangfu0 commented on code in PR #17375:
URL: https://github.com/apache/pinot/pull/17375#discussion_r2664300747
##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java:
##########
@@ -3562,6 +3562,38 @@ public List<String> getBrokerInstancesForTable(String
tableName, TableType table
}
public PinotResourceManagerResponse enableInstance(String instanceName) {
+ // If enabling a drained minion, restore to its previous tags
+ if (InstanceTypeUtils.isMinion(instanceName)) {
+ InstanceConfig instanceConfig = getHelixInstanceConfig(instanceName);
+ if (instanceConfig == null) {
+ return PinotResourceManagerResponse.failure("Instance " + instanceName
+ " not found");
+ }
+ List<String> currentTags = instanceConfig.getTags();
+ if (currentTags != null &&
currentTags.contains(Helix.DRAINED_MINION_INSTANCE)) {
+ // Restore pre-drain tags
+ List<String> preDrainTags =
instanceConfig.getRecord().getListField(Helix.PREVIOUS_TAGS);
+ if (preDrainTags != null && !preDrainTags.isEmpty()) {
+ instanceConfig.getRecord().setListField(
+ InstanceConfig.InstanceConfigProperty.TAG_LIST.name(), new
ArrayList<>(preDrainTags));
+ // Clear the stored pre-drain tags
+
instanceConfig.getRecord().getListFields().remove(Helix.PREVIOUS_TAGS);
+ // Save the updated config
+ if
(!_helixDataAccessor.setProperty(_keyBuilder.instanceConfig(instanceName),
instanceConfig)) {
+ return PinotResourceManagerResponse.failure(
+ "Failed to restore pre-drain tags for minion instance: " +
instanceName);
+ }
+ LOGGER.info("Restored pre-drain tags for minion instance: {}",
instanceName);
+ // Return success immediately for drained minions - no need to wait
for partition states
+ // since minions don't have partitions like servers do
+ return PinotResourceManagerResponse.success("Successfully restored
tags for minion instance: "
Review Comment:
I think we still need to process the code for `enableInstance(xxxxxx)`.
--
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]