@Override void handleFile(FileMetadata file, FileMetadata tempFile) throws IOException { LOG.debug("Deleting dangling file {}", file.getKey()); // Not handling delete return type as false return essentially // means its a no-op for the caller store.delete(file.getKey()); store.delete(tempFile.getKey()); } }
@Override void handleFile(FileMetadata file, FileMetadata tempFile) throws IOException { LOG.debug("Recovering {}", file.getKey()); // Move to the final destination String finalDestinationKey = pathToKey(new Path(destination, file.getKey())); store.rename(tempFile.getKey(), finalDestinationKey); if (!finalDestinationKey.equals(file.getKey())) { // Delete the empty link file now that we've restored it. store.delete(file.getKey()); } } }
private boolean isStickyBitCheckViolated(FileMetadata metaData, FileMetadata parentMetadata, boolean throwOnException) throws IOException { try { return isStickyBitCheckViolated(metaData, parentMetadata); } catch (FileNotFoundException ex) { if (throwOnException) { throw ex; } else { LOG.debug("Encountered FileNotFoundException while performing " + "stickybit check operation for {}", metaData.getKey()); // swallow exception and return that stickyBit check has been violated return true; } } }
@Override void handleFile(FileMetadata file, FileMetadata tempFile) throws IOException { if (LOG.isDebugEnabled()) { LOG.debug("Recovering " + file.getKey()); } // Move to the final destination String finalDestinationKey = pathToKey(new Path(destination, file.getKey())); store.rename(tempFile.getKey(), finalDestinationKey); if (!finalDestinationKey.equals(file.getKey())) { // Delete the empty link file now that we've restored it. store.delete(file.getKey()); } } }
/** * Searches the given list of {@link FileMetadata} objects for a directory * with the given key. * * @param list * The list to search. * @param key * The key to search for. * @return The wanted directory, or null if not found. */ private static FileMetadata getDirectoryInList( final Iterable<FileMetadata> list, String key) { for (FileMetadata current : list) { if (current.isDir() && current.getKey().equals(key)) { return current; } } return null; }
this.operation, file.getKey()); operationStatus = false; } else { this.operation, file.getKey()); lastException = new IOException("Encountered Exception for " + this.operation + " operation for file " + file.getKey(), e); + " already got exception or operation failed", this.operation, file.getKey()); break;
String noPrefix = StringUtils.removeStart(fileMetadata[i].getKey(), srcKey + "/");
String noPrefix = StringUtils.removeStart(fileMetadata[i].getKey(), srcKey + "/");
String.format("Parent metadata for '%s' not found!", metaData.getKey()));
FileMetadata[] fileMetadataList = store.list(currentFolder.getKey(), AZURE_LIST_ALL, maxListingDepth); folderContentsMap.put(childItem.getKey(), childItem); String pathToRemove = currentFolder.getKey(); while (!pathToRemove.equals(folderToDelete.getKey())) { if (folderContentsMap.containsKey(pathToRemove)) { LOG.debug("Cannot delete {} since some of its contents "
@VisibleForTesting void renameFile(FileMetadata file) throws IOException{ // Rename all materialized entries under the folder to point to the // final destination. if (file.getBlobMaterialization() == BlobMaterialization.Explicit) { String srcName = file.getKey(); String suffix = srcName.substring((this.getSrcKey()).length()); String dstName = this.getDstKey() + suffix; // Rename gets exclusive access (via a lease) for files // designated for atomic rename. // The main use case is for HBase write-ahead log (WAL) and data // folder processing correctness. See the rename code for details. boolean acquireLease = this.fs.getStoreInterface().isAtomicRenameKey(srcName); this.fs.getStoreInterface().rename(srcName, dstName, acquireLease, null); } }
private boolean conditionalRedoFolderRenames(PartialListing listing) throws IllegalArgumentException, IOException { boolean renamed = false; for (FileMetadata fileMetadata : listing.getFiles()) { Path subpath = keyToPath(fileMetadata.getKey()); if (isRenamePendingFile(subpath)) { FolderRenamePending pending = new FolderRenamePending(subpath, this); pending.redo(); renamed = true; } } return renamed; }
String link = store.getLinkInFileMetadata(file.getKey()); if (link != null) {
if (fileMetadata.isDirectory()) { if (fileMetadata.getKey().equals(AZURE_TEMP_FOLDER)) {
String link = store.getLinkInFileMetadata(file.getKey()); if (link != null) {
String srcName = file.getKey(); String suffix = srcName.substring((this.getSrcKey()).length()); String dstName = this.getDstKey() + suffix;