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

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


The following commit(s) were added to refs/heads/master by this push:
     new ec5d2ca1603 LOGGER.error(e.getMessage()) IS REALLY A BAD IDEA (#14137)
ec5d2ca1603 is described below

commit ec5d2ca16037239590b71d0bd3665f8231ed1e0e
Author: Li Yu Heng <[email protected]>
AuthorDate: Thu Nov 21 17:13:31 2024 +0800

    LOGGER.error(e.getMessage()) IS REALLY A BAD IDEA (#14137)
---
 .../confignode/consensus/statemachine/ConfigRegionStateMachine.java | 6 +++---
 .../apache/iotdb/confignode/manager/partition/PartitionManager.java | 4 ++--
 .../iotdb/confignode/persistence/executor/ConfigPlanExecutor.java   | 4 ++--
 .../consensus/statemachine/dataregion/DataRegionStateMachine.java   | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git 
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java
 
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java
index 16d24c4272a..bf18b763718 100644
--- 
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java
+++ 
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java
@@ -125,7 +125,7 @@ public class ConfigRegionStateMachine implements 
IStateMachine, IStateMachine.Ev
     try {
       result = executor.executeNonQueryPlan(plan);
     } catch (UnknownPhysicalPlanTypeException e) {
-      LOGGER.error(e.getMessage());
+      LOGGER.error("Execute non-query plan failed", e);
       result = new 
TSStatus(TSStatusCode.INTERNAL_SERVER_ERROR.getStatusCode());
     }
 
@@ -184,7 +184,7 @@ public class ConfigRegionStateMachine implements 
IStateMachine, IStateMachine.Ev
     try {
       result = executor.executeQueryPlan(plan);
     } catch (final UnknownPhysicalPlanTypeException | AuthException e) {
-      LOGGER.error(e.getMessage());
+      LOGGER.error("Execute query plan failed", e);
       result = null;
     }
     return result;
@@ -432,7 +432,7 @@ public class ConfigRegionStateMachine implements 
IStateMachine, IStateMachine.Ev
               
PipeConfigNodeAgent.runtime().listener().tryListenToPlan(nextPlan, false);
             }
           } catch (UnknownPhysicalPlanTypeException e) {
-            LOGGER.error(e.getMessage());
+            LOGGER.error("Try listen to plan failed", e);
           }
         }
         logReader.close();
diff --git 
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
 
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
index bcaaa17b963..f1ac99a562a 100644
--- 
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
+++ 
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
@@ -519,11 +519,11 @@ public class PartitionManager {
         }
       }
     } catch (NotEnoughDataNodeException e) {
-      LOGGER.error(e.getMessage());
+      LOGGER.error("Extend region group failed", e);
       result.setCode(TSStatusCode.NO_ENOUGH_DATANODE.getStatusCode());
       result.setMessage(e.getMessage());
     } catch (DatabaseNotExistsException e) {
-      LOGGER.error(e.getMessage());
+      LOGGER.error("Extend region group failed", e);
       result.setCode(TSStatusCode.DATABASE_NOT_EXIST.getStatusCode());
       result.setMessage(e.getMessage());
     }
diff --git 
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/executor/ConfigPlanExecutor.java
 
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/executor/ConfigPlanExecutor.java
index 4d351e23341..fad1c5eb5b4 100644
--- 
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/executor/ConfigPlanExecutor.java
+++ 
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/executor/ConfigPlanExecutor.java
@@ -649,7 +649,7 @@ public class ConfigPlanExecutor {
                 x.getClass().getName(),
                 System.currentTimeMillis() - startTime);
           } catch (TException | IOException e) {
-            LOGGER.error("Take snapshot error: {}", e.getMessage());
+            LOGGER.error("Take snapshot error", e);
             takeSnapshotResult = false;
           } finally {
             // If any snapshot fails, the whole fails
@@ -690,7 +690,7 @@ public class ConfigPlanExecutor {
                     System.currentTimeMillis() - startTime);
               } catch (TException | IOException e) {
                 result.set(false);
-                LOGGER.error("Load snapshot error: {}", e.getMessage());
+                LOGGER.error("Load snapshot error", e);
               }
             });
     if (result.get()) {
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/dataregion/DataRegionStateMachine.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/dataregion/DataRegionStateMachine.java
index 24f60cc806c..fd96b8fbe25 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/dataregion/DataRegionStateMachine.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/dataregion/DataRegionStateMachine.java
@@ -349,7 +349,7 @@ public class DataRegionStateMachine extends 
BaseStateMachine {
       try {
         fragmentInstance = getFragmentInstance(request);
       } catch (IllegalArgumentException e) {
-        logger.error(e.getMessage());
+        logger.error("Get fragment instance failed", e);
         return null;
       }
       return 
QUERY_INSTANCE_MANAGER.execDataQueryFragmentInstance(fragmentInstance, region);

Reply via email to