@Override boolean apply(Path p) throws IOException { return fs.setReplication(p, replication); } }.run(src);
/** * Set replication for an existing file. * * @param src file name * @param replication new replication * @throws IOException * @return true if successful; * false if file does not exist or is a directory */ @Override public boolean setReplication(Path src, short replication) throws IOException { return fs.setReplication(src, replication); }
protected int updateBlobReplication(String key, int replication) throws IOException { Path path = getKeyDir(key); Path dest = new Path(path, BLOBSTORE_DATA); _fs.setReplication(dest, (short) replication); return _fs.getFileStatus(dest).getReplication(); }
@Override public boolean setReplication(Path f, short replication) throws IOException { checkPath(f); return fsImpl.setReplication(f, replication); }
public boolean setReplication(Path src, short replication) throws java.io.IOException { return this.underlyingFs.setReplication(replaceScheme(src, this.replacementScheme, this.underlyingScheme), replication); }
@Override public boolean setReplication(final Path f, final short replication) throws AccessControlException, FileNotFoundException, IOException { InodeTree.ResolveResult<FileSystem> res = fsState.resolve(getUriPath(f), true); return res.targetFileSystem.setReplication(res.remainingPath, replication); }
@Override public OutputStream getOutputStream() throws IOException { checkIsNotTmp(); OutputStream out = null; FsPermission fileperms = new FsPermission(BLOBSTORE_FILE_PERMISSION); try { out = _fs.create(_path, (short)this.getMetadata().get_replication_factor()); _fs.setPermission(_path, fileperms); _fs.setReplication(_path, (short)this.getMetadata().get_replication_factor()); } catch (IOException e) { //Try to create the parent directory, may not work FsPermission dirperms = new FsPermission(HdfsBlobStoreImpl.BLOBSTORE_DIR_PERMISSION); if (!_fs.mkdirs(_path.getParent(), dirperms)) { LOG.warn("error creating parent dir: " + _path.getParent()); } out = _fs.create(_path, (short)this.getMetadata().get_replication_factor()); _fs.setPermission(_path, dirperms); _fs.setReplication(_path, (short)this.getMetadata().get_replication_factor()); } if (out == null) { throw new IOException("Error in creating: " + _path); } return out; }
@Override protected void processPath(PathData item) throws IOException { if (item.stat.isSymlink()) { throw new PathIOException(item.toString(), "Symlinks unsupported"); } if (item.stat.isFile()) { // Do the checking if the file is erasure coded since // replication factor for an EC file is meaningless. if (!item.stat.isErasureCoded()) { if (!item.fs.setReplication(item.path, newRep)) { throw new IOException("Could not set replication for: " + item); } out.println("Replication " + newRep + " set: " + item); if (waitOpt) { waitList.add(item); } } else { out.println("Did not set replication for: " + item + ", because it's an erasure coded file."); } } }
fs.setReplication(planPath, replication);
fs.setReplication(planPath, replication);
short replication = (short) job.getInt("mapred.submit.replication", 10); hdfs.copyFromLocalFile(archivePath, hdfsFilePath); hdfs.setReplication(hdfsFilePath, replication); LOG.info("Upload 1 archive file from" + archivePath + " to: " + hdfsFilePath);
short replication = (short) job.getInt("mapred.submit.replication", 10); hdfs.copyFromLocalFile(archivePath, hdfsFilePath); hdfs.setReplication(hdfsFilePath, replication); LOG.info("Upload 1 archive file from" + archivePath + " to: " + hdfsFilePath);
@Override boolean apply(Path p) throws IOException { return fs.setReplication(p, replication); } }.run(src);
/** * Set replication for an existing file. * * @param src file name * @param replication new replication * @throws IOException * @return true if successful; * false if file does not exist or is a directory */ public boolean setReplication(Path src, short replication) throws IOException { return fs.setReplication(src, replication); }
@Override public boolean setReplication(Path src, short replication) throws IOException { try { return underlyingFs.setReplication(src, replication); } catch(FSError e) { throw propagateFSError(e); } }
@Override public boolean setReplication(final Path f, final short replication) throws AccessControlException, FileNotFoundException, IOException { return fs.setReplication(f, replication); }
@Override public boolean setReplication(Path f, short replication) throws IOException { checkPath(f); return fsImpl.setReplication(f, replication); }
private static FSDataOutputStream createFile(FileSystem fs, Path splitFile, Configuration job) throws IOException { FSDataOutputStream out = FileSystem.create(fs, splitFile, new FsPermission(JobSubmissionFiles.JOB_FILE_PERMISSION)); int replication = job.getInt(Job.SUBMIT_REPLICATION, 10); fs.setReplication(splitFile, (short)replication); writeSplitHeader(out); return out; } private static void writeSplitHeader(FSDataOutputStream out)
@Override public boolean setReplication(final Path f, final short replication) throws AccessControlException, FileNotFoundException, IOException { InodeTree.ResolveResult<FileSystem> res = fsState.resolve(getUriPath(f), true); return res.targetFileSystem.setReplication(res.remainingPath, replication); }
@Override void modify() throws Exception { assertTrue(fs.exists(file)); fs.setReplication(file, newReplication); } }