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

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


The following commit(s) were added to refs/heads/ZYBug by this push:
     new 7fff8ef  change log
7fff8ef is described below

commit 7fff8efc0f9bd5581a6430277136d7d171aee939
Author: JackieTien97 <[email protected]>
AuthorDate: Wed Oct 28 16:43:49 2020 +0800

    change log
---
 .../assembly/resources/conf/iotdb-engine.properties | 10 +++++-----
 server/src/assembly/resources/conf/logback.xml      | 21 +++++++++++++++++++++
 .../org/apache/iotdb/db/service/TSServiceImpl.java  | 15 +++++++++++++++
 3 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/server/src/assembly/resources/conf/iotdb-engine.properties 
b/server/src/assembly/resources/conf/iotdb-engine.properties
index dd8152c..1216f9a 100644
--- a/server/src/assembly/resources/conf/iotdb-engine.properties
+++ b/server/src/assembly/resources/conf/iotdb-engine.properties
@@ -175,11 +175,11 @@ wal_buffer_size=16777216
 # eg. +08:00, -01:00
 time_zone=+08:00
 
-# When a TsFile's file size (in byte) exceeds this, the TsFile is forced 
closed. The default threshold is 512 MB.
-tsfile_size_threshold=536870912
+# When a TsFile's file size (in byte) exceeds this, the TsFile is forced 
closed. The default threshold is 256 MB.
+tsfile_size_threshold=268435456
 
-# When a memTable's size (in byte) exceeds this, the memtable is flushed to 
disk. The default threshold is 1 GB.
-memtable_size_threshold=1073741824
+# When a memTable's size (in byte) exceeds this, the memtable is flushed to 
disk. The default threshold is 256 GB.
+memtable_size_threshold=268435456
 
 avg_series_point_number_threshold=500000
 
@@ -217,7 +217,7 @@ enable_partial_insert=true
 # memtable_size_threshold = tsfile_size_threshold = IoTDB memory allocation in 
byte / 2 / num of storage group / 4
 # Make sure the total num of time series in system * primitive_array_size * 16 
<= IoTDB memory allocation in byte / 2 / 4
 # you could reduce the primitive_array_size in very high workload.
-enable_parameter_adapter=true
+enable_parameter_adapter=false
 
 # Memory Allocation Ratio: Write, Read, and Free Memory.
 # The parameter form is a:b:c, where a, b and c are integers. for example: 
1:1:1 , 6:3:1
diff --git a/server/src/assembly/resources/conf/logback.xml 
b/server/src/assembly/resources/conf/logback.xml
index b542374..1499a4b 100644
--- a/server/src/assembly/resources/conf/logback.xml
+++ b/server/src/assembly/resources/conf/logback.xml
@@ -204,6 +204,24 @@
             <level>INFO</level>
         </filter>
     </appender>
+    <appender class="ch.qos.logback.core.rolling.RollingFileAppender" 
name="QUERY-FREQUENCY">
+        <file>${IOTDB_HOME}/logs/log_query_frequency.log</file>
+        <rollingPolicy 
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            
<fileNamePattern>${IOTDB_HOME}/logs/log-query-frequency-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <timeBasedFileNamingAndTriggeringPolicy 
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <maxFileSize>50MB</maxFileSize>
+                <maxBackupIndex>50</maxBackupIndex>
+            </timeBasedFileNamingAndTriggeringPolicy>
+        </rollingPolicy>
+        <append>true</append>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%d [%t] %-5p %C:%L - %m %n</pattern>
+            <charset>utf-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+            <level>INFO</level>
+        </filter>
+    </appender>
     <root level="info">
         <appender-ref ref="FILEDEBUG"/>
         <appender-ref ref="FILEWARN"/>
@@ -224,4 +242,7 @@
     <logger level="info" name="SLOW-SQL">
         <appender-ref ref="SLOW_SQL"/>
     </logger>
+    <logger level="info" name="QUERY-FREQUENCY">
+        <appender-ref ref="QUERY-FREQUENCY"/>
+    </logger>
 </configuration>
diff --git 
a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java 
b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
index 986dde2..32709b8 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
@@ -34,6 +34,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.stream.Collectors;
 import org.antlr.v4.runtime.misc.ParseCancellationException;
@@ -134,6 +138,7 @@ public class TSServiceImpl implements TSIService.Iface, 
ServerContext {
 
   private static final Logger logger = 
LoggerFactory.getLogger(TSServiceImpl.class);
   private static final Logger SLOW_SQL_LOGGER = 
LoggerFactory.getLogger("SLOW-SQL");
+  private static final Logger QUERY_FREQUENCY_LOGGER = 
LoggerFactory.getLogger("QUERY-FREQUENCY");
   private static final String INFO_NOT_LOGIN = "{}: Not login.";
   private static final int MAX_SIZE =
       IoTDBDescriptor.getInstance().getConfig().getQueryCacheSizeInMetric();
@@ -166,9 +171,19 @@ public class TSServiceImpl implements TSIService.Iface, 
ServerContext {
   // When the client abnormally exits, we can still know who to disconnect
   private ThreadLocal<Long> currSessionId = new ThreadLocal<>();
 
+  private static final int INTERVAL = 30;
+
+  private static final AtomicInteger queryCount = new AtomicInteger(0);
+
   public TSServiceImpl() throws QueryProcessException {
     processor = new Planner();
     executor = new PlanExecutor();
+
+    ScheduledExecutorService timedQuerySqlCountThread = Executors
+        .newSingleThreadScheduledExecutor(r -> new Thread(r, 
"timedQuerySqlCountThread"));
+    timedQuerySqlCountThread.scheduleAtFixedRate(() -> QUERY_FREQUENCY_LOGGER
+            .info("Query count in current 30 seconds: " + 
queryCount.getAndSet(0)), INTERVAL, INTERVAL,
+        TimeUnit.SECONDS);
   }
 
   public static List<SqlArgument> getSqlArgumentList() {

Reply via email to