UnderFileSystemUtils.touch(ufs, URIUtils.appendPath(mLocation, ServerConfiguration.get(PropertyKey.MASTER_FORMAT_FILE_PREFIX) + System.currentTimeMillis())
/** * Formats the journal. */ public void format() throws IOException { URI location = getLocation(); LOG.info("Formatting {}", location); if (mUfs.isDirectory(location.toString())) { for (UfsStatus status : mUfs.listStatus(location.toString())) { String childPath = URIUtils.appendPathOrDie(location, status.getName()).toString(); if (status.isDirectory() && !mUfs.deleteDirectory(childPath, DeleteOptions.defaults().setRecursive(true)) || status.isFile() && !mUfs.deleteFile(childPath)) { throw new IOException(String.format("Failed to delete %s", childPath)); } } } else if (!mUfs.mkdirs(location.toString())) { throw new IOException(String.format("Failed to create %s", location)); } // Create a breadcrumb that indicates that the journal folder has been formatted. UnderFileSystemUtils.touch(mUfs, URIUtils.appendPathOrDie(location, ServerConfiguration.get(PropertyKey.MASTER_FORMAT_FILE_PREFIX) + System.currentTimeMillis()) .toString()); }
UnderFileSystem ufs = UnderFileSystem.Factory.create(job.getTempUfsPath(), ServerConfiguration.global()); UnderFileSystemUtils.touch(ufs, job.getTempUfsPath());
UnderFileSystem ufs = UnderFileSystem.Factory.create(job.getTempUfsPath(), ServerConfiguration.global()); UnderFileSystemUtils.touch(ufs, job.getTempUfsPath());
UnderFileSystemUtils.touch(ufs, URIUtils.appendPath(mLocation, Configuration.get(PropertyKey.MASTER_FORMAT_FILE_PREFIX) + System.currentTimeMillis()) .toString());
/** * Formats the journal. */ public void format() throws IOException { URI location = getLocation(); LOG.info("Formatting {}", location); if (mUfs.isDirectory(location.toString())) { for (UfsStatus status : mUfs.listStatus(location.toString())) { String childPath = URIUtils.appendPathOrDie(location, status.getName()).toString(); if (status.isDirectory() && !mUfs.deleteDirectory(childPath, DeleteOptions.defaults().setRecursive(true)) || status.isFile() && !mUfs.deleteFile(childPath)) { throw new IOException(String.format("Failed to delete %s", childPath)); } } } else if (!mUfs.mkdirs(location.toString())) { throw new IOException(String.format("Failed to create %s", location)); } // Create a breadcrumb that indicates that the journal folder has been formatted. UnderFileSystemUtils.touch(mUfs, URIUtils.appendPathOrDie(location, Configuration.get(PropertyKey.MASTER_FORMAT_FILE_PREFIX) + System.currentTimeMillis()) .toString()); }