@Override
  public boolean updateDiskCapacity(int diskCapacity) {
    if (diskCapacity < 0) {
      throw new IllegalArgumentException("Disk capacity has to be positive");
    }
    boolean success = false;
    synchronized (helixAdministrationLock) {
      try {
        InstanceConfig instanceConfig = helixAdmin.getInstanceConfig(clusterName, instanceName);
        Map<String, Integer> capacityMap = new HashMap<>(instanceConfig.getInstanceCapacityMap());
        // If the capacity is already the target value, then just return success
        if (capacityMap.getOrDefault(DISK_KEY, -1) != diskCapacity) {
          capacityMap.put(DISK_KEY, diskCapacity);
          instanceConfig.setInstanceCapacityMap(capacityMap);
          helixAdmin.setInstanceConfig(clusterName, instanceName, instanceConfig);
          participantMetrics.updateDiskCapacityCounter.inc();
        }
        success = true;
      } catch (Exception e) {
        logger.error("Failed to update disk capacity: {}", diskCapacity, e);
      }
    }
    return success;
  }
Get the latest maintenance record. We are assuming this will only be called after cluster enters maintenance mode
so the maintanance record should not be empty. It will throw an exception if there is no maintenance record present
in helix.
@return The latest {@link MaintenanceRecord}.
@throws Exception
ambry-clustermap/src/main/java/com/github/ambry/clustermap/HelixParticipant.java