private void doUpgrade(final StorageDirectory sd, final NamespaceInfo nsInfo, final File prevDir, final File tmpDir, final File bbwDir, final File toDir, final int oldLV, Configuration conf) throws IOException { // 3.2. Link block files from <SD>/previous.tmp to <SD>/current linkAllBlocks(tmpDir, bbwDir, toDir, oldLV, conf); // 4. Write version file under <SD>/current clusterID = nsInfo.getClusterID(); upgradeProperties(sd, conf); // 5. Rename <SD>/previous.tmp to <SD>/previous rename(tmpDir, prevDir); LOG.info("Upgrade of {} is complete", sd.getRoot()); }
final File bbwDir = new File(sd.getRoot(), Storage.STORAGE_1_BBW); rename(prevDir, tmpDir);
rename(curDir, tmpDir);
private void doUpgrade(final StorageDirectory sd, final NamespaceInfo nsInfo, final File prevDir, final File tmpDir, final File bbwDir, final File toDir, final int oldLV, Configuration conf) throws IOException { // 3.2. Link block files from <SD>/previous.tmp to <SD>/current linkAllBlocks(tmpDir, bbwDir, toDir, oldLV, conf); // 4. Write version file under <SD>/current clusterID = nsInfo.getClusterID(); upgradeProperties(sd); // 5. Rename <SD>/previous.tmp to <SD>/previous rename(tmpDir, prevDir); LOG.info("Upgrade of " + sd.getRoot()+ " is complete"); }
void doFinalize(StorageDirectory sd) throws IOException { File prevDir = sd.getPreviousDir(); if (!prevDir.exists()) return; // already discarded final String dataDirPath = sd.getRoot().getCanonicalPath(); LOG.info("Finalizing upgrade for storage directory " + dataDirPath + ".\n cur LV = " + this.getLayoutVersion() + "; cur CTime = " + this.getCTime()); assert sd.getCurrentDir().exists() : "Current directory must exist."; final File tmpDir = sd.getFinalizedTmp(); // rename previous to tmp rename(prevDir, tmpDir); // delete tmp dir in a separate thread new Daemon(new Runnable() { public void run() { try { deleteDir(tmpDir); } catch(IOException ex) { LOG.error("Finalize upgrade for " + dataDirPath + " failed.", ex); } LOG.info("Finalize upgrade for " + dataDirPath + " is complete."); } public String toString() { return "Finalize " + dataDirPath; } }).start(); }
File tmpDir = sd.getPreviousTmp(); rename(tmpDir, prevDir); LOG.info("Upgrade of " + sd.getRoot()+ " is complete.");
void doFinalize(StorageDirectory sd) throws IOException { File prevDir = sd.getPreviousDir(); if (!prevDir.exists()) return; // already discarded final String dataDirPath = sd.getRoot().getCanonicalPath(); LOG.info("Finalizing upgrade for storage directory " + dataDirPath + ".\n cur LV = " + this.getLayoutVersion() + "; cur CTime = " + this.getCTime()); assert sd.getCurrentDir().exists() : "Current directory must exist."; final File tmpDir = sd.getFinalizedTmp(); // rename previous to tmp rename(prevDir, tmpDir); // delete tmp dir in a separate thread new Daemon(new Runnable() { public void run() { try { deleteDir(tmpDir); } catch(IOException ex) { LOG.error("Finalize upgrade for " + dataDirPath + " failed.", ex); } LOG.info("Finalize upgrade for " + dataDirPath + " is complete."); } public String toString() { return "Finalize " + dataDirPath; } }).start(); }
private void doUpgrade(final StorageDirectory sd, final NamespaceInfo nsInfo, final File prevDir, final File tmpDir, final File bbwDir, final File toDir, final int oldLV, Configuration conf) throws IOException { // 3.2. Link block files from <SD>/previous.tmp to <SD>/current linkAllBlocks(tmpDir, bbwDir, toDir, oldLV, conf); // 4. Write version file under <SD>/current clusterID = nsInfo.getClusterID(); upgradeProperties(sd); // 5. Rename <SD>/previous.tmp to <SD>/previous rename(tmpDir, prevDir); LOG.info("Upgrade of " + sd.getRoot()+ " is complete"); }
final File bbwDir = new File(sd.getRoot(), Storage.STORAGE_1_BBW); rename(prevDir, tmpDir);
final File bbwDir = new File(sd.getRoot(), Storage.STORAGE_1_BBW); rename(prevDir, tmpDir);
rename(curDir, tmpDir);
rename(curDir, tmpDir);