From a47d3b8c3d25013221dd2cca4f58502eb6c47c1b Mon Sep 17 00:00:00 2001 From: Junfan Zhang Date: Fri, 27 Dec 2024 17:55:22 +0800 Subject: [PATCH 1/2] [#2308] improvement(server): More detailed and clear logs on reading failure for FileSegmentManagedBuffer --- .../common/netty/buffer/FileSegmentManagedBuffer.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/org/apache/uniffle/common/netty/buffer/FileSegmentManagedBuffer.java b/common/src/main/java/org/apache/uniffle/common/netty/buffer/FileSegmentManagedBuffer.java index a83492f792..ecc2d56953 100644 --- a/common/src/main/java/org/apache/uniffle/common/netty/buffer/FileSegmentManagedBuffer.java +++ b/common/src/main/java/org/apache/uniffle/common/netty/buffer/FileSegmentManagedBuffer.java @@ -74,11 +74,12 @@ public ByteBuffer nioByteBuffer() { buf.flip(); return buf; } catch (IOException e) { - String errorMessage = "Error in reading " + this; + String fileName = file.getAbsolutePath(); + String errorMessage = String.format("Errors on reading localfile data with offset[%s] length[%s] from [%s]. ", offset, length, fileName); try { if (channel != null) { long size = channel.size(); - errorMessage = "Error in reading " + this + " (actual file length " + size + ")"; + errorMessage += String.format("The actual file length: %s", size); } } catch (IOException ignored) { // ignore @@ -107,7 +108,7 @@ public Object convertToNetty() { try { fileChannel = FileChannel.open(file.toPath(), StandardOpenOption.READ); } catch (IOException e) { - throw new RssException("Error in reading " + file); + throw new RssException("Errors on reading " + file.getAbsolutePath(), e); } return new DefaultFileRegion(fileChannel, offset, length); } From 6af28286f998d39b095c846b13e4183c660dd2e6 Mon Sep 17 00:00:00 2001 From: Junfan Zhang Date: Fri, 27 Dec 2024 20:31:40 +0800 Subject: [PATCH 2/2] style --- .../common/netty/buffer/FileSegmentManagedBuffer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/org/apache/uniffle/common/netty/buffer/FileSegmentManagedBuffer.java b/common/src/main/java/org/apache/uniffle/common/netty/buffer/FileSegmentManagedBuffer.java index ecc2d56953..c95e91ae7b 100644 --- a/common/src/main/java/org/apache/uniffle/common/netty/buffer/FileSegmentManagedBuffer.java +++ b/common/src/main/java/org/apache/uniffle/common/netty/buffer/FileSegmentManagedBuffer.java @@ -75,7 +75,10 @@ public ByteBuffer nioByteBuffer() { return buf; } catch (IOException e) { String fileName = file.getAbsolutePath(); - String errorMessage = String.format("Errors on reading localfile data with offset[%s] length[%s] from [%s]. ", offset, length, fileName); + String errorMessage = + String.format( + "Errors on reading localfile data with offset[%s] length[%s] from [%s]. ", + offset, length, fileName); try { if (channel != null) { long size = channel.size();