aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2020-11-17 03:13:44 -0800
committerGitHub <noreply@github.com>2020-11-17 03:13:44 -0800
commita7258f024e7828e94e47fc346693f84ffe9b59f4 (patch)
tree83cdf9af77d11fd3311ca3852de12305eb10d314
parentdc304342b2a5113d402833b024c2123ac70fb162 (diff)
parent4737df597db3664d9d47e7f47ec6204a832e4c78 (diff)
downloadseaweedfs-a7258f024e7828e94e47fc346693f84ffe9b59f4.tar.xz
seaweedfs-a7258f024e7828e94e47fc346693f84ffe9b59f4.zip
Merge pull request #1621 from hilimd/master
HCFS: add replication parameter and fix close sequence
-rw-r--r--other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystem.java5
-rw-r--r--other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystem.java5
-rw-r--r--other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java2
3 files changed, 7 insertions, 5 deletions
diff --git a/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystem.java b/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystem.java
index 69df55cf1..fb1f4c53b 100644
--- a/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystem.java
+++ b/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystem.java
@@ -25,6 +25,7 @@ public class SeaweedFileSystem extends FileSystem {
public static final String FS_SEAWEED_FILER_PORT = "fs.seaweed.filer.port";
public static final int FS_SEAWEED_DEFAULT_PORT = 8888;
public static final String FS_SEAWEED_BUFFER_SIZE = "fs.seaweed.buffer.size";
+ public static final String FS_SEAWEED_REPLICATION = "fs.seaweed.replication";
public static final int FS_SEAWEED_DEFAULT_BUFFER_SIZE = 4 * 1024 * 1024;
private static final Logger LOG = LoggerFactory.getLogger(SeaweedFileSystem.class);
@@ -67,8 +68,8 @@ public class SeaweedFileSystem extends FileSystem {
@Override
public void close() throws IOException {
- this.seaweedFileSystemStore.close();
super.close();
+ this.seaweedFileSystemStore.close();
}
@Override
@@ -97,7 +98,7 @@ public class SeaweedFileSystem extends FileSystem {
path = qualify(path);
try {
- String replicaPlacement = String.format("%03d", replication - 1);
+ String replicaPlacement = this.getConf().get(FS_SEAWEED_REPLICATION, String.format("%03d", replication - 1));
int seaweedBufferSize = this.getConf().getInt(FS_SEAWEED_BUFFER_SIZE, FS_SEAWEED_DEFAULT_BUFFER_SIZE);
OutputStream outputStream = seaweedFileSystemStore.createFile(path, overwrite, permission, seaweedBufferSize, replicaPlacement);
return new FSDataOutputStream(outputStream, statistics);
diff --git a/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystem.java b/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystem.java
index 69df55cf1..fb1f4c53b 100644
--- a/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystem.java
+++ b/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystem.java
@@ -25,6 +25,7 @@ public class SeaweedFileSystem extends FileSystem {
public static final String FS_SEAWEED_FILER_PORT = "fs.seaweed.filer.port";
public static final int FS_SEAWEED_DEFAULT_PORT = 8888;
public static final String FS_SEAWEED_BUFFER_SIZE = "fs.seaweed.buffer.size";
+ public static final String FS_SEAWEED_REPLICATION = "fs.seaweed.replication";
public static final int FS_SEAWEED_DEFAULT_BUFFER_SIZE = 4 * 1024 * 1024;
private static final Logger LOG = LoggerFactory.getLogger(SeaweedFileSystem.class);
@@ -67,8 +68,8 @@ public class SeaweedFileSystem extends FileSystem {
@Override
public void close() throws IOException {
- this.seaweedFileSystemStore.close();
super.close();
+ this.seaweedFileSystemStore.close();
}
@Override
@@ -97,7 +98,7 @@ public class SeaweedFileSystem extends FileSystem {
path = qualify(path);
try {
- String replicaPlacement = String.format("%03d", replication - 1);
+ String replicaPlacement = this.getConf().get(FS_SEAWEED_REPLICATION, String.format("%03d", replication - 1));
int seaweedBufferSize = this.getConf().getInt(FS_SEAWEED_BUFFER_SIZE, FS_SEAWEED_DEFAULT_BUFFER_SIZE);
OutputStream outputStream = seaweedFileSystemStore.createFile(path, overwrite, permission, seaweedBufferSize, replicaPlacement);
return new FSDataOutputStream(outputStream, statistics);
diff --git a/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java b/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java
index cec309b3e..1ad809f9a 100644
--- a/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java
+++ b/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java
@@ -287,4 +287,4 @@ public class SeaweedFileSystemStore {
}
-}
+} \ No newline at end of file