private boolean confirmForceManual() throws IOException { return ToolRunner.confirmPrompt( "You have specified the --" + FORCEMANUAL + " flag. This flag is " + "dangerous, as it can induce a split-brain scenario that WILL " + "CORRUPT your HDFS namespace, possibly irrecoverably.\n" + "\n" + "It is recommended not to use this flag, but instead to shut down the " + "cluster and disable automatic failover if you prefer to manually " + "manage your HA state.\n" + "\n" + "You may abort safely by answering 'n' or hitting ^C now.\n" + "\n" + "Are you sure you want to continue?"); }
private boolean confirmFormat() { String parentZnode = getParentZnode(); System.err.println( "===============================================\n" + "The configured parent znode " + parentZnode + " already exists.\n" + "Are you sure you want to clear all failover information from\n" + "ZooKeeper?\n" + "WARNING: Before proceeding, ensure that all HDFS services and\n" + "failover controllers are stopped!\n" + "==============================================="); try { return ToolRunner.confirmPrompt("Proceed formatting " + parentZnode + "?"); } catch (IOException e) { LOG.debug("Failed to confirm", e); return false; } }
private boolean canBeSafelyDeleted(PathData item) throws IOException { boolean shouldDelete = true; if (safeDelete) { final long deleteLimit = getConf().getLong( HADOOP_SHELL_SAFELY_DELETE_LIMIT_NUM_FILES, HADOOP_SHELL_SAFELY_DELETE_LIMIT_NUM_FILES_DEFAULT); if (deleteLimit > 0) { ContentSummary cs = item.fs.getContentSummary(item.path); final long numFiles = cs.getFileCount(); if (numFiles > deleteLimit) { if (!ToolRunner.confirmPrompt("Proceed deleting " + numFiles + " files?")) { System.err.println("Delete aborted at user request.\n"); shouldDelete = false; } } } } return shouldDelete; }
try { cont = ToolRunner .confirmPrompt("You are about to DELETE the credential " + alias + " from CredentialProvider " + provider.toString() + ". Continue? ");
@Override public boolean validate() { provider = getKeyProvider(); if (provider == null) { return false; } if (keyName == null) { getOut().println("There is no keyName specified. Please specify a " + "<keyname>. See the usage description with -help."); return false; } if (interactive) { try { cont = ToolRunner .confirmPrompt("You are about to DELETE all versions of " + " key " + keyName + " from KeyProvider " + provider + ". Continue? "); if (!cont) { getOut().println(keyName + " has not been deleted."); } return cont; } catch (IOException e) { getOut().println(keyName + " will not be deleted. " + prettifyException(e)); } } return true; }
return false; if (!ToolRunner.confirmPrompt("Re-format filesystem in " + item + " ?")) { System.err.println("Format aborted in " + item); return false;
@VisibleForTesting public static boolean doRollback(Configuration conf, boolean isConfirmationNeeded) throws IOException { String nsId = DFSUtil.getNamenodeNameServiceId(conf); String namenodeId = HAUtil.getNameNodeId(conf, nsId); initializeGenericKeys(conf, nsId, namenodeId); FSNamesystem nsys = new FSNamesystem(conf, new FSImage(conf)); System.err.print( "\"rollBack\" will remove the current state of the file system,\n" + "returning you to the state prior to initiating your recent.\n" + "upgrade. This action is permanent and cannot be undone. If you\n" + "are performing a rollback in an HA environment, you should be\n" + "certain that no NameNode process is running on any host."); if (isConfirmationNeeded) { if (!confirmPrompt("Roll back file system state?")) { System.err.println("Rollback aborted."); return true; } } nsys.getFSImage().doRollback(nsys); return false; }
initializeGenericKeys(conf, nsId, namenodeId); if (startOpt.getForce() < MetaRecoveryContext.FORCE_ALL) { if (!confirmPrompt("You have selected Metadata Recovery mode. " + "This mode is intended to recover lost metadata on a corrupt " + "filesystem. Metadata recovery mode often permanently deletes " +
private boolean confirmForceManual() throws IOException { return ToolRunner.confirmPrompt( "You have specified the --" + FORCEMANUAL + " flag. This flag is " + "dangerous, as it can induce a split-brain scenario that WILL " + "CORRUPT your HDFS namespace, possibly irrecoverably.\n" + "\n" + "It is recommended not to use this flag, but instead to shut down the " + "cluster and disable automatic failover if you prefer to manually " + "manage your HA state.\n" + "\n" + "You may abort safely by answering 'n' or hitting ^C now.\n" + "\n" + "Are you sure you want to continue?"); }
private boolean confirmForceManual() throws IOException { return ToolRunner.confirmPrompt( "You have specified the --" + FORCEMANUAL + " flag. This flag is " + "dangerous, as it can induce a split-brain scenario that WILL " + "CORRUPT your HDFS namespace, possibly irrecoverably.\n" + "\n" + "It is recommended not to use this flag, but instead to shut down the " + "cluster and disable automatic failover if you prefer to manually " + "manage your HA state.\n" + "\n" + "You may abort safely by answering 'n' or hitting ^C now.\n" + "\n" + "Are you sure you want to continue?"); }
private boolean confirmForceManual() throws IOException { return ToolRunner.confirmPrompt( "You have specified the --" + FORCEMANUAL + " flag. This flag is " + "dangerous, as it can induce a split-brain scenario that WILL " + "CORRUPT your HDFS namespace, possibly irrecoverably.\n" + "\n" + "It is recommended not to use this flag, but instead to shut down the " + "cluster and disable automatic failover if you prefer to manually " + "manage your HA state.\n" + "\n" + "You may abort safely by answering 'n' or hitting ^C now.\n" + "\n" + "Are you sure you want to continue?"); }
private boolean confirmForceManual() throws IOException { return ToolRunner.confirmPrompt( "You have specified the --" + FORCEMANUAL + " flag. This flag is " + "dangerous, as it can induce a split-brain scenario that WILL " + "CORRUPT your HDFS namespace, possibly irrecoverably.\n" + "\n" + "It is recommended not to use this flag, but instead to shut down the " + "cluster and disable automatic failover if you prefer to manually " + "manage your HA state.\n" + "\n" + "You may abort safely by answering 'n' or hitting ^C now.\n" + "\n" + "Are you sure you want to continue?"); }
private boolean confirmFormat() { String parentZnode = getParentZnode(); System.err.println( "===============================================\n" + "The configured parent znode " + parentZnode + " already exists.\n" + "Are you sure you want to clear all failover information from\n" + "ZooKeeper?\n" + "WARNING: Before proceeding, ensure that all HDFS services and\n" + "failover controllers are stopped!\n" + "==============================================="); try { return ToolRunner.confirmPrompt("Proceed formatting " + parentZnode + "?"); } catch (IOException e) { LOG.debug("Failed to confirm", e); return false; } }
private boolean confirmFormat() { String parentZnode = getParentZnode(); System.err.println( "===============================================\n" + "The configured parent znode " + parentZnode + " already exists.\n" + "Are you sure you want to clear all failover information from\n" + "ZooKeeper?\n" + "WARNING: Before proceeding, ensure that all HDFS services and\n" + "failover controllers are stopped!\n" + "==============================================="); try { return ToolRunner.confirmPrompt("Proceed formatting " + parentZnode + "?"); } catch (IOException e) { LOG.debug("Failed to confirm", e); return false; } }
private boolean confirmFormat() { String parentZnode = getParentZnode(); System.err.println( "===============================================\n" + "The configured parent znode " + parentZnode + " already exists.\n" + "Are you sure you want to clear all failover information from\n" + "ZooKeeper?\n" + "WARNING: Before proceeding, ensure that all HDFS services and\n" + "failover controllers are stopped!\n" + "==============================================="); try { return ToolRunner.confirmPrompt("Proceed formatting " + parentZnode + "?"); } catch (IOException e) { LOG.debug("Failed to confirm", e); return false; } }
@Override public boolean validate() { provider = getKeyProvider(); if (provider == null) { return false; } if (keyName == null) { out.println("There is no keyName specified. Please specify a " + "<keyname>. See the usage description with -help."); return false; } if (interactive) { try { cont = ToolRunner .confirmPrompt("You are about to DELETE all versions of " + " key " + keyName + " from KeyProvider " + provider + ". Continue? "); if (!cont) { out.println(keyName + " has not been deleted."); } return cont; } catch (IOException e) { out.println(keyName + " will not be deleted."); e.printStackTrace(err); } } return true; }
private boolean confirmFormat() { String parentZnode = getParentZnode(); System.err.println( "===============================================\n" + "The configured parent znode " + parentZnode + " already exists.\n" + "Are you sure you want to clear all failover information from\n" + "ZooKeeper?\n" + "WARNING: Before proceeding, ensure that all HDFS services and\n" + "failover controllers are stopped!\n" + "==============================================="); try { return ToolRunner.confirmPrompt("Proceed formatting " + parentZnode + "?"); } catch (IOException e) { LOG.debug("Failed to confirm", e); return false; } }
private boolean canBeSafelyDeleted(PathData item) throws IOException { boolean shouldDelete = true; if (safeDelete) { final long deleteLimit = getConf().getLong( HADOOP_SHELL_SAFELY_DELETE_LIMIT_NUM_FILES, HADOOP_SHELL_SAFELY_DELETE_LIMIT_NUM_FILES_DEFAULT); if (deleteLimit > 0) { ContentSummary cs = item.fs.getContentSummary(item.path); final long numFiles = cs.getFileCount(); if (numFiles > deleteLimit) { if (!ToolRunner.confirmPrompt("Proceed deleting " + numFiles + " files?")) { System.err.println("Delete aborted at user request.\n"); shouldDelete = false; } } } } return shouldDelete; }
@VisibleForTesting public static boolean doRollback(Configuration conf, boolean isConfirmationNeeded) throws IOException { String nsId = DFSUtil.getNamenodeNameServiceId(conf); String namenodeId = HAUtil.getNameNodeId(conf, nsId); initializeGenericKeys(conf, nsId, namenodeId); FSNamesystem nsys = new FSNamesystem(conf, new FSImage(conf)); System.err.print( "\"rollBack\" will remove the current state of the file system,\n" + "returning you to the state prior to initiating your recent.\n" + "upgrade. This action is permanent and cannot be undone. If you\n" + "are performing a rollback in an HA environment, you should be\n" + "certain that no NameNode process is running on any host."); if (isConfirmationNeeded) { if (!confirmPrompt("Roll back file system state?")) { System.err.println("Rollback aborted."); return true; } } nsys.getFSImage().doRollback(nsys); return false; }
@VisibleForTesting public static boolean doRollback(Configuration conf, boolean isConfirmationNeeded) throws IOException { String nsId = DFSUtil.getNamenodeNameServiceId(conf); String namenodeId = HAUtil.getNameNodeId(conf, nsId); initializeGenericKeys(conf, nsId, namenodeId); FSNamesystem nsys = new FSNamesystem(conf, new FSImage(conf)); System.err.print( "\"rollBack\" will remove the current state of the file system,\n" + "returning you to the state prior to initiating your recent.\n" + "upgrade. This action is permanent and cannot be undone. If you\n" + "are performing a rollback in an HA environment, you should be\n" + "certain that no NameNode process is running on any host."); if (isConfirmationNeeded) { if (!confirmPrompt("Roll back file system state?")) { System.err.println("Rollback aborted."); return true; } } nsys.getFSImage().doRollback(nsys); return false; }