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

jiangtian pushed a commit to branch expr
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/expr by this push:
     new abcf608  add logs
abcf608 is described below

commit abcf608fba224c2034474377b87b3504453ef675
Author: jt <[email protected]>
AuthorDate: Tue Dec 28 09:28:07 2021 +0800

    add logs
---
 .../main/java/org/apache/iotdb/cluster/utils/IOUtils.java    | 12 +++++++++++-
 .../java/org/apache/iotdb/session/SessionConnection.java     |  1 +
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/utils/IOUtils.java 
b/cluster/src/main/java/org/apache/iotdb/cluster/utils/IOUtils.java
index c906924..1a943a7 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/utils/IOUtils.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/utils/IOUtils.java
@@ -47,17 +47,19 @@ public class IOUtils {
     // TODO-Cluster: hold if the file is an unclosed TsFile
     File file = new File(filePath);
     if (!file.exists()) {
+      logger.warn("Reading a non-existing snapshot file {}", filePath);
       return ByteBuffer.allocate(0);
     }
 
     ByteBuffer result;
     boolean fileExhausted;
+    int len;
     try (BufferedInputStream bufferedInputStream =
         new BufferedInputStream(new FileInputStream(file))) {
       skipExactly(bufferedInputStream, offset);
       byte[] bytes = new byte[length];
       result = ByteBuffer.wrap(bytes);
-      int len = bufferedInputStream.read(bytes);
+      len = bufferedInputStream.read(bytes);
       result.limit(Math.max(len, 0));
       fileExhausted = bufferedInputStream.available() <= 0;
     }
@@ -65,6 +67,14 @@ public class IOUtils {
     if (fileExhausted) {
       try {
         Files.delete(file.toPath());
+        if (logger.isInfoEnabled()) {
+          logger.info(
+              "Snapshot file {} is exhausted, offset: {}, read length: {}, 
file length: {}",
+              filePath,
+              offset,
+              len,
+              file.length());
+        }
       } catch (IOException e) {
         logger.warn("Cannot delete an exhausted file {}", filePath, e);
       }
diff --git 
a/session/src/main/java/org/apache/iotdb/session/SessionConnection.java 
b/session/src/main/java/org/apache/iotdb/session/SessionConnection.java
index d82f78b..3ec9832 100644
--- a/session/src/main/java/org/apache/iotdb/session/SessionConnection.java
+++ b/session/src/main/java/org/apache/iotdb/session/SessionConnection.java
@@ -137,6 +137,7 @@ public class SessionConnection {
       TSOpenSessionResp openResp = client.openSession(openReq);
 
       RpcUtils.verifySuccess(openResp.getStatus());
+      logger.info("Connected to {}", endPoint);
 
       if (Session.protocolVersion.getValue() != 
openResp.getServerProtocolVersion().getValue()) {
         logger.warn(

Reply via email to