public static synchronized int getAccumuloPersistentVersion(Volume v) { Path path = ServerConstants.getDataVersionLocation(v); return getAccumuloPersistentVersion(v.getFileSystem(), path); }
public static synchronized void updateAccumuloVersion(VolumeManager fs, int oldVersion) { for (Volume volume : fs.getVolumes()) { try { if (getAccumuloPersistentVersion(volume) == oldVersion) { log.debug("Attempting to upgrade {}", volume); Path dataVersionLocation = ServerConstants.getDataVersionLocation(volume); fs.create(new Path(dataVersionLocation, Integer.toString(ServerConstants.DATA_VERSION))) .close(); // TODO document failure mode & recovery if FS permissions cause above to work and below // to fail ACCUMULO-2596 Path prevDataVersionLoc = new Path(dataVersionLocation, Integer.toString(oldVersion)); if (!fs.delete(prevDataVersionLoc)) { throw new RuntimeException("Could not delete previous data version location (" + prevDataVersionLoc + ") for " + volume); } } } catch (IOException e) { throw new RuntimeException("Unable to set accumulo version: an error occurred.", e); } } }
public static synchronized void updateAccumuloVersion(FileSystem fs) { try { if (getAccumuloPersistentVersion(fs) == Constants.PREV_DATA_VERSION) { fs.create(new Path(ServerConstants.getDataVersionLocation() + "/" + Constants.DATA_VERSION)); // TODO document failure mode & recovery if FS permissions cause above to work and below to fail ACCUMULO-2596 fs.delete(new Path(ServerConstants.getDataVersionLocation() + "/" + Constants.PREV_DATA_VERSION), false); } } catch (IOException e) { throw new RuntimeException("Unable to set accumulo version: an error occurred.", e); } }
public static synchronized int getAccumuloPersistentVersion(FileSystem fs) { int dataVersion; try { FileStatus[] files = fs.listStatus(ServerConstants.getDataVersionLocation()); if (files == null || files.length == 0) { dataVersion = -1; // assume it is 0.5 or earlier } else { dataVersion = Integer.parseInt(files[0].getPath().getName()); } return dataVersion; } catch (IOException e) { throw new RuntimeException("Unable to read accumulo version: an error occurred.", e); } }
public static boolean isInitialized(FileSystem fs) throws IOException { return (fs.exists(ServerConstants.getInstanceIdLocation()) || fs.exists(ServerConstants.getDataVersionLocation())); }
public static synchronized int getAccumuloPersistentVersion(Volume v) { Path path = ServerConstants.getDataVersionLocation(v); return getAccumuloPersistentVersion(v.getFileSystem(), path); }
public static synchronized void updateAccumuloVersion(VolumeManager fs, int oldVersion) { for (Volume volume : fs.getVolumes()) { try { if (getAccumuloPersistentVersion(volume) == oldVersion) { log.debug("Attempting to upgrade " + volume); Path dataVersionLocation = ServerConstants.getDataVersionLocation(volume); fs.create(new Path(dataVersionLocation, Integer.toString(ServerConstants.DATA_VERSION))) .close(); // TODO document failure mode & recovery if FS permissions cause above to work and below // to fail ACCUMULO-2596 Path prevDataVersionLoc = new Path(dataVersionLocation, Integer.toString(oldVersion)); if (!fs.delete(prevDataVersionLoc)) { throw new RuntimeException("Could not delete previous data version location (" + prevDataVersionLoc + ") for " + volume); } } } catch (IOException e) { throw new RuntimeException("Unable to set accumulo version: an error occurred.", e); } } }
fs.mkdirs(new Path(ServerConstants.getDataVersionLocation(), "" + Constants.DATA_VERSION));