/** * Upgrade command to get the status of upgrade or ask NameNode to finalize * the previously performed upgrade. * Usage: hdfs dfsadmin -upgrade [query | finalize] * @exception IOException */ public int upgrade(String arg) throws IOException { UpgradeAction action; if ("query".equalsIgnoreCase(arg)) { action = UpgradeAction.QUERY; } else if ("finalize".equalsIgnoreCase(arg)) { action = UpgradeAction.FINALIZE; } else { printUsage("-upgrade"); return -1; } switch (action) { case QUERY: return getUpgradeStatus(); case FINALIZE: return finalizeUpgrade(); default: printUsage("-upgrade"); return -1; } }