aboutsummaryrefslogtreecommitdiff
path: root/other/java/client
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-08-29 20:27:11 -0700
committerChris Lu <chris.lu@gmail.com>2021-08-29 20:27:11 -0700
commit268de45aa521635a377950d7752d8f13316e4cad (patch)
treef77cbd35817bf97e62790ab0c6b5c2aef42f36af /other/java/client
parenteacaa44dc2cea78a859d5a481de889fcf57f6c20 (diff)
downloadseaweedfs-268de45aa521635a377950d7752d8f13316e4cad.tar.xz
seaweedfs-268de45aa521635a377950d7752d8f13316e4cad.zip
reset volume id cache if not found
Diffstat (limited to 'other/java/client')
-rw-r--r--other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java5
-rw-r--r--other/java/client/src/main/java/seaweedfs/client/VolumeIdCache.java7
2 files changed, 10 insertions, 2 deletions
diff --git a/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java b/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java
index 384636601..011462a17 100644
--- a/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java
+++ b/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java
@@ -64,10 +64,11 @@ public class SeaweedRead {
startOffset += gap;
}
- FilerProto.Locations locations = knownLocations.get(parseVolumeId(chunkView.fileId));
+ String volumeId = parseVolumeId(chunkView.fileId);
+ FilerProto.Locations locations = knownLocations.get(volumeId);
if (locations == null || locations.getLocationsCount() == 0) {
LOG.error("failed to locate {}", chunkView.fileId);
- // log here!
+ volumeIdCache.clearLocations(volumeId);
return 0;
}
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 fd2649cc2..86263fff9 100644
--- a/other/java/client/src/main/java/seaweedfs/client/VolumeIdCache.java
+++ b/other/java/client/src/main/java/seaweedfs/client/VolumeIdCache.java
@@ -26,6 +26,13 @@ public class VolumeIdCache {
return this.cache.getIfPresent(volumeId);
}
+ public void clearLocations(String volumeId) {
+ if (this.cache == null) {
+ return;
+ }
+ this.cache.invalidate(volumeId);
+ }
+
public void setLocations(String volumeId, FilerProto.Locations locations) {
if (this.cache == null) {
return;