aboutsummaryrefslogtreecommitdiff
path: root/other/java
diff options
context:
space:
mode:
authorhilimd <68371223+hilimd@users.noreply.github.com>2021-10-11 16:35:47 +0800
committerGitHub <noreply@github.com>2021-10-11 16:35:47 +0800
commit0548ed3a1b5aa15b035b452519568bc017c065a3 (patch)
tree4d77f014c56a1f5e1f18fc78413aa86c492ad41c /other/java
parent1de733fda507e1da94b2e4741c74ba7e5e2c5f76 (diff)
parent84d2e1bdd099550aaba494c88324c8c0dbc08776 (diff)
downloadseaweedfs-0548ed3a1b5aa15b035b452519568bc017c065a3.tar.xz
seaweedfs-0548ed3a1b5aa15b035b452519568bc017c065a3.zip
Merge pull request #82 from chrislusf/master
sync
Diffstat (limited to 'other/java')
-rw-r--r--other/java/client/pom.xml4
-rw-r--r--other/java/client/pom.xml.deploy4
-rw-r--r--other/java/client/pom_debug.xml2
-rw-r--r--other/java/client/src/main/java/seaweedfs/client/ChunkCache.java2
-rw-r--r--other/java/client/src/main/java/seaweedfs/client/FilerClient.java6
-rw-r--r--other/java/client/src/main/java/seaweedfs/client/FilerGrpcClient.java8
-rw-r--r--other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java2
-rw-r--r--other/java/client/src/main/java/seaweedfs/client/VolumeIdCache.java2
-rw-r--r--other/java/client/src/main/proto/filer.proto4
-rw-r--r--other/java/examples/pom.xml4
-rw-r--r--other/java/hdfs2/dependency-reduced-pom.xml4
-rw-r--r--other/java/hdfs2/pom.xml4
-rw-r--r--other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystem.java8
-rw-r--r--other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java5
-rw-r--r--other/java/hdfs3/dependency-reduced-pom.xml4
-rw-r--r--other/java/hdfs3/pom.xml4
-rw-r--r--other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystem.java8
-rw-r--r--other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java5
18 files changed, 41 insertions, 39 deletions
diff --git a/other/java/client/pom.xml b/other/java/client/pom.xml
index 70c5dbd31..e9e99e113 100644
--- a/other/java/client/pom.xml
+++ b/other/java/client/pom.xml
@@ -5,7 +5,7 @@
<groupId>com.github.chrislusf</groupId>
<artifactId>seaweedfs-client</artifactId>
- <version>1.6.7</version>
+ <version>1.6.8</version>
<parent>
<groupId>org.sonatype.oss</groupId>
@@ -135,7 +135,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
- <version>1.6.7</version>
+ <version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
diff --git a/other/java/client/pom.xml.deploy b/other/java/client/pom.xml.deploy
index 82cf5e82b..529bb2e7f 100644
--- a/other/java/client/pom.xml.deploy
+++ b/other/java/client/pom.xml.deploy
@@ -5,7 +5,7 @@
<groupId>com.github.chrislusf</groupId>
<artifactId>seaweedfs-client</artifactId>
- <version>1.6.7</version>
+ <version>1.6.8</version>
<parent>
<groupId>org.sonatype.oss</groupId>
@@ -130,7 +130,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
- <version>1.6.7</version>
+ <version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
diff --git a/other/java/client/pom_debug.xml b/other/java/client/pom_debug.xml
index c72c81ab7..2755a98a9 100644
--- a/other/java/client/pom_debug.xml
+++ b/other/java/client/pom_debug.xml
@@ -5,7 +5,7 @@
<groupId>com.github.chrislusf</groupId>
<artifactId>seaweedfs-client</artifactId>
- <version>1.6.7</version>
+ <version>1.6.8</version>
<parent>
<groupId>org.sonatype.oss</groupId>
diff --git a/other/java/client/src/main/java/seaweedfs/client/ChunkCache.java b/other/java/client/src/main/java/seaweedfs/client/ChunkCache.java
index 58870d742..84b2beeb1 100644
--- a/other/java/client/src/main/java/seaweedfs/client/ChunkCache.java
+++ b/other/java/client/src/main/java/seaweedfs/client/ChunkCache.java
@@ -15,7 +15,7 @@ public class ChunkCache {
}
this.cache = CacheBuilder.newBuilder()
.maximumSize(maxEntries)
- .expireAfterAccess(1, TimeUnit.HOURS)
+ .expireAfterWrite(1, TimeUnit.HOURS)
.build();
}
diff --git a/other/java/client/src/main/java/seaweedfs/client/FilerClient.java b/other/java/client/src/main/java/seaweedfs/client/FilerClient.java
index e962cbbcc..84ee66e7d 100644
--- a/other/java/client/src/main/java/seaweedfs/client/FilerClient.java
+++ b/other/java/client/src/main/java/seaweedfs/client/FilerClient.java
@@ -14,7 +14,11 @@ public class FilerClient extends FilerGrpcClient {
private static final Logger LOG = LoggerFactory.getLogger(FilerClient.class);
public FilerClient(String host, int grpcPort) {
- super(host, grpcPort);
+ super(host, grpcPort-10000, grpcPort);
+ }
+
+ public FilerClient(String host, int port, int grpcPort) {
+ super(host, port, grpcPort);
}
public static String toFileId(FilerProto.FileId fid) {
diff --git a/other/java/client/src/main/java/seaweedfs/client/FilerGrpcClient.java b/other/java/client/src/main/java/seaweedfs/client/FilerGrpcClient.java
index 56aa35876..54e7ccb68 100644
--- a/other/java/client/src/main/java/seaweedfs/client/FilerGrpcClient.java
+++ b/other/java/client/src/main/java/seaweedfs/client/FilerGrpcClient.java
@@ -40,11 +40,11 @@ public class FilerGrpcClient {
private int volumeServerAccess = VOLUME_SERVER_ACCESS_DIRECT;
private String filerAddress;
- public FilerGrpcClient(String host, int grpcPort) {
- this(host, grpcPort, sslContext);
+ public FilerGrpcClient(String host, int port, int grpcPort) {
+ this(host, port, grpcPort, sslContext);
}
- public FilerGrpcClient(String host, int grpcPort, SslContext sslContext) {
+ public FilerGrpcClient(String host, int port, int grpcPort, SslContext sslContext) {
this(sslContext == null ?
ManagedChannelBuilder.forAddress(host, grpcPort).usePlaintext()
@@ -54,7 +54,7 @@ public class FilerGrpcClient {
.negotiationType(NegotiationType.TLS)
.sslContext(sslContext));
- filerAddress = SeaweedUtil.joinHostPort(host, grpcPort - 10000);
+ filerAddress = SeaweedUtil.joinHostPort(host, port);
FilerProto.GetFilerConfigurationResponse filerConfigurationResponse =
this.getBlockingStub().getFilerConfiguration(
diff --git a/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java b/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java
index 3f9d79b99..db7f1a19c 100644
--- a/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java
+++ b/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java
@@ -59,7 +59,7 @@ public class SeaweedWrite {
String fileId = response.getFileId();
String auth = response.getAuth();
- String targetUrl = filerClient.getChunkUrl(fileId, response.getUrl(), response.getPublicUrl());
+ String targetUrl = filerClient.getChunkUrl(fileId, response.getLocation().getUrl(), response.getLocation().getPublicUrl());
ByteString cipherKeyString = com.google.protobuf.ByteString.EMPTY;
byte[] cipherKey = null;
diff --git a/other/java/client/src/main/java/seaweedfs/client/VolumeIdCache.java b/other/java/client/src/main/java/seaweedfs/client/VolumeIdCache.java
index 86263fff9..6f3d9d8c1 100644
--- a/other/java/client/src/main/java/seaweedfs/client/VolumeIdCache.java
+++ b/other/java/client/src/main/java/seaweedfs/client/VolumeIdCache.java
@@ -15,7 +15,7 @@ public class VolumeIdCache {
}
this.cache = CacheBuilder.newBuilder()
.maximumSize(maxEntries)
- .expireAfterAccess(5, TimeUnit.MINUTES)
+ .expireAfterWrite(5, TimeUnit.MINUTES)
.build();
}
diff --git a/other/java/client/src/main/proto/filer.proto b/other/java/client/src/main/proto/filer.proto
index 7b1838565..bb4b6cc15 100644
--- a/other/java/client/src/main/proto/filer.proto
+++ b/other/java/client/src/main/proto/filer.proto
@@ -238,13 +238,12 @@ message AssignVolumeRequest {
message AssignVolumeResponse {
string file_id = 1;
- string url = 2;
- string public_url = 3;
int32 count = 4;
string auth = 5;
string collection = 6;
string replication = 7;
string error = 8;
+ Location location = 9;
}
message LookupVolumeRequest {
@@ -258,6 +257,7 @@ message Locations {
message Location {
string url = 1;
string public_url = 2;
+ uint32 grpc_port = 3;
}
message LookupVolumeResponse {
map<string, Locations> locations_map = 1;
diff --git a/other/java/examples/pom.xml b/other/java/examples/pom.xml
index 26c9bdfdc..89f41acc4 100644
--- a/other/java/examples/pom.xml
+++ b/other/java/examples/pom.xml
@@ -11,13 +11,13 @@
<dependency>
<groupId>com.github.chrislusf</groupId>
<artifactId>seaweedfs-client</artifactId>
- <version>1.6.7</version>
+ <version>1.6.8</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.chrislusf</groupId>
<artifactId>seaweedfs-hadoop2-client</artifactId>
- <version>1.6.7</version>
+ <version>1.6.8</version>
<scope>compile</scope>
</dependency>
<dependency>
diff --git a/other/java/hdfs2/dependency-reduced-pom.xml b/other/java/hdfs2/dependency-reduced-pom.xml
index bd31637ce..8497bdfef 100644
--- a/other/java/hdfs2/dependency-reduced-pom.xml
+++ b/other/java/hdfs2/dependency-reduced-pom.xml
@@ -86,7 +86,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
- <version>1.6.7</version>
+ <version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
@@ -301,7 +301,7 @@
</snapshotRepository>
</distributionManagement>
<properties>
- <seaweedfs.client.version>1.6.7</seaweedfs.client.version>
+ <seaweedfs.client.version>1.6.8</seaweedfs.client.version>
<hadoop.version>2.9.2</hadoop.version>
</properties>
</project>
diff --git a/other/java/hdfs2/pom.xml b/other/java/hdfs2/pom.xml
index f15d24faa..fe348f34f 100644
--- a/other/java/hdfs2/pom.xml
+++ b/other/java/hdfs2/pom.xml
@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<properties>
- <seaweedfs.client.version>1.6.7</seaweedfs.client.version>
+ <seaweedfs.client.version>1.6.8</seaweedfs.client.version>
<hadoop.version>2.9.2</hadoop.version>
</properties>
@@ -105,7 +105,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
- <version>1.6.7</version>
+ <version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
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 25395db7a..b6ea4c3bb 100644
--- a/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystem.java
+++ b/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystem.java
@@ -23,6 +23,7 @@ public class SeaweedFileSystem extends FileSystem {
public static final String FS_SEAWEED_FILER_HOST = "fs.seaweed.filer.host";
public static final String FS_SEAWEED_FILER_PORT = "fs.seaweed.filer.port";
+ public static final String FS_SEAWEED_FILER_PORT_GRPC = "fs.seaweed.filer.port.grpc";
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";
@@ -50,9 +51,6 @@ public class SeaweedFileSystem extends FileSystem {
// get host information from uri (overrides info in conf)
String host = uri.getHost();
host = (host == null) ? conf.get(FS_SEAWEED_FILER_HOST, "localhost") : host;
- if (host == null) {
- throw new IOException("Invalid host specified");
- }
conf.set(FS_SEAWEED_FILER_HOST, host);
// get port information from uri, (overrides info in conf)
@@ -60,10 +58,12 @@ public class SeaweedFileSystem extends FileSystem {
port = (port == -1) ? FS_SEAWEED_DEFAULT_PORT : port;
conf.setInt(FS_SEAWEED_FILER_PORT, port);
+ int grpcPort = conf.getInt(FS_SEAWEED_FILER_PORT_GRPC, port+10000);
+
setConf(conf);
this.uri = uri;
- seaweedFileSystemStore = new SeaweedFileSystemStore(host, port, conf);
+ seaweedFileSystemStore = new SeaweedFileSystemStore(host, port, grpcPort, conf);
}
diff --git a/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java b/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java
index f4e8c9349..2ba8e1a10 100644
--- a/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java
+++ b/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java
@@ -27,9 +27,8 @@ public class SeaweedFileSystemStore {
private FilerClient filerClient;
private Configuration conf;
- public SeaweedFileSystemStore(String host, int port, Configuration conf) {
- int grpcPort = 10000 + port;
- filerClient = new FilerClient(host, grpcPort);
+ public SeaweedFileSystemStore(String host, int port, int grpcPort, Configuration conf) {
+ filerClient = new FilerClient(host, port, grpcPort);
this.conf = conf;
String volumeServerAccessMode = this.conf.get(FS_SEAWEED_VOLUME_SERVER_ACCESS, "direct");
if (volumeServerAccessMode.equals("publicUrl")) {
diff --git a/other/java/hdfs3/dependency-reduced-pom.xml b/other/java/hdfs3/dependency-reduced-pom.xml
index 4640b5a84..eea4b0b83 100644
--- a/other/java/hdfs3/dependency-reduced-pom.xml
+++ b/other/java/hdfs3/dependency-reduced-pom.xml
@@ -86,7 +86,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
- <version>1.6.7</version>
+ <version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
@@ -309,7 +309,7 @@
</snapshotRepository>
</distributionManagement>
<properties>
- <seaweedfs.client.version>1.6.7</seaweedfs.client.version>
+ <seaweedfs.client.version>1.6.8</seaweedfs.client.version>
<hadoop.version>3.1.1</hadoop.version>
</properties>
</project>
diff --git a/other/java/hdfs3/pom.xml b/other/java/hdfs3/pom.xml
index efcc1e4c0..d734ff218 100644
--- a/other/java/hdfs3/pom.xml
+++ b/other/java/hdfs3/pom.xml
@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<properties>
- <seaweedfs.client.version>1.6.7</seaweedfs.client.version>
+ <seaweedfs.client.version>1.6.8</seaweedfs.client.version>
<hadoop.version>3.1.1</hadoop.version>
</properties>
@@ -105,7 +105,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
- <version>1.6.7</version>
+ <version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
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 25395db7a..b6ea4c3bb 100644
--- a/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystem.java
+++ b/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystem.java
@@ -23,6 +23,7 @@ public class SeaweedFileSystem extends FileSystem {
public static final String FS_SEAWEED_FILER_HOST = "fs.seaweed.filer.host";
public static final String FS_SEAWEED_FILER_PORT = "fs.seaweed.filer.port";
+ public static final String FS_SEAWEED_FILER_PORT_GRPC = "fs.seaweed.filer.port.grpc";
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";
@@ -50,9 +51,6 @@ public class SeaweedFileSystem extends FileSystem {
// get host information from uri (overrides info in conf)
String host = uri.getHost();
host = (host == null) ? conf.get(FS_SEAWEED_FILER_HOST, "localhost") : host;
- if (host == null) {
- throw new IOException("Invalid host specified");
- }
conf.set(FS_SEAWEED_FILER_HOST, host);
// get port information from uri, (overrides info in conf)
@@ -60,10 +58,12 @@ public class SeaweedFileSystem extends FileSystem {
port = (port == -1) ? FS_SEAWEED_DEFAULT_PORT : port;
conf.setInt(FS_SEAWEED_FILER_PORT, port);
+ int grpcPort = conf.getInt(FS_SEAWEED_FILER_PORT_GRPC, port+10000);
+
setConf(conf);
this.uri = uri;
- seaweedFileSystemStore = new SeaweedFileSystemStore(host, port, conf);
+ seaweedFileSystemStore = new SeaweedFileSystemStore(host, port, grpcPort, conf);
}
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 f4e8c9349..2ba8e1a10 100644
--- a/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java
+++ b/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java
@@ -27,9 +27,8 @@ public class SeaweedFileSystemStore {
private FilerClient filerClient;
private Configuration conf;
- public SeaweedFileSystemStore(String host, int port, Configuration conf) {
- int grpcPort = 10000 + port;
- filerClient = new FilerClient(host, grpcPort);
+ public SeaweedFileSystemStore(String host, int port, int grpcPort, Configuration conf) {
+ filerClient = new FilerClient(host, port, grpcPort);
this.conf = conf;
String volumeServerAccessMode = this.conf.get(FS_SEAWEED_VOLUME_SERVER_ACCESS, "direct");
if (volumeServerAccessMode.equals("publicUrl")) {