You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by li...@apache.org on 2019/01/20 13:36:39 UTC

[incubator-iotdb] branch force-in-thread-periodically updated: format code

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

liurui pushed a commit to branch force-in-thread-periodically
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/force-in-thread-periodically by this push:
     new b0b3c8f  format code
b0b3c8f is described below

commit b0b3c8f6600055367f68163073b8efc4826dfa55
Author: liuruiyiyang <24...@qq.com>
AuthorDate: Sun Jan 20 21:36:25 2019 +0800

    format code
---
 .../java/org/apache/iotdb/db/conf/IoTDBConfig.java | 48 +++++++++++-----------
 .../apache/iotdb/db/writelog/PerformanceTest.java  | 32 ++++++++++-----
 2 files changed, 44 insertions(+), 36 deletions(-)

diff --git a/iotdb/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java b/iotdb/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
index ebe7a21..5d71cd7 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
@@ -52,15 +52,14 @@ public class IoTDBConfig {
   public int flushWalThreshold = 10000;
 
   /**
-   * The cycle when write ahead logs are periodically refreshed to disk(in milliseconds).
-   * It is possible to lose at most flush_wal_period_in_ms ms operations.
+   * The cycle when write ahead logs are periodically refreshed to disk(in milliseconds). It is
+   * possible to lose at most flush_wal_period_in_ms ms operations.
    */
   public long flushWalPeriodInMs = 10000;
 
   /**
-   * The cycle when write ahead log is periodically forced to be written to disk(in
-   * milliseconds)
-   * If set this parameter to 0 it means call outputStream.force(true) after every each write
+   * The cycle when write ahead log is periodically forced to be written to disk(in milliseconds) If
+   * set this parameter to 0 it means call outputStream.force(true) after every each write
    */
   public long forceWalPeriodInMs = 10;
 
@@ -121,14 +120,13 @@ public class IoTDBConfig {
   public String indexFileDir = "index";
 
   /**
-   * Temporary directory for temporary files of read (External Sort).
-   * TODO: unused field
+   * Temporary directory for temporary files of read (External Sort). TODO: unused field
    */
   public String readTmpFileDir = "readTmp";
 
   /**
-   * The maximum concurrent thread number for merging overflow.
-   * When the value <=0 or > CPU core number, use the CPU core number.
+   * The maximum concurrent thread number for merging overflow. When the value <=0 or > CPU core
+   * number, use the CPU core number.
    */
   public int mergeConcurrentThreads = Runtime.getRuntime().availableProcessors();
 
@@ -160,8 +158,7 @@ public class IoTDBConfig {
 
   /**
    * When set true, start timed flush and merge service. Else, stop timed flush and merge service.
-   * The default value is true.
-   * TODO: 'timed' better explains this than 'timing'.
+   * The default value is true. TODO: 'timed' better explains this than 'timing'.
    */
   public boolean enableTimingCloseAndMerge = true;
 
@@ -172,7 +169,8 @@ public class IoTDBConfig {
 
   public ZoneId zoneID = ZoneId.systemDefault();
   /**
-   * BufferWriteProcessor and OverflowProcessor will immediately flush if this threshold is reached.
+   * BufferWriteProcessor and OverflowProcessor will immediately flush if this threshold is
+   * reached.
    */
   public long memThresholdWarning = (long) (0.5 * Runtime.getRuntime().maxMemory());
   /**
@@ -186,8 +184,8 @@ public class IoTDBConfig {
   public long memMonitorInterval = 1000;
   /**
    * Decide how to control memory usage of inserting data. 0 is RecordMemController, which sums the
-   * size of each record (tuple). 1 is JVMMemController, which uses the JVM heap memory as
-   * the memory usage indicator.
+   * size of each record (tuple). 1 is JVMMemController, which uses the JVM heap memory as the
+   * memory usage indicator.
    */
   public int memControllerType = 1;
   /**
@@ -211,8 +209,8 @@ public class IoTDBConfig {
    */
   public boolean enableMemMonitor = false;
   /**
-   * When set to true, small flushes will be triggered periodically even if the memory threshold
-   * is not exceeded.
+   * When set to true, small flushes will be triggered periodically even if the memory threshold is
+   * not exceeded.
    */
   public boolean enableSmallFlush = false;
   /**
@@ -220,8 +218,8 @@ public class IoTDBConfig {
    */
   public long smallFlushInterval = 60 * 1000;
   /**
-   * The statMonitor writes statistics info into IoTDB every backLoopPeriodSec secs.
-   * The default value is 5s.
+   * The statMonitor writes statistics info into IoTDB every backLoopPeriodSec secs. The default
+   * value is 5s.
    */
   public int backLoopPeriodSec = 5;
   /**
@@ -233,8 +231,8 @@ public class IoTDBConfig {
    */
   public int statMonitorDetectFreqSec = 60 * 10;
   /**
-   * Set the maximum time to keep monitor statistics information in IoTDB.
-   * The default value is 600s.
+   * Set the maximum time to keep monitor statistics information in IoTDB. The default value is
+   * 600s.
    */
   public int statMonitorRetainIntervalSec = 60 * 10;
   /**
@@ -247,8 +245,8 @@ public class IoTDBConfig {
    */
   public int mManagerCacheSize = 400000;
   /**
-   * The maximum size of a single log in byte. If a log exceeds this size,
-   * it cannot be written to the WAL file and an exception is thrown.
+   * The maximum size of a single log in byte. If a log exceeds this size, it cannot be written to
+   * the WAL file and an exception is thrown.
    */
   public int maxLogEntrySize = 4 * 1024 * 1024;
   /**
@@ -264,9 +262,9 @@ public class IoTDBConfig {
    */
   public String languageVersion = "EN";
   /**
-   * Choose a postBack strategy of merging historical data:
-   * 1. It's more likely to update historical data, choose "true".
-   * 2. It's more likely not to update historical data or you don't know exactly, choose "false".
+   * Choose a postBack strategy of merging historical data: 1. It's more likely to update historical
+   * data, choose "true". 2. It's more likely not to update historical data or you don't know
+   * exactly, choose "false".
    */
   public boolean update_historical_data_possibility = false;
   public String ipWhiteList = "0.0.0.0/0";
diff --git a/iotdb/src/test/java/org/apache/iotdb/db/writelog/PerformanceTest.java b/iotdb/src/test/java/org/apache/iotdb/db/writelog/PerformanceTest.java
index 9de9a00..ad33c0e 100644
--- a/iotdb/src/test/java/org/apache/iotdb/db/writelog/PerformanceTest.java
+++ b/iotdb/src/test/java/org/apache/iotdb/db/writelog/PerformanceTest.java
@@ -79,7 +79,7 @@ public class PerformanceTest {
     int oldBatchSize = config.flushWalThreshold;
     long oldForceCycle = config.forceWalPeriodInMs;
     for (int j = 0; j < batchSizes.length; j++) {
-      for(int k=0; k < forceCycle.length; k++) {
+      for (int k = 0; k < forceCycle.length; k++) {
         config.flushWalThreshold = batchSizes[j];
         config.forceWalPeriodInMs = forceCycle[k];
         File tempRestore = new File("testtemp", "restore");
@@ -88,7 +88,8 @@ public class PerformanceTest {
         tempRestore.createNewFile();
         tempProcessorStore.createNewFile();
 
-        WriteLogNode logNode = new ExclusiveWriteLogNode("root.testLogNode", tempRestore.getPath(),
+        WriteLogNode logNode = new ExclusiveWriteLogNode("root.testLogNode",
+            tempRestore.getPath(),
             tempProcessorStore.getPath());
 
         long time = System.currentTimeMillis();
@@ -96,8 +97,10 @@ public class PerformanceTest {
           InsertPlan bwInsertPlan = new InsertPlan(1, "logTestDevice", 100,
               Arrays.asList("s1", "s2", "s3", "s4"),
               Arrays.asList("1.0", "15", "str", "false"));
-          UpdatePlan updatePlan = new UpdatePlan(0, 100, "2.0", new Path("root.logTestDevice.s1"));
-          DeletePlan deletePlan = new DeletePlan(50, new Path("root.logTestDevice.s1"));
+          UpdatePlan updatePlan = new UpdatePlan(0, 100, "2.0",
+              new Path("root.logTestDevice.s1"));
+          DeletePlan deletePlan = new DeletePlan(50,
+              new Path("root.logTestDevice.s1"));
 
           logNode.write(bwInsertPlan);
           logNode.write(updatePlan);
@@ -137,23 +140,28 @@ public class PerformanceTest {
       MManager.getInstance().setStorageLevelToMTree("root.logTestDevice");
     } catch (PathErrorException ignored) {
     }
-    MManager.getInstance().addPathToMTree("root.logTestDevice.s1", TSDataType.DOUBLE.name(),
+    MManager.getInstance().addPathToMTree("root.logTestDevice.s1",
+        TSDataType.DOUBLE.name(),
         TSEncoding.PLAIN.name(), new String[]{});
     MManager.getInstance()
-        .addPathToMTree("root.logTestDevice.s2", TSDataType.INT32.name(), TSEncoding.PLAIN.name(),
+        .addPathToMTree("root.logTestDevice.s2", TSDataType.INT32.name(),
+            TSEncoding.PLAIN.name(),
             new String[]{});
     MManager.getInstance()
-        .addPathToMTree("root.logTestDevice.s3", TSDataType.TEXT.name(), TSEncoding.PLAIN.name(),
+        .addPathToMTree("root.logTestDevice.s3", TSDataType.TEXT.name(),
+            TSEncoding.PLAIN.name(),
             new String[]{});
     MManager.getInstance().addPathToMTree("root.logTestDevice.s4", TSDataType.BOOLEAN.name(),
         TSEncoding.PLAIN.name(), new String[]{});
-    WriteLogNode logNode = new ExclusiveWriteLogNode("root.logTestDevice", tempRestore.getPath(),
+    WriteLogNode logNode = new ExclusiveWriteLogNode("root.logTestDevice",
+        tempRestore.getPath(),
         tempProcessorStore.getPath());
 
     for (int i = 0; i < 1000000; i++) {
       InsertPlan bwInsertPlan = new InsertPlan(1, "root.logTestDevice", 100,
           Arrays.asList("s1", "s2", "s3", "s4"), Arrays.asList("1.0", "15", "str", "false"));
-      UpdatePlan updatePlan = new UpdatePlan(0, 100, "2.0", new Path("root.logTestDevice.s1"));
+      UpdatePlan updatePlan = new UpdatePlan(0, 100, "2.0",
+          new Path("root.logTestDevice.s1"));
       DeletePlan deletePlan = new DeletePlan(50, new Path("root.logTestDevice.s1"));
 
       logNode.write(bwInsertPlan);
@@ -187,7 +195,8 @@ public class PerformanceTest {
     InsertPlan bwInsertPlan = new InsertPlan(1, "root.logTestDevice", 100,
         Arrays.asList("s1", "s2", "s3", "s4"),
         Arrays.asList("1.0", "15", "str", "false"));
-    UpdatePlan updatePlan = new UpdatePlan(0, 100, "2.0", new Path("root.logTestDevice.s1"));
+    UpdatePlan updatePlan = new UpdatePlan(0, 100, "2.0",
+        new Path("root.logTestDevice.s1"));
     for (int i = 0; i < 20; i++) {
       updatePlan.addInterval(new Pair<Long, Long>(200l, 300l));
     }
@@ -211,7 +220,8 @@ public class PerformanceTest {
 
   @Test
   public void SQLEncodingComparisonTest() throws WALOverSizedException {
-    String sql = "INSERT INTO root.logTestDevice(time,s1,s2,s3,s4) VALUES (100,1.0,15,\"str\",false)";
+    String sql = "INSERT INTO root.logTestDevice(time,s1,s2,s3,s4) "
+        + "VALUES (100,1.0,15,\"str\",false)";
     InsertPlan bwInsertPlan = new InsertPlan(1, "root.logTestDevice", 100,
         Arrays.asList("s1", "s2", "s3", "s4"),
         Arrays.asList("1.0", "15", "str", "false"));