You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ca...@apache.org on 2023/02/05 08:32:00 UTC

[iotdb] 04/10: Formatting getOrCreatePartitionTable logs

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

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

commit 3c7bcb9dc4aeff5b190d4f0652fc5622ecfeb6df
Author: YongzaoDan <53...@qq.com>
AuthorDate: Tue Jan 31 16:30:50 2023 +0800

    Formatting getOrCreatePartitionTable logs
---
 .../iotdb/confignode/manager/ConfigManager.java    | 90 ++++++++++++++++++++--
 1 file changed, 82 insertions(+), 8 deletions(-)

diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java b/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
index 47ece8115c..aac1c1d8aa 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
@@ -651,10 +651,40 @@ public class ConfigManager implements IManager {
         partitionManager.getOrCreateSchemaPartition(getOrCreateSchemaPartitionPlan);
     resp = queryResult.convertToRpcSchemaPartitionTableResp();
 
-    LOGGER.debug(
-        "GetOrCreateSchemaPartition receive devicePaths: {}, return TSchemaPartitionResp: {}",
-        devicePaths,
-        resp);
+    StringBuilder devicePathString = new StringBuilder("{");
+    for (String devicePath : devicePaths) {
+      devicePathString.append("\n\t").append(devicePath).append(",");
+    }
+    devicePathString.append("\n}");
+
+    StringBuilder schemaPartitionRespString = new StringBuilder("{");
+    schemaPartitionRespString
+        .append("\n\tTSStatus=")
+        .append(resp.getStatus().getCode())
+        .append(",");
+    Map<String, Map<TSeriesPartitionSlot, TConsensusGroupId>> schemaPartitionTable =
+        resp.getSchemaPartitionTable();
+    for (Map.Entry<String, Map<TSeriesPartitionSlot, TConsensusGroupId>> databaseEntry :
+        schemaPartitionTable.entrySet()) {
+      String database = databaseEntry.getKey();
+      schemaPartitionRespString.append("\n\tDatabase=").append(database).append(": {");
+      for (Map.Entry<TSeriesPartitionSlot, TConsensusGroupId> slotEntry :
+          databaseEntry.getValue().entrySet()) {
+        schemaPartitionRespString
+            .append("\n\t\t")
+            .append(slotEntry.getKey())
+            .append(", ")
+            .append(slotEntry.getValue())
+            .append(",");
+      }
+      schemaPartitionRespString.append("\n\t},");
+    }
+    schemaPartitionRespString.append("\n}");
+
+    LOGGER.info(
+        "[GetOrCreateSchemaPartition]:\nReceive PathPatternTree: {}, Return TSchemaPartitionTableResp: {}",
+        devicePathString,
+        schemaPartitionRespString);
 
     return resp;
   }
@@ -724,10 +754,54 @@ public class ConfigManager implements IManager {
 
     resp = queryResult.convertToTDataPartitionTableResp();
 
-    LOGGER.debug(
-        "GetOrCreateDataPartition success. receive PartitionSlotsMap: {}, return: {}",
-        getOrCreateDataPartitionReq.getPartitionSlotsMap(),
-        resp);
+    StringBuilder partitionSlotsMapString = new StringBuilder("{");
+    for (Map.Entry<String, Map<TSeriesPartitionSlot, TTimeSlotList>> databaseEntry :
+        getOrCreateDataPartitionReq.getPartitionSlotsMap().entrySet()) {
+      String database = databaseEntry.getKey();
+      partitionSlotsMapString.append("\n\tDatabase=").append(database).append(": {");
+      for (Map.Entry<TSeriesPartitionSlot, TTimeSlotList> slotEntry :
+          databaseEntry.getValue().entrySet()) {
+        partitionSlotsMapString
+            .append("\n\t\t")
+            .append(slotEntry.getKey())
+            .append(",")
+            .append(slotEntry.getValue());
+      }
+      partitionSlotsMapString.append("\n\t},");
+    }
+    partitionSlotsMapString.append("\n}");
+
+    StringBuilder dataPartitionRespString = new StringBuilder("{");
+    dataPartitionRespString.append("\n\tTSStatus=").append(resp.getStatus().getCode()).append(",");
+    Map<String, Map<TSeriesPartitionSlot, Map<TTimePartitionSlot, List<TConsensusGroupId>>>>
+        dataPartitionTable = resp.getDataPartitionTable();
+    for (Map.Entry<
+            String, Map<TSeriesPartitionSlot, Map<TTimePartitionSlot, List<TConsensusGroupId>>>>
+        databaseEntry : dataPartitionTable.entrySet()) {
+      String database = databaseEntry.getKey();
+      dataPartitionRespString.append("\n\tDatabase=").append(database).append(": {");
+      for (Map.Entry<TSeriesPartitionSlot, Map<TTimePartitionSlot, List<TConsensusGroupId>>>
+          seriesSlotEntry : databaseEntry.getValue().entrySet()) {
+        dataPartitionRespString.append("\n\t\t").append(seriesSlotEntry.getKey()).append(": {");
+        for (Map.Entry<TTimePartitionSlot, List<TConsensusGroupId>> timeSlotEntry :
+            seriesSlotEntry.getValue().entrySet()) {
+          dataPartitionRespString
+              .append("\n\t\t\t")
+              .append(timeSlotEntry.getKey())
+              .append(", ")
+              .append(timeSlotEntry.getValue())
+              .append(",");
+        }
+        dataPartitionRespString.append("\n\t\t},");
+      }
+      dataPartitionRespString.append("\n\t}");
+    }
+    dataPartitionRespString.append("\n}");
+
+    LOGGER.info(
+        "[GetOrCreateDataPartition]:\nReceive PartitionSlotsMap: {}, Return TDataPartitionTableResp: {}",
+        partitionSlotsMapString,
+        dataPartitionRespString);
 
     return resp;
   }