timoninmaxim commented on code in PR #11294:
URL: https://github.com/apache/ignite/pull/11294#discussion_r1555939355


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AbstractFileIO.java:
##########
@@ -57,14 +57,29 @@ private int fully(IOOperation operation, long position, int 
num, boolean write)
                     time = 0;
                 }
                 else if (n == 0 || i > 0) {
+                /* Condition for reaching the end of file while there's still 
space in buffer
+                  OR for the case when the buffer is full but there's still 
data to read from file */
                     if (!write && available(num - i, position + i) == 0)
                         return i;
 
                     if (time == 0)
                         time = System.nanoTime();
-                    else if ((System.nanoTime() - time) >= 
U.millisToNanos(MAX_IO_TIMEOUT_MS))
-                        throw new IOException(write && (position + i) == 
size() ? "Failed to extend file." :
-                            "Probably disk is too busy, please check your 
device.");
+                    else if ((System.nanoTime() - time) >= 
U.millisToNanos(MAX_IO_TIMEOUT_MS)) {
+                        if (write && (position + i) == size()) {
+                            throw new IOException("Write operation 
unsuccessful, write timeout exceeds the maximum " +
+                                "IO timeout (" + 
U.millisToNanos(MAX_IO_TIMEOUT_MS) + " ms); failed to extend file.");
+                        }
+                        else if (write) {
+                            throw new IOException("Write operation 
unsuccessful, write timeout exceeds the maximum " +

Review Comment:
   Code duplication



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

Reply via email to