@@ -138,12 +138,12 @@ public Set<Long> getStreamSetObjectIds() {
138
138
public CompletableFuture <InRangeObjects > fetch (long streamId , long startOffset , long endOffset , int limit ) {
139
139
// TODO: cache the object list for next search
140
140
CompletableFuture <InRangeObjects > cf = new CompletableFuture <>();
141
- exec (() -> fetch0 (cf , streamId , startOffset , endOffset , limit ), cf , LOGGER , "fetchObjects" );
141
+ exec (() -> fetch0 (cf , streamId , startOffset , endOffset , limit , false ), cf , LOGGER , "fetchObjects" );
142
142
return cf ;
143
143
}
144
144
145
145
private void fetch0 (CompletableFuture <InRangeObjects > cf , long streamId ,
146
- long startOffset , long endOffset , int limit ) {
146
+ long startOffset , long endOffset , int limit , boolean retryFetch ) {
147
147
Image image = getImage ();
148
148
try {
149
149
final S3StreamsMetadataImage streamsImage = image .streamsMetadata ();
@@ -179,9 +179,11 @@ private void fetch0(CompletableFuture<InRangeObjects> cf, long streamId,
179
179
streamId , startOffset , endOffset , limit , rst .objects ().size (), rst .endOffset ());
180
180
181
181
CompletableFuture <Void > pendingCf = pendingFetch ();
182
- pendingCf .thenAccept (nil -> fetch0 (cf , streamId , startOffset , endOffset , limit ));
183
- cf .whenComplete ((r , ex ) ->
184
- LOGGER .info ("[FetchObjects],[COMPLETE_PENDING],streamId={} startOffset={} endOffset={} limit={}" , streamId , startOffset , endOffset , limit ));
182
+ pendingCf .thenAccept (nil -> fetch0 (cf , streamId , startOffset , endOffset , limit , true ));
183
+ if (!retryFetch ) {
184
+ cf .whenComplete ((r , ex ) ->
185
+ LOGGER .info ("[FetchObjects],[COMPLETE_PENDING],streamId={} startOffset={} endOffset={} limit={}" , streamId , startOffset , endOffset , limit ));
186
+ }
185
187
}).exceptionally (ex -> {
186
188
cf .completeExceptionally (ex );
187
189
return null ;
0 commit comments