You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2021/01/19 07:54:35 UTC
[GitHub] [iotdb] THUMarkLau opened a new pull request #2520: Add workload manager
THUMarkLau opened a new pull request #2520:
URL: https://github.com/apache/iotdb/pull/2520
A new WorkloadManager is added to collect the workload of GroupBy queries and Aggregation queries, and then store them in the /data/workload folder **in the form of SQL statements with timestamps**. WorkloadManager has two adjustable parameters: one is RECORD_SIZE, which is the maximum number of query records stored in the memory. When this number is exceeded, the data in the memory will be written to the disk, and then the data in the memory will be cleared. The default value is 100. The other is RECORD_FILE_MAX_SIZE, which is the file used to store query records. If the size of the currently written file exceeds RECORD_FILE_MAX_SIZE, a new file will be opened for writing. The default value is 1GB.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] JackieTien97 commented on a change in pull request #2520: Add workload manager
Posted by GitBox <gi...@apache.org>.
JackieTien97 commented on a change in pull request #2520:
URL: https://github.com/apache/iotdb/pull/2520#discussion_r559996684
##########
File path: server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByWithoutValueFilterDataSet.java
##########
@@ -105,6 +112,25 @@ protected void initGroupBy(QueryContext context, GroupByTimePlan groupByTimePlan
.getAggrResultByName(groupByTimePlan.getDeduplicatedAggregations().get(i),
dataTypes.get(i), ascending);
pathExecutors.get(path).addAggregateResult(aggrResult);
+ // workload manager collection the records
+ if (!path.getDevice().equals(curDevice)) {
Review comment:
The path list may not be sorted.
##########
File path: server/src/main/java/org/apache/iotdb/db/query/executor/AggregationExecutor.java
##########
@@ -102,11 +105,37 @@ public QueryDataSet executeWithoutValueFilter(QueryContext context,
// TODO-Cluster: group the paths by storage group to reduce communications
List<StorageGroupProcessor> list = StorageEngine.getInstance()
.mergeLock(new ArrayList<>(pathToAggrIndexesMap.keySet()));
+ WorkloadManager manager = WorkloadManager.getInstance();
+ List<String> sensorList = new ArrayList<>();
+ List<String> opList = new ArrayList<>();
+ String curDevice = null;
try {
for (Map.Entry<PartialPath, List<Integer>> entry : pathToAggrIndexesMap.entrySet()) {
aggregateOneSeries(entry, aggregateResultList,
aggregationPlan.getAllMeasurementsInDevice(entry.getKey().getDevice()), timeFilter,
context);
+ // Workload manager monitor
+ List<Integer> AggrIndexes = entry.getValue();
+ if(!entry.getKey().getDevice().equals(curDevice)) {
Review comment:
Same as above, the map for-each loop can't ensure the sequence you want.
##########
File path: server/src/main/java/org/apache/iotdb/db/query/executor/AggregationExecutor.java
##########
@@ -102,11 +105,37 @@ public QueryDataSet executeWithoutValueFilter(QueryContext context,
// TODO-Cluster: group the paths by storage group to reduce communications
List<StorageGroupProcessor> list = StorageEngine.getInstance()
.mergeLock(new ArrayList<>(pathToAggrIndexesMap.keySet()));
+ WorkloadManager manager = WorkloadManager.getInstance();
+ List<String> sensorList = new ArrayList<>();
+ List<String> opList = new ArrayList<>();
+ String curDevice = null;
try {
for (Map.Entry<PartialPath, List<Integer>> entry : pathToAggrIndexesMap.entrySet()) {
aggregateOneSeries(entry, aggregateResultList,
aggregationPlan.getAllMeasurementsInDevice(entry.getKey().getDevice()), timeFilter,
context);
+ // Workload manager monitor
+ List<Integer> AggrIndexes = entry.getValue();
+ if(!entry.getKey().getDevice().equals(curDevice)) {
+ if (sensorList.size() != 0 && opList.size() != 0) {
+ QueryRecord record = new AggregationQueryRecord(curDevice, sensorList, opList);
+ String sql = record.getSql();
Review comment:
the `sql` local field seems not to be used.
##########
File path: server/src/main/java/org/apache/iotdb/db/query/dataset/groupby/GroupByWithValueFilterDataSet.java
##########
@@ -91,11 +94,33 @@ protected void initGroupBy(QueryContext context, GroupByTimePlan groupByTimePlan
List<StorageGroupProcessor> list = StorageEngine.getInstance()
.mergeLock(paths.stream().map(p -> (PartialPath) p).collect(Collectors.toList()));
+ WorkloadManager manager = WorkloadManager.getInstance();
+ List<String> sensors = new ArrayList<>();
+ List<String> ops = new ArrayList<>();
+ String curDevice = null;
try {
for (int i = 0; i < paths.size(); i++) {
PartialPath path = (PartialPath) paths.get(i);
allDataReaderList
.add(getReaderByTime(path, groupByTimePlan, dataTypes.get(i), context, null));
+ if (!path.getDevice().equals(curDevice)) {
Review comment:
The path list may not be sorted.
##########
File path: server/src/main/java/org/apache/iotdb/db/query/executor/AggregationExecutor.java
##########
@@ -325,6 +354,29 @@ public QueryDataSet executeWithValueFilter(QueryContext context, RawDataQueryPla
.getAggrResultByName(aggregations.get(i), type, ascending);
aggregateResults.add(result);
}
+ // Workload collection
+ WorkloadManager manager = WorkloadManager.getInstance();
+ String curDevice = null;
+ List<String> sensors = new ArrayList<>();
+ List<String> ops = new ArrayList<>();
+ for(int i = 0; i < selectedSeries.size(); ++i) {
+ if (!selectedSeries.get(i).getDevice().equals(curDevice)) {
Review comment:
selectedSeries may not be sorted.
##########
File path: server/src/main/java/org/apache/iotdb/db/query/workloadmanager/WorkloadManager.java
##########
@@ -0,0 +1,155 @@
+package org.apache.iotdb.db.query.workloadmanager;
+
+import org.apache.iotdb.db.query.workloadmanager.queryrecord.*;
+
+import java.io.*;
+import java.nio.Buffer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WorkloadManager {
Review comment:
You can refer to MMangager to learn how to write a safe Singleton class in java
##########
File path: server/src/main/java/org/apache/iotdb/db/query/workloadmanager/queryrecord/QueryRecord.java
##########
@@ -0,0 +1,63 @@
+package org.apache.iotdb.db.query.workloadmanager.queryrecord;
+
+public abstract class QueryRecord {
+ protected int hashcode = 0;
+ protected String device;
+ protected String[] sensors;
+ protected String[] ops;
+ protected QueryRecordType recordType;
+ String sql;
+ String sqlWithTimestamp;
+ long timestamp;
+
+ @Override
+ public boolean equals(Object obj) {
Review comment:
no need to Override the `equals` method, you can delete it.
##########
File path: server/src/main/java/org/apache/iotdb/db/query/workloadmanager/WorkloadManager.java
##########
@@ -0,0 +1,155 @@
+package org.apache.iotdb.db.query.workloadmanager;
+
+import org.apache.iotdb.db.query.workloadmanager.queryrecord.*;
+
+import java.io.*;
+import java.nio.Buffer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WorkloadManager {
+ private static final WorkloadManager manager = new WorkloadManager();
+ List<QueryRecord> records = Collections.synchronizedList(new ArrayList<>());
+ private static final Logger logger = LoggerFactory.getLogger(WorkloadManager.class);
+ private int aggregationCount = 0;
+ private int groupByCount = 0;
+ private static final int RECORDS_SIZE = 100;
+ private static final int RECORD_FILE_MAX_SIZE = 1024 * 1024 * 1024;
+ private File curWritingFile = null;
+
+ public WorkloadManager() {
+ }
+
+ public static WorkloadManager getInstance() {
+ return manager;
+ }
+
+ public void addAggregationRecord(String device, List<String> sensorList, List<String> opList) {
+ // add aggregation record
+ String[] sensors = new String[sensorList.size()];
+ String[] ops = new String[opList.size()];
Review comment:
No need to copy all the elements to the array, you can change the field type in QueryRecord to List instead of array
##########
File path: server/src/main/java/org/apache/iotdb/db/query/workloadmanager/WorkloadManager.java
##########
@@ -0,0 +1,155 @@
+package org.apache.iotdb.db.query.workloadmanager;
+
+import org.apache.iotdb.db.query.workloadmanager.queryrecord.*;
+
+import java.io.*;
+import java.nio.Buffer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WorkloadManager {
+ private static final WorkloadManager manager = new WorkloadManager();
+ List<QueryRecord> records = Collections.synchronizedList(new ArrayList<>());
Review comment:
Actually, it seems that each method in this class should be thread-safe, so the records list doesn't need to be synchronizedList
##########
File path: server/src/main/java/org/apache/iotdb/db/query/workloadmanager/WorkloadManager.java
##########
@@ -0,0 +1,155 @@
+package org.apache.iotdb.db.query.workloadmanager;
+
+import org.apache.iotdb.db.query.workloadmanager.queryrecord.*;
+
+import java.io.*;
+import java.nio.Buffer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WorkloadManager {
Review comment:
Remember to change all the methods in this class to be thread-safe.
##########
File path: server/src/main/java/org/apache/iotdb/db/query/workloadmanager/WorkloadManager.java
##########
@@ -0,0 +1,155 @@
+package org.apache.iotdb.db.query.workloadmanager;
+
+import org.apache.iotdb.db.query.workloadmanager.queryrecord.*;
+
+import java.io.*;
+import java.nio.Buffer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WorkloadManager {
+ private static final WorkloadManager manager = new WorkloadManager();
+ List<QueryRecord> records = Collections.synchronizedList(new ArrayList<>());
+ private static final Logger logger = LoggerFactory.getLogger(WorkloadManager.class);
+ private int aggregationCount = 0;
+ private int groupByCount = 0;
+ private static final int RECORDS_SIZE = 100;
+ private static final int RECORD_FILE_MAX_SIZE = 1024 * 1024 * 1024;
+ private File curWritingFile = null;
+
+ public WorkloadManager() {
+ }
+
+ public static WorkloadManager getInstance() {
+ return manager;
+ }
+
+ public void addAggregationRecord(String device, List<String> sensorList, List<String> opList) {
+ // add aggregation record
+ String[] sensors = new String[sensorList.size()];
+ String[] ops = new String[opList.size()];
+
+ for (int i = 0; i < sensorList.size(); ++i) {
+ sensors[i] = sensorList.get(i);
+ }
+ for (int i = 0; i < opList.size(); ++i) {
+ ops[i] = opList.get(i);
+ }
+ QueryRecord record = new AggregationQueryRecord(device, sensors, ops);
+ /*if (!historyMap.containsKey(record)) {
+ historyMap.put(record, new AggregationHistory());
+ }
+ try {
+ historyMap.get(record).addRecord();
+ } catch (MismatchRecordTypeException e) {
+ e.printStackTrace();
+ }*/
+ records.add(record);
+ }
+
+ public void addGroupByQueryRecord(String device, List<String> sensorList, List<String> opList,
+ long startTime, long endTime, long interval, long slidingStep) {
+ // add group by record
+ String[] sensors = new String[sensorList.size()];
+ String[] ops = new String[opList.size()];
+
+ for (int i = 0; i < sensorList.size(); ++i) {
+ sensors[i] = sensorList.get(i);
+ }
+ for (int i = 0; i < opList.size(); ++i) {
+ ops[i] = opList.get(i);
+ }
+
+ QueryRecord record = new GroupByQueryRecord(device, sensors, ops, startTime, endTime, interval, slidingStep);
+ /*if (!historyMap.containsKey(record)) {
+ historyMap.put(record, new GroupByHistory());
+ }
+ try {
+ historyMap.get(record).addRecord(startTime, endTime, interval, slidingStep);
+ } catch (MismatchRecordTypeException e) {
+ e.printStackTrace();
+ }*/
+ records.add(record);
+ }
+
+ public void addRecord(QueryRecord record) {
+ records.add(record);
+ if (records.size() >= RECORDS_SIZE) {
+ flushRecords();
+ }
+ switch (record.getRecordType()) {
+ case AGGREGATION: {
+ aggregationCount++;
+ break;
+ }
+ case GROUP_BY: {
+ groupByCount++;
+ break;
+ }
+ }
+ // logger.info("Record: " + record.getSqlWithTimestamp());
+ logger.info("Adding record type of " + record.getRecordType());
+ logger.info("Aggregation count: " + aggregationCount + ", group by count: " + groupByCount);
+ }
+
+ private void flushRecords() {
Review comment:
There is no need to choose what file you write into. You can define your own logger, and the LOGGER will do everything for you, like automatically switch to a new log file while the current file reach the thredshold. You can refer to the `SLOW_SQL_LOGGER` field in the `TSServiceImpl` class and its logger action is defined in `server/src/assembly/resources/conf/logback.xml`.
##########
File path: server/src/main/java/org/apache/iotdb/db/query/workloadmanager/WorkloadManager.java
##########
@@ -0,0 +1,155 @@
+package org.apache.iotdb.db.query.workloadmanager;
+
+import org.apache.iotdb.db.query.workloadmanager.queryrecord.*;
+
+import java.io.*;
+import java.nio.Buffer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WorkloadManager {
+ private static final WorkloadManager manager = new WorkloadManager();
+ List<QueryRecord> records = Collections.synchronizedList(new ArrayList<>());
+ private static final Logger logger = LoggerFactory.getLogger(WorkloadManager.class);
+ private int aggregationCount = 0;
+ private int groupByCount = 0;
+ private static final int RECORDS_SIZE = 100;
+ private static final int RECORD_FILE_MAX_SIZE = 1024 * 1024 * 1024;
+ private File curWritingFile = null;
+
+ public WorkloadManager() {
+ }
+
+ public static WorkloadManager getInstance() {
+ return manager;
+ }
+
+ public void addAggregationRecord(String device, List<String> sensorList, List<String> opList) {
+ // add aggregation record
+ String[] sensors = new String[sensorList.size()];
+ String[] ops = new String[opList.size()];
+
+ for (int i = 0; i < sensorList.size(); ++i) {
+ sensors[i] = sensorList.get(i);
+ }
+ for (int i = 0; i < opList.size(); ++i) {
+ ops[i] = opList.get(i);
+ }
+ QueryRecord record = new AggregationQueryRecord(device, sensors, ops);
+ /*if (!historyMap.containsKey(record)) {
+ historyMap.put(record, new AggregationHistory());
+ }
+ try {
+ historyMap.get(record).addRecord();
+ } catch (MismatchRecordTypeException e) {
+ e.printStackTrace();
+ }*/
+ records.add(record);
+ }
+
+ public void addGroupByQueryRecord(String device, List<String> sensorList, List<String> opList,
+ long startTime, long endTime, long interval, long slidingStep) {
+ // add group by record
+ String[] sensors = new String[sensorList.size()];
+ String[] ops = new String[opList.size()];
Review comment:
same as above
##########
File path: server/src/main/java/org/apache/iotdb/db/query/workloadmanager/WorkloadManager.java
##########
@@ -0,0 +1,155 @@
+package org.apache.iotdb.db.query.workloadmanager;
+
+import org.apache.iotdb.db.query.workloadmanager.queryrecord.*;
+
+import java.io.*;
+import java.nio.Buffer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WorkloadManager {
+ private static final WorkloadManager manager = new WorkloadManager();
+ List<QueryRecord> records = Collections.synchronizedList(new ArrayList<>());
+ private static final Logger logger = LoggerFactory.getLogger(WorkloadManager.class);
+ private int aggregationCount = 0;
+ private int groupByCount = 0;
+ private static final int RECORDS_SIZE = 100;
+ private static final int RECORD_FILE_MAX_SIZE = 1024 * 1024 * 1024;
+ private File curWritingFile = null;
+
+ public WorkloadManager() {
+ }
+
+ public static WorkloadManager getInstance() {
+ return manager;
+ }
+
+ public void addAggregationRecord(String device, List<String> sensorList, List<String> opList) {
+ // add aggregation record
+ String[] sensors = new String[sensorList.size()];
+ String[] ops = new String[opList.size()];
+
+ for (int i = 0; i < sensorList.size(); ++i) {
+ sensors[i] = sensorList.get(i);
+ }
+ for (int i = 0; i < opList.size(); ++i) {
+ ops[i] = opList.get(i);
+ }
+ QueryRecord record = new AggregationQueryRecord(device, sensors, ops);
+ /*if (!historyMap.containsKey(record)) {
+ historyMap.put(record, new AggregationHistory());
+ }
+ try {
+ historyMap.get(record).addRecord();
+ } catch (MismatchRecordTypeException e) {
+ e.printStackTrace();
+ }*/
+ records.add(record);
+ }
+
+ public void addGroupByQueryRecord(String device, List<String> sensorList, List<String> opList,
+ long startTime, long endTime, long interval, long slidingStep) {
+ // add group by record
+ String[] sensors = new String[sensorList.size()];
+ String[] ops = new String[opList.size()];
+
+ for (int i = 0; i < sensorList.size(); ++i) {
+ sensors[i] = sensorList.get(i);
+ }
+ for (int i = 0; i < opList.size(); ++i) {
+ ops[i] = opList.get(i);
+ }
+
+ QueryRecord record = new GroupByQueryRecord(device, sensors, ops, startTime, endTime, interval, slidingStep);
+ /*if (!historyMap.containsKey(record)) {
+ historyMap.put(record, new GroupByHistory());
+ }
+ try {
+ historyMap.get(record).addRecord(startTime, endTime, interval, slidingStep);
+ } catch (MismatchRecordTypeException e) {
+ e.printStackTrace();
+ }*/
+ records.add(record);
+ }
+
+ public void addRecord(QueryRecord record) {
+ records.add(record);
+ if (records.size() >= RECORDS_SIZE) {
+ flushRecords();
+ }
+ switch (record.getRecordType()) {
+ case AGGREGATION: {
+ aggregationCount++;
+ break;
+ }
+ case GROUP_BY: {
+ groupByCount++;
+ break;
+ }
+ }
+ // logger.info("Record: " + record.getSqlWithTimestamp());
+ logger.info("Adding record type of " + record.getRecordType());
+ logger.info("Aggregation count: " + aggregationCount + ", group by count: " + groupByCount);
+ }
+
+ private void flushRecords() {
+ // TODO: 转换成异步的
Review comment:
It's better to avoid Chinese comments in the code.
##########
File path: server/src/main/java/org/apache/iotdb/db/query/workloadmanager/WorkloadManager.java
##########
@@ -0,0 +1,155 @@
+package org.apache.iotdb.db.query.workloadmanager;
+
+import org.apache.iotdb.db.query.workloadmanager.queryrecord.*;
+
+import java.io.*;
+import java.nio.Buffer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WorkloadManager {
+ private static final WorkloadManager manager = new WorkloadManager();
+ List<QueryRecord> records = Collections.synchronizedList(new ArrayList<>());
+ private static final Logger logger = LoggerFactory.getLogger(WorkloadManager.class);
+ private int aggregationCount = 0;
+ private int groupByCount = 0;
+ private static final int RECORDS_SIZE = 100;
+ private static final int RECORD_FILE_MAX_SIZE = 1024 * 1024 * 1024;
+ private File curWritingFile = null;
+
+ public WorkloadManager() {
+ }
+
+ public static WorkloadManager getInstance() {
+ return manager;
+ }
+
+ public void addAggregationRecord(String device, List<String> sensorList, List<String> opList) {
+ // add aggregation record
+ String[] sensors = new String[sensorList.size()];
+ String[] ops = new String[opList.size()];
+
+ for (int i = 0; i < sensorList.size(); ++i) {
+ sensors[i] = sensorList.get(i);
+ }
+ for (int i = 0; i < opList.size(); ++i) {
+ ops[i] = opList.get(i);
+ }
+ QueryRecord record = new AggregationQueryRecord(device, sensors, ops);
+ /*if (!historyMap.containsKey(record)) {
+ historyMap.put(record, new AggregationHistory());
+ }
+ try {
+ historyMap.get(record).addRecord();
+ } catch (MismatchRecordTypeException e) {
+ e.printStackTrace();
+ }*/
+ records.add(record);
+ }
+
+ public void addGroupByQueryRecord(String device, List<String> sensorList, List<String> opList,
+ long startTime, long endTime, long interval, long slidingStep) {
+ // add group by record
+ String[] sensors = new String[sensorList.size()];
+ String[] ops = new String[opList.size()];
+
+ for (int i = 0; i < sensorList.size(); ++i) {
+ sensors[i] = sensorList.get(i);
+ }
+ for (int i = 0; i < opList.size(); ++i) {
+ ops[i] = opList.get(i);
+ }
+
+ QueryRecord record = new GroupByQueryRecord(device, sensors, ops, startTime, endTime, interval, slidingStep);
+ /*if (!historyMap.containsKey(record)) {
+ historyMap.put(record, new GroupByHistory());
+ }
+ try {
+ historyMap.get(record).addRecord(startTime, endTime, interval, slidingStep);
+ } catch (MismatchRecordTypeException e) {
+ e.printStackTrace();
+ }*/
+ records.add(record);
+ }
+
+ public void addRecord(QueryRecord record) {
+ records.add(record);
+ if (records.size() >= RECORDS_SIZE) {
+ flushRecords();
+ }
+ switch (record.getRecordType()) {
+ case AGGREGATION: {
+ aggregationCount++;
+ break;
+ }
+ case GROUP_BY: {
+ groupByCount++;
+ break;
+ }
+ }
+ // logger.info("Record: " + record.getSqlWithTimestamp());
+ logger.info("Adding record type of " + record.getRecordType());
+ logger.info("Aggregation count: " + aggregationCount + ", group by count: " + groupByCount);
+ }
+
+ private void flushRecords() {
+ // TODO: 转换成异步的
+ String cacheDirPath = "./data/workload/";
Review comment:
You should not use the relative path in the class, you can refer to class `DirectoryManager`, and learn how to define a directory to put the workload log.
##########
File path: server/src/main/java/org/apache/iotdb/db/query/workloadmanager/WorkloadManager.java
##########
@@ -0,0 +1,155 @@
+package org.apache.iotdb.db.query.workloadmanager;
+
+import org.apache.iotdb.db.query.workloadmanager.queryrecord.*;
+
+import java.io.*;
+import java.nio.Buffer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WorkloadManager {
+ private static final WorkloadManager manager = new WorkloadManager();
+ List<QueryRecord> records = Collections.synchronizedList(new ArrayList<>());
+ private static final Logger logger = LoggerFactory.getLogger(WorkloadManager.class);
+ private int aggregationCount = 0;
+ private int groupByCount = 0;
+ private static final int RECORDS_SIZE = 100;
+ private static final int RECORD_FILE_MAX_SIZE = 1024 * 1024 * 1024;
+ private File curWritingFile = null;
+
+ public WorkloadManager() {
+ }
Review comment:
```suggestion
public WorkloadManager() {
}
```
```suggestion
private WorkloadManager() {
}
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] THUMarkLau commented on pull request #2520: Add workload manager
Posted by GitBox <gi...@apache.org>.
THUMarkLau commented on pull request #2520:
URL: https://github.com/apache/iotdb/pull/2520#issuecomment-764580666
Changed the way of file writing to use LOGGER.
Add "synchronized" to all the method in Workload Manager.
Changed the way of collecting query info.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] THUMarkLau commented on pull request #2520: Add workload manager
Posted by GitBox <gi...@apache.org>.
THUMarkLau commented on pull request #2520:
URL: https://github.com/apache/iotdb/pull/2520#issuecomment-764580666
Changed the way of file writing to use LOGGER.
Add "synchronized" to all the method in Workload Manager.
Changed the way of collecting query info.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] JackieTien97 merged pull request #2520: Add workload manager
Posted by GitBox <gi...@apache.org>.
JackieTien97 merged pull request #2520:
URL: https://github.com/apache/iotdb/pull/2520
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [iotdb] JackieTien97 merged pull request #2520: Add workload manager
Posted by GitBox <gi...@apache.org>.
JackieTien97 merged pull request #2520:
URL: https://github.com/apache/iotdb/pull/2520
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org