private void copyConfigDirFromZk(String fromZkPath, String toZkPath, Set<String> copiedToZkPaths) throws IOException {
try {
List<String> files = zkClient.getChildren(fromZkPath, null, true);
for (String file : files) {
List<String> children = zkClient.getChildren(fromZkPath + "/" + file, null, true);
if (children.size() == 0) {
final String toZkFilePath = toZkPath + "/" + file;
log.info("Copying zk node {} to {}",
fromZkPath + "/" + file, toZkFilePath);
byte[] data = zkClient.getData(fromZkPath + "/" + file, null, null, true);
zkClient.makePath(toZkFilePath, data, true);
if (copiedToZkPaths != null) copiedToZkPaths.add(toZkFilePath);
} else {
copyConfigDirFromZk(fromZkPath + "/" + file, toZkPath + "/" + file, copiedToZkPaths);
}
}
} catch (KeeperException | InterruptedException e) {
throw new IOException("Error copying nodes from zookeeper path " + fromZkPath + " to " + toZkPath,
SolrZkClient.checkInterrupted(e));
}
}