diff options
| author | Chris Lu <chris.lu@uber.com> | 2019-03-30 23:08:29 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@uber.com> | 2019-03-30 23:08:29 -0700 |
| commit | 97406333a5ecc5b0d2cdaa74ff9901e3100e4bf2 (patch) | |
| tree | 04cb10ddb0fb87663ba1783a7e82397aa2c9c06f /other/java/hdfs | |
| parent | 920b4e56aa76fbf37780363d5b345c2882d311b5 (diff) | |
| download | seaweedfs-97406333a5ecc5b0d2cdaa74ff9901e3100e4bf2.tar.xz seaweedfs-97406333a5ecc5b0d2cdaa74ff9901e3100e4bf2.zip | |
support atomic renaming for mysql/postgres filer store
Diffstat (limited to 'other/java/hdfs')
| -rw-r--r-- | other/java/hdfs/pom.xml | 2 | ||||
| -rw-r--r-- | other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java | 30 |
2 files changed, 2 insertions, 30 deletions
diff --git a/other/java/hdfs/pom.xml b/other/java/hdfs/pom.xml index 18ae192d0..35911d463 100644 --- a/other/java/hdfs/pom.xml +++ b/other/java/hdfs/pom.xml @@ -5,7 +5,7 @@ <modelVersion>4.0.0</modelVersion> <properties> - <seaweedfs.client.version>1.0.8</seaweedfs.client.version> + <seaweedfs.client.version>1.0.9</seaweedfs.client.version> <hadoop.version>3.1.1</hadoop.version> </properties> diff --git a/other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java b/other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java index c93a28abc..643467898 100644 --- a/other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java +++ b/other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java @@ -151,35 +151,7 @@ public class SeaweedFileSystemStore { LOG.warn("rename non-existing source: {}", source); return; } - LOG.warn("rename moveEntry source: {}", source); - moveEntry(source.getParent(), entry, destination); - } - - private boolean moveEntry(Path oldParent, FilerProto.Entry entry, Path destination) { - - LOG.debug("moveEntry: {}/{} => {}", oldParent, entry.getName(), destination); - - FilerProto.Entry.Builder newEntry = entry.toBuilder().setName(destination.getName()); - boolean isDirectoryCreated = filerClient.createEntry(getParentDirectory(destination), newEntry.build()); - - if (!isDirectoryCreated) { - return false; - } - - if (entry.getIsDirectory()) { - Path entryPath = new Path(oldParent, entry.getName()); - List<FilerProto.Entry> entries = filerClient.listEntries(entryPath.toUri().getPath()); - for (FilerProto.Entry ent : entries) { - boolean isSucess = moveEntry(entryPath, ent, new Path(destination, ent.getName())); - if (!isSucess) { - return false; - } - } - } - - return filerClient.deleteEntry( - oldParent.toUri().getPath(), entry.getName(), false, false); - + filerClient.mv(source.toUri().getPath(), destination.toUri().getPath()); } public OutputStream createFile(final Path path, |
