Skip to content

Commit

Permalink
IGNITE-21770 Extend logging for the AbstractFileIO#fully() method (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-vlsk committed Apr 15, 2024
1 parent 1fb6ad0 commit af86920
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ private interface IOOperation {
* @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) {
Expand All @@ -62,9 +64,19 @@ else if (n == 0 || i > 0) {

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;
Expand Down

0 comments on commit af86920

Please sign in to comment.