final ResourceId resourceId, final Set<PartitionId> partitionIdSet) {
String participantName = participantId.stringify();
String resourceName = resourceId.stringify();
// check instanceConfig exists
PropertyKey instanceConfigKey = _keyBuilder.instanceConfig(participantName);
if (_accessor.getProperty(instanceConfigKey) == null) {
LOG.error("Config for participant: " + participantId + " does NOT exist in cluster");
return false;
}
// check resource exist. warn if not
IdealState idealState = _accessor.getProperty(_keyBuilder.idealStates(resourceName));
if (idealState == null) {
LOG.warn("Disable partitions: " + partitionIdSet + ", resource: " + resourceId
+ " does NOT exist. probably disable it during ERROR->DROPPED transtition");
} else {
// check partitions exist. warn if not
for (PartitionId partitionId : partitionIdSet) {
if ((idealState.getRebalanceMode() == RebalanceMode.SEMI_AUTO && idealState
.getPreferenceList(partitionId) == null)
|| (idealState.getRebalanceMode() == RebalanceMode.CUSTOMIZED && idealState
.getParticipantStateMap(partitionId) == null)) {
LOG.warn("Resource: " + resourceId + ", partition: " + partitionId
+ ", partition does NOT exist in ideal state");
}
}
}
BaseDataAccessor<ZNRecord> baseAccessor = _accessor.getBaseDataAccessor();
final List<String> partitionNames = new ArrayList<String>();
for (PartitionId partitionId : partitionIdSet) {
partitionNames.add(partitionId.stringify());
}
return baseAccessor.update(instanceConfigKey.getPath(), new DataUpdater<ZNRecord>() {
@Override
public ZNRecord update(ZNRecord currentData) {
if (currentData == null) {
throw new HelixException("Instance: " + participantId + ", participant config is null");
}