SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
Hadoop: add exponential back off for failed reads
Chris Lue1a3ffcdbf79
diff --git a/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java b/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.javaindex 045751717a..7e5c5cb88a 100644--- a/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java+++ b/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java@@ -97,8 +97,35 @@ public class SeaweedRead {public static byte[] doFetchFullChunkData(ChunkView chunkView, FilerProto.Locations locations) throws IOException {- HttpGet request = new HttpGet(- String.format("http://%s/%s", locations.getLocations(0).getUrl(), chunkView.fileId));+ byte[] data = null;+ for (long waitTime = 230L; waitTime < 20 * 1000; waitTime += waitTime / 2) {+ for (FilerProto.Location location : locations.getLocationsList()) {+ String url = String.format("http://%s/%s", location.getUrl(), chunkView.fileId);+ try {+ data = doFetchOneFullChunkData(chunkView, url);+ break;+ } catch (IOException ioe) {+ LOG.debug("doFetchFullChunkData {} :{}", url, ioe);+ }+ }+ if (data != null) {+ break;+ }+ try {+ Thread.sleep(waitTime);+ } catch (InterruptedException e) {+ }+ }++ LOG.debug("doFetchFullChunkData fid:{} chunkData.length:{}", chunkView.fileId, data.length);++ return data;++ }++ public static byte[] doFetchOneFullChunkData(ChunkView chunkView, String url) throws IOException {++ HttpGet request = new HttpGet(url);request.setHeader(HttpHeaders.ACCEPT_ENCODING, "gzip");@@ -142,7 +169,7 @@ public class SeaweedRead {data = Gzip.decompress(data);}- LOG.debug("doFetchFullChunkData fid:{} chunkData.length:{}", chunkView.fileId, data.length);+ LOG.debug("doFetchOneFullChunkData url:{} chunkData.length:{}", url, data.length);return data;