This is an automated email from the ASF dual-hosted git repository.

timoninmaxim pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new af869206090 IGNITE-21770 Extend logging for the AbstractFileIO#fully() 
method (#11294)
af869206090 is described below

commit af869206090a36ff456d6d336fbd88906a2764c4
Author: oleg-vlsk <153691984+oleg-v...@users.noreply.github.com>
AuthorDate: Mon Apr 15 18:04:28 2024 +1000

    IGNITE-21770 Extend logging for the AbstractFileIO#fully() method (#11294)
---
 .../cache/persistence/file/AbstractFileIO.java         | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AbstractFileIO.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AbstractFileIO.java
index 68bedb04b5d..6b6fb53649e 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AbstractFileIO.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/file/AbstractFileIO.java
@@ -44,6 +44,8 @@ public abstract class AbstractFileIO implements FileIO {
      * @param operation IO operation.
      *
      * @param num Number of bytes to operate.
+     *
+     * @return Number of bytes operated.
      */
     private int fully(IOOperation operation, long position, int num, boolean 
write) throws IOException {
         if (num > 0) {
@@ -62,9 +64,19 @@ public abstract class AbstractFileIO implements FileIO {
 
                     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)) {
+                        String errMsg = " operation unsuccessful, timeout 
exceeds the maximum IO timeout ("
+                            + U.millisToNanos(MAX_IO_TIMEOUT_MS) + " ms). ";
+
+                        if (write && (position + i) == size())
+                            errMsg = "Write" + errMsg + "Failed to extend 
file.";
+                        else {
+                            errMsg = (write ? "Write" : "Read") + errMsg +
+                                "Probably disk is too busy, please check your 
device.";
+                        }
+
+                        throw new IOException(errMsg);
+                    }
                 }
                 else
                     return -1;

Reply via email to