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

roryqi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git


The following commit(s) were added to refs/heads/master by this push:
     new c90d463db [#2308] improvement(server): More detailed and clear logs on 
reading failure for FileSegmentManagedBuffer (#2309)
c90d463db is described below

commit c90d463dbb46bfbec6ecc440070764ea6ea37352
Author: Junfan Zhang <[email protected]>
AuthorDate: Thu Jan 2 11:35:50 2025 +0800

    [#2308] improvement(server): More detailed and clear logs on reading 
failure for FileSegmentManagedBuffer (#2309)
    
    ### What changes were proposed in this pull request?
    
    More detailed and clear logs on reading failure for FileSegmentManagedBuffer
    
    ### Why are the changes needed?
    
    for #2308
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Needn't
    
    Co-authored-by: Junfan Zhang <[email protected]>
---
 .../uniffle/common/netty/buffer/FileSegmentManagedBuffer.java  | 10 +++++++---
 1 file changed, 7 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 a83492f79..c95e91ae7 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,15 @@ public class FileSegmentManagedBuffer extends ManagedBuffer 
{
       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 +111,7 @@ public class FileSegmentManagedBuffer extends ManagedBuffer 
{
     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);
   }

Reply via email to