private void metadataRename()

in src/main/java/com/netflix/bdp/s3mper/listing/ConsistentListingAspect.java [507:557]


    private void metadataRename(Configuration conf, FileSystem fs, RenameInfo info) throws Exception {
        try {
            final String error = "Unsupported move " + info.srcPath.toUri().getPath()
                + " to " + info.dstPath.toUri().getPath() + ": ";

            if (info.srcPath.isRoot()) {
                throw new IOException(error + "Cannot rename root");
            }

            if (!info.srcExists) {
                throw new IOException(error + "Source does not exist");
            }

            if (!info.dstExists && !fs.exists(info.dstPath.getParent())) {
                throw new IOException(error + "Target parent does not exist");
            }

            if (info.dstExists && info.dstIsFile) {
                throw new IOException(error + "Target file exists");
            }

            if (info.dstExists) {
                Path actualDst = new Path(info.dstPath, info.srcPath.getName());
                if (info.srcIsFile) {
                    renameFile(info.srcPath, actualDst);
                } else {
                    renameFolder(info.srcPath, actualDst);
                }
            } else {
                if (info.srcIsFile) {
                    renameFile(info.srcPath, info.dstPath);
                } else {
                    renameFolder(info.srcPath, info.dstPath);
                }
            }
        } catch (TimeoutException t) {
            log.error("Timeout occurred rename metastore path: " + info.srcPath, t);

            alertDispatcher.timeout("metastoreRename", Collections.singletonList(info.srcPath));

            if(failOnTimeout) {
                throw t;
            }
        } catch (Exception e) {
            log.error("Error rename paths from metastore: " + info.srcPath, e);

            if(shouldFail(conf)) {
                throw e;
            }
        }
    }