public FSDataOutputStream getOutputStream(final String path) throws IOException { FileSystem fileSystem = fs.getDefaultVolume().getFileSystem(); return fileSystem.create(new Path(path)); }
public FSDataInputStream getInputStream(final String path) throws IOException { FileSystem fileSystem = fs.getDefaultVolume().getFileSystem(); return fileSystem.open(new Path(path)); }
/** * Always check for and delete the splits file if it exists to prevent issues in case of server * failure and/or FateServiceHandler retries. */ private void removeAndCreateTempFile(String path) throws IOException { FileSystem fs = master.getFileSystem().getDefaultVolume().getFileSystem(); if (fs.exists(new Path(path))) fs.delete(new Path(path), true); fs.create(new Path(path)); }
/** * Get full path to location where initial splits are stored on file system. */ private String getSplitPath(String relPath) { Volume defaultVolume = master.getFileSystem().getDefaultVolume(); String uri = defaultVolume.getFileSystem().getUri().toString(); String basePath = defaultVolume.getBasePath(); return uri + basePath + relPath; } }
private void cleanupSplitFiles(Master env) throws IOException { Volume defaultVolume = env.getFileSystem().getDefaultVolume(); FileSystem fs = defaultVolume.getFileSystem(); fs.delete(new Path(tableInfo.getSplitFile()), true); fs.delete(new Path(tableInfo.getSplitDirsFile()), true); }
/** * Write the SortedSet of Tablet Directory names to the file system for use in the next phase of * the FATE operation. */ private void writeTabletDirectoriesToFileSystem(Master master, SortedSet<Text> dirs) throws IOException { FileSystem fs = master.getFileSystem().getDefaultVolume().getFileSystem(); if (fs.exists(new Path(tableInfo.getSplitDirsFile()))) fs.delete(new Path(tableInfo.getSplitDirsFile()), true); try (FSDataOutputStream stream = master.getOutputStream(tableInfo.getSplitDirsFile())) { for (Text dir : dirs) stream.writeBytes(dir + "\n"); } }
@Override public void execute(final String[] args) throws Exception { Opts opts = new Opts(); opts.parseArgs(ZooKeeperMain.class.getName(), args); try (ServerContext context = new ServerContext(new SiteConfiguration())) { FileSystem fs = context.getVolumeManager().getDefaultVolume().getFileSystem(); String baseDir = ServerConstants.getBaseUris(context)[0]; System.out.println("Using " + fs.makeQualified(new Path(baseDir + "/instance_id")) + " to lookup accumulo instance"); if (opts.servers == null) { opts.servers = context.getZooKeepers(); } System.out.println("The accumulo instance id is " + context.getInstanceID()); if (!opts.servers.contains("/")) opts.servers += "/accumulo/" + context.getInstanceID(); org.apache.zookeeper.ZooKeeperMain .main(new String[] {"-server", opts.servers, "-timeout", "" + (opts.timeout * 1000)}); } } }
@Override public void execute(final String[] args) throws Exception { Opts opts = new Opts(); opts.parseArgs(ZooKeeperMain.class.getName(), args); FileSystem fs = VolumeManagerImpl.get().getDefaultVolume().getFileSystem(); String baseDir = ServerConstants.getBaseUris()[0]; System.out.println("Using " + fs.makeQualified(new Path(baseDir + "/instance_id")) + " to lookup accumulo instance"); Instance instance = HdfsZooInstance.getInstance(); if (opts.servers == null) { opts.servers = instance.getZooKeepers(); } System.out.println("The accumulo instance id is " + instance.getInstanceID()); if (!opts.servers.contains("/")) opts.servers += "/accumulo/" + instance.getInstanceID(); org.apache.zookeeper.ZooKeeperMain .main(new String[] {"-server", opts.servers, "-timeout", "" + (opts.timeout * 1000)}); } }