log("DataNode upgrade with future stored layout version in current", numDirs);
UpgradeUtilities.createStorageDirs(NAME_NODE, nameNodeDirs, "current");
cluster = new MiniDFSCluster(conf, 0, StartupOption.UPGRADE);
baseDirs = UpgradeUtilities.createStorageDirs(DATA_NODE, dataNodeDirs, "current");
UpgradeUtilities.createVersionFile(DATA_NODE, baseDirs,
new StorageInfo(Integer.MIN_VALUE,
UpgradeUtilities.getCurrentNamespaceID(cluster),
UpgradeUtilities.getCurrentFsscTime(cluster)));
startDataNodeShouldFail(StartupOption.REGULAR);
cluster.shutdown();
UpgradeUtilities.createEmptyDirs(nameNodeDirs);
UpgradeUtilities.createEmptyDirs(dataNodeDirs);
log("DataNode upgrade with newer fsscTime in current", numDirs);
UpgradeUtilities.createStorageDirs(NAME_NODE, nameNodeDirs, "current");
cluster = new MiniDFSCluster(conf, 0, StartupOption.UPGRADE);
baseDirs = UpgradeUtilities.createStorageDirs(DATA_NODE, dataNodeDirs, "current");
UpgradeUtilities.createVersionFile(DATA_NODE, baseDirs,
new StorageInfo(UpgradeUtilities.getCurrentLayoutVersion(),
UpgradeUtilities.getCurrentNamespaceID(cluster),
Long.MAX_VALUE));
startDataNodeShouldFail(StartupOption.REGULAR);
cluster.shutdown();
UpgradeUtilities.createEmptyDirs(nameNodeDirs);
UpgradeUtilities.createEmptyDirs(dataNodeDirs);
log("NameNode upgrade with no edits file", numDirs);
baseDirs = UpgradeUtilities.createStorageDirs(NAME_NODE, nameNodeDirs, "current");
for (File f : baseDirs) {
FileUtil.fullyDelete(new File(f,"edits"));
}
startNameNodeShouldFail(StartupOption.UPGRADE);
UpgradeUtilities.createEmptyDirs(nameNodeDirs);
log("NameNode upgrade with no image file", numDirs);
baseDirs = UpgradeUtilities.createStorageDirs(NAME_NODE, nameNodeDirs, "current");
for (File f : baseDirs) {
FileUtil.fullyDelete(new File(f,"fsimage"));
}
startNameNodeShouldFail(StartupOption.UPGRADE);
UpgradeUtilities.createEmptyDirs(nameNodeDirs);
log("NameNode upgrade with corrupt version file", numDirs);
baseDirs = UpgradeUtilities.createStorageDirs(NAME_NODE, nameNodeDirs, "current");
for (File f : baseDirs) {
UpgradeUtilities.corruptFile(new File(f,"VERSION"));
}
startNameNodeShouldFail(StartupOption.UPGRADE);
UpgradeUtilities.createEmptyDirs(nameNodeDirs);
log("NameNode upgrade with old layout version in current", numDirs);
baseDirs = UpgradeUtilities.createStorageDirs(NAME_NODE, nameNodeDirs, "current");
UpgradeUtilities.createVersionFile(NAME_NODE, baseDirs,
new StorageInfo(Storage.LAST_UPGRADABLE_LAYOUT_VERSION + 1,
UpgradeUtilities.getCurrentNamespaceID(null),
UpgradeUtilities.getCurrentFsscTime(null)));
startNameNodeShouldFail(StartupOption.UPGRADE);
UpgradeUtilities.createEmptyDirs(nameNodeDirs);
log("NameNode upgrade with future layout version in current", numDirs);
baseDirs = UpgradeUtilities.createStorageDirs(NAME_NODE, nameNodeDirs, "current");
UpgradeUtilities.createVersionFile(NAME_NODE, baseDirs,
new StorageInfo(Integer.MIN_VALUE,
UpgradeUtilities.getCurrentNamespaceID(null),
UpgradeUtilities.getCurrentFsscTime(null)));
startNameNodeShouldFail(StartupOption.UPGRADE);
UpgradeUtilities.createEmptyDirs(nameNodeDirs);
} // end numDir loop