You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "OneSizeFitsQuorum (via GitHub)" <gi...@apache.org> on 2023/02/01 08:11:17 UTC
[GitHub] [iotdb] OneSizeFitsQuorum commented on a diff in pull request #8946: Formatting getOrCreatePartitionTables log
OneSizeFitsQuorum commented on code in PR #8946:
URL: https://github.com/apache/iotdb/pull/8946#discussion_r1092880122
##########
confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeConfig.java:
##########
@@ -285,6 +285,9 @@ public class ConfigNodeConfig {
private long schemaRegionRatisLogMax = 2L * 1024 * 1024 * 1024; // 2G
private long dataRegionRatisLogMax = 20L * 1024 * 1024 * 1024; // 20G
+ /** The getOrCreatePartitionTable interface will log new created Partition if set true */
+ private final boolean isPartitionDebugEnabled = false;
Review Comment:
```suggestion
private final boolean isPrintingNewlyCreatedPartitionEnabled = false;
```
##########
confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java:
##########
@@ -720,18 +757,68 @@ public TDataPartitionTableResp getOrCreateDataPartition(
}
DataPartitionResp queryResult =
- partitionManager.getOrCreateDataPartition(getOrCreateDataPartitionReq);
-
+ partitionManager.getOrCreateDataPartition(getOrCreateDataPartitionPlan);
resp = queryResult.convertToTDataPartitionTableResp();
- LOGGER.debug(
- "GetOrCreateDataPartition success. receive PartitionSlotsMap: {}, return: {}",
- getOrCreateDataPartitionReq.getPartitionSlotsMap(),
- resp);
+ if (CONF.isPartitionDebugEnabled()) {
+ printNewCreatedDataPartition(getOrCreateDataPartitionPlan, resp);
+ }
return resp;
}
+ private void printNewCreatedDataPartition(
+ GetOrCreateDataPartitionPlan getOrCreateDataPartitionPlan, TDataPartitionTableResp resp) {
+ StringBuilder partitionSlotsMapString = new StringBuilder("{");
+ for (Map.Entry<String, Map<TSeriesPartitionSlot, TTimeSlotList>> databaseEntry :
+ getOrCreateDataPartitionPlan.getPartitionSlotsMap().entrySet()) {
+ String database = databaseEntry.getKey();
+ partitionSlotsMapString.append("\n\tDatabase=").append(database).append(": {");
Review Comment:
use `%n` rather than `\n`. Please refer to [stackoverflow](https://stackoverflow.com/questions/31981136/difference-between-n-and-n-for-printing-a-new-line-in-java)
##########
confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeConfig.java:
##########
@@ -285,6 +285,9 @@ public class ConfigNodeConfig {
private long schemaRegionRatisLogMax = 2L * 1024 * 1024 * 1024; // 2G
private long dataRegionRatisLogMax = 20L * 1024 * 1024 * 1024; // 20G
+ /** The getOrCreatePartitionTable interface will log new created Partition if set true */
+ private final boolean isPartitionDebugEnabled = false;
Review Comment:
The noun `debug` is easily confused with the log-level `debug`
##########
confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeConfig.java:
##########
@@ -1113,4 +1116,8 @@ public long getDataRegionRatisLogMax() {
public void setDataRegionRatisLogMax(long dataRegionRatisLogMax) {
this.dataRegionRatisLogMax = dataRegionRatisLogMax;
}
+
+ public boolean isPartitionDebugEnabled() {
Review Comment:
How to update this parameter?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org