liuliquan-marshal commented on code in PR #16865:
URL: https://github.com/apache/iceberg/pull/16865#discussion_r3474428079


##########
aliyun/src/main/java/org/apache/iceberg/aliyun/oss/OSSInputStream.java:
##########
@@ -82,89 +115,182 @@ public int read() throws IOException {
     Preconditions.checkState(!closed, "Cannot read: already closed");
     positionStream();
 
-    pos += 1;
-    next += 1;
-    readBytes.increment();
-    readOperations.increment();
+    try {
+      int bytesRead = Failsafe.with(retryPolicy).get(() -> stream.read());
+      if (bytesRead != -1) {
+        pos += 1;
+        next += 1;
+        readBytes.increment();
+        readOperations.increment();
+      }
+
+      return bytesRead;

Review Comment:
   I think it depends on the definition of `readOperations`. It's suitable if 
`readOperations` means the valid read operations. Or copilot is right when it 
means the whole read operations.
   I tend to the first one because average bytes per read can be calculated by 
`readBytes/readOperations `.  So I prefer staying as is.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to