protected DistributedFileSystem getDFS() throws IOException { FileSystem fs = getFS(); if (!(fs instanceof DistributedFileSystem)) { throw new IllegalArgumentException("FileSystem " + fs.getUri() + " is not an HDFS file system"); } return (DistributedFileSystem)fs; }
FileSystem fs = getFS(); if (!(fs instanceof DistributedFileSystem)) { System.err.println("FileSystem is " + fs.getUri());
protected DistributedFileSystem getDFS() throws IOException { FileSystem fs = getFS(); if (!(fs instanceof DistributedFileSystem)) { throw new IllegalArgumentException("FileSystem " + fs.getUri() + " is not an HDFS file system"); } return (DistributedFileSystem)fs; }
protected DistributedFileSystem getDFS() throws IOException { FileSystem fs = getFS(); if (!(fs instanceof DistributedFileSystem)) { throw new IllegalArgumentException("FileSystem " + fs.getUri() + " is not an HDFS file system"); } return (DistributedFileSystem)fs; }
/** * Command to ask the namenode to finalize previously performed upgrade. * Usage: java DFSAdmin -finalizeUpgrade * @exception IOException */ public int finalizeUpgrade() throws IOException { int exitCode = -1; DistributedFileSystem dfs = getDFS(); if (dfs == null) { System.out.println("FileSystem is " + getFS().getUri()); return exitCode; } dfs.finalizeUpgrade(); exitCode = 0; return exitCode; }
/** * Command to ask the namenode to reread the hosts and excluded hosts * file. * Usage: java DFSAdmin -refreshNodes * @exception IOException */ public int refreshNodes() throws IOException { int exitCode = -1; DistributedFileSystem dfs = getDFS(); if (dfs == null) { System.err.println("FileSystem is " + getFS().getUri()); return exitCode; } dfs.refreshNodes(); exitCode = 0; return exitCode; }
protected DistributedFileSystem getDFS() throws IOException{ FileSystem fs = getFS(); DistributedFileSystem dfs = null; if (fs instanceof DistributedFileSystem) { dfs = (DistributedFileSystem) fs; } else { if (fs instanceof FilterFileSystem) { FilterFileSystem ffs = (FilterFileSystem) fs; if (ffs.getRawFileSystem() instanceof DistributedFileSystem) { dfs = (DistributedFileSystem) ffs.getRawFileSystem(); } } } return dfs; }
/** * Dumps DFS data structures into specified file. * Usage: java DFSAdmin -metasave filename * @param argv List of of command line parameters. * @param idx The index of the command that is being processed. * @exception IOException if an error accoured wile accessing * the file or path. */ public int metaSave(String[] argv, int idx) throws IOException { String pathname = argv[idx]; DistributedFileSystem dfs = getDFS(); if (dfs == null) { System.out.println("FileSystem is " + getFS().getUri()); return -1; } dfs.metaSave(pathname); System.out.println("Created file " + pathname + " on server " + dfs.getUri()); return 0; }
/** * Command to ask the namenode to save the namespace. * Usage: java DFSAdmin -saveNamespace [force] [uncompressed] * * @param argv List of of command line parameters. * @param idx The index of the command that is being processed. * @exception IOException */ public int saveNamespace(String[] argv, int idx) throws IOException { int exitCode = -1; DistributedFileSystem dfs = getDFS(); if (dfs == null) { System.err.println("FileSystem is " + getFS().getUri()); return exitCode; } boolean force = false; boolean uncompressed = false; for( ; idx < argv.length; idx++) { if (argv[idx].equals("force")) { force = true; } else if (argv[idx].equals("uncompressed")) { uncompressed = true; } else { printUsage("saveNamespace"); return exitCode; } } dfs.saveNamespace(force, uncompressed); return 0; }
DistributedFileSystem dfs = getDFS(); if (dfs == null) { System.out.println("FileSystem is " + getFS().getUri()); return -1;
DistributedFileSystem dfs = getDFS(); if (dfs == null) { System.err.println("FileSystem is " + getFS().getUri()); return;
FileSystem fs = getFS(); if (!(fs instanceof DistributedFileSystem)) { System.err.println("FileSystem is " + fs.getUri());
FileSystem fs = getFS(); if (!(fs instanceof DistributedFileSystem)) { System.err.println("FileSystem is " + fs.getUri());
exitCode = metaSave(argv, i); } else if (ClearQuotaCommand.matches(cmd)) { exitCode = new ClearQuotaCommand(argv, i, getFS()).runAll(); } else if (SetQuotaCommand.matches(cmd)) { exitCode = new SetQuotaCommand(argv, i, getFS()).runAll(); } else if (ClearSpaceQuotaCommand.matches(cmd)) { exitCode = new ClearSpaceQuotaCommand(argv, i, getFS()).runAll(); } else if (SetSpaceQuotaCommand.matches(cmd)) { exitCode = new SetSpaceQuotaCommand(argv, i, getFS()).runAll(); } else if ("-refreshServiceAcl".equals(cmd)) { exitCode = refreshServiceAcl(); exitCode = new RecountCommand(getFS()).runAll(); } else { exitCode = -1;