* @throws JSONException
*/
public static List<Integer> getPartitionsToAdd(ZooKeeper zk, JSONObject topo)
throws JSONException
{
ClusterConfig clusterConfig = new ClusterConfig(topo);
List<Integer> newPartitions = new ArrayList<Integer>();
Set<Integer> existingParts = new HashSet<Integer>(getPartitions(zk));
// Remove MPI
existingParts.remove(MpInitiator.MP_INIT_PID);
int partsToAdd = clusterConfig.getPartitionCount() - existingParts.size();
if (partsToAdd > 0) {
hostLog.info("Computing new partitions to add. Total partitions: " + clusterConfig.getPartitionCount());
for (int i = 0; newPartitions.size() != partsToAdd; i++) {
if (!existingParts.contains(i)) {
newPartitions.add(i);
}
}