codelipenghui commented on a change in pull request #12452:
URL: https://github.com/apache/pulsar/pull/12452#discussion_r734205803
##########
File path:
tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreBackedReadHandleImpl.java
##########
@@ -218,12 +218,32 @@ public static ReadHandle open(ScheduledExecutorService
executor,
VersionCheck versionCheck,
long ledgerId, int readBufferSize)
throws IOException {
- Blob blob = blobStore.getBlob(bucket, indexKey);
- versionCheck.check(indexKey, blob);
- OffloadIndexBlockBuilder indexBuilder =
OffloadIndexBlockBuilder.create();
- OffloadIndexBlock index;
- try (InputStream payLoadStream = blob.getPayload().openStream()) {
- index = (OffloadIndexBlock) indexBuilder.fromStream(payLoadStream);
+ int retryCount = 3;
+ OffloadIndexBlock index = null;
+ IOException lastException = null;
+ // The following retry is used to avoid to some network issue cause
read index file failure.
+ // If it can not recovery in the retry, we will throw the exception
and the dispatcher will schedule to
+ // next read.
+ // If we use a backoff to control the retry, it will introduce a
concurrent operation.
+ // We don't want to make it complicated, because in the most of case
it shouldn't in the retry loop.
+ while (retryCount-- > 0) {
Review comment:
```suggestion
while (--retryCount > 0) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]