private static void addVolumes(VolumeManager fs, SiteConfiguration siteConfig,
Configuration hadoopConf) throws IOException {
String[] volumeURIs = VolumeConfiguration.getVolumeUris(siteConfig, hadoopConf);
HashSet<String> initializedDirs = new HashSet<>();
initializedDirs.addAll(
Arrays.asList(ServerConstants.checkBaseUris(siteConfig, hadoopConf, volumeURIs, true)));
HashSet<String> uinitializedDirs = new HashSet<>();
uinitializedDirs.addAll(Arrays.asList(volumeURIs));
uinitializedDirs.removeAll(initializedDirs);
Path aBasePath = new Path(initializedDirs.iterator().next());
Path iidPath = new Path(aBasePath, ServerConstants.INSTANCE_ID_DIR);
Path versionPath = new Path(aBasePath, ServerConstants.VERSION_DIR);
UUID uuid = UUID.fromString(ZooUtil.getInstanceIDFromHdfs(iidPath, siteConfig, hadoopConf));
for (Pair<Path,Path> replacementVolume : ServerConstants.getVolumeReplacements(siteConfig,
hadoopConf)) {
if (aBasePath.equals(replacementVolume.getFirst()))
log.error(
"{} is set to be replaced in {} and should not appear in {}."
+ " It is highly recommended that this property be removed as data"
+ " could still be written to this volume.",
aBasePath, Property.INSTANCE_VOLUMES_REPLACEMENTS, Property.INSTANCE_VOLUMES);
}
if (ServerUtil.getAccumuloPersistentVersion(versionPath.getFileSystem(hadoopConf),
versionPath) != ServerConstants.DATA_VERSION) {
throw new IOException("Accumulo " + Constants.VERSION + " cannot initialize data version "
+ ServerUtil.getAccumuloPersistentVersion(fs));
}
initDirs(fs, uuid, uinitializedDirs.toArray(new String[uinitializedDirs.size()]), true);
}