datas[partitionId][chunk].close();
}
}
// Start moving files over to their correct node
RoutingStrategy strategy = new RoutingStrategyFactory().updateRoutingStrategy(storeDefinition,
cluster);
Map<Integer, Integer> replicaMapping = cluster.getPartitionIdToNodeIdMap();
for(File file: tempDirectory.listFiles()) {
String fileName = file.getName();
if(fileName.matches("^[\\d]+_[\\d]+_[\\d]+\\.(data|index)")) {
String[] props = fileName.split("_");
int partitionId = Integer.parseInt(props[0]);
int replicaType = Integer.parseInt(props[1]);
int nodeId = replicaMapping.get(strategy.getReplicatingPartitionList(partitionId)
.get(replicaType));
Utils.move(file, new File(nodeDirs.get(nodeId), fileName));
}
}