From 8823d1e9ad1b147ca1d914bd57d71818664e3363 Mon Sep 17 00:00:00 2001 From: DittoTool <90056662+DittoTool@users.noreply.github.com> Date: Wed, 8 Sep 2021 15:56:56 +0800 Subject: [PATCH 01/15] Transform LinkedHashMap to HashMap --- .../java/cn/edu/tsinghua/iginx/jdbc/IginXPreparedStatement.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdbc/src/main/java/cn/edu/tsinghua/iginx/jdbc/IginXPreparedStatement.java b/jdbc/src/main/java/cn/edu/tsinghua/iginx/jdbc/IginXPreparedStatement.java index 46211fdcb..928e51203 100644 --- a/jdbc/src/main/java/cn/edu/tsinghua/iginx/jdbc/IginXPreparedStatement.java +++ b/jdbc/src/main/java/cn/edu/tsinghua/iginx/jdbc/IginXPreparedStatement.java @@ -13,7 +13,7 @@ public class IginXPreparedStatement extends IginXStatement implements PreparedStatement { private String sql; - private final Map params = new LinkedHashMap<>(); + private final Map params = new HashMap<>(); public IginXPreparedStatement(IginXConnection connection, Session session, String sql) { super(connection, session); From 2b78c00b6c32d46b0c1693f5c685bd2f26123f7f Mon Sep 17 00:00:00 2001 From: DittoTool <90056662+DittoTool@users.noreply.github.com> Date: Wed, 8 Sep 2021 17:17:22 +0800 Subject: [PATCH 02/15] Transform ArrayList to LinkedList --- .../java/cn/edu/tsinghua/iginx/rest/query/QueryMetric.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/QueryMetric.java b/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/QueryMetric.java index be93af362..c0da6acde 100644 --- a/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/QueryMetric.java +++ b/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/QueryMetric.java @@ -21,6 +21,7 @@ import cn.edu.tsinghua.iginx.rest.query.aggregator.QueryAggregator; import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -29,7 +30,7 @@ public class QueryMetric { private String name; private Long limit; private Map> tags = new TreeMap(); - private List aggregators = new ArrayList<>(); + private List aggregators = new LinkedList<>(); private Boolean annotation = false; private AnnotationLimit annotationLimit; From 3079cb2ca9f04c11fac3f9685b4edf074db49752 Mon Sep 17 00:00:00 2001 From: DittoTool <90056662+DittoTool@users.noreply.github.com> Date: Wed, 8 Sep 2021 17:23:53 +0800 Subject: [PATCH 03/15] Transform ArrayList to LinkedList --- .../cn/edu/tsinghua/iginx/rest/insert/DataPointsParser.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/cn/edu/tsinghua/iginx/rest/insert/DataPointsParser.java b/core/src/main/java/cn/edu/tsinghua/iginx/rest/insert/DataPointsParser.java index 09b580a34..19415ac14 100644 --- a/core/src/main/java/cn/edu/tsinghua/iginx/rest/insert/DataPointsParser.java +++ b/core/src/main/java/cn/edu/tsinghua/iginx/rest/insert/DataPointsParser.java @@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory; import java.io.Reader; -import java.util.ArrayList; +import java.util.LinkedList; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -46,7 +46,7 @@ public class DataPointsParser { private final IMetaManager metaManager = DefaultMetaManager.getInstance(); private Reader inputStream = null; private ObjectMapper mapper = new ObjectMapper(); - private List metricList = new ArrayList<>(); + private List metricList = new LinkedList<>(); private RestSession session = new RestSession(); public DataPointsParser() { @@ -347,4 +347,4 @@ DataType findType(List values) { } return DataType.DOUBLE; } -} \ No newline at end of file +} From 04308eae2932538aa4a58175e426213359c256d4 Mon Sep 17 00:00:00 2001 From: DittoTool <90056662+DittoTool@users.noreply.github.com> Date: Wed, 8 Sep 2021 17:28:10 +0800 Subject: [PATCH 04/15] Update Query.java --- core/src/main/java/cn/edu/tsinghua/iginx/rest/query/Query.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/Query.java b/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/Query.java index 37204839d..8ac539463 100644 --- a/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/Query.java +++ b/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/Query.java @@ -19,6 +19,7 @@ package cn.edu.tsinghua.iginx.rest.query; import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; public class Query { @@ -26,7 +27,7 @@ public class Query { private Long endAbsolute; private Long cacheTime; private String timeZone; - private List queryMetrics = new ArrayList<>(); + private List queryMetrics = new LinkedList<>(); public List getQueryMetrics() { return queryMetrics; From e61d74f34013a32016eaa35abe5c4b6bd44ec3be Mon Sep 17 00:00:00 2001 From: DittoTool <90056662+DittoTool@users.noreply.github.com> Date: Wed, 8 Sep 2021 17:31:07 +0800 Subject: [PATCH 05/15] Transform ArrayList to LinkedList --- .../java/cn/edu/tsinghua/iginx/session/LastQueryDataSet.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/session/src/main/java/cn/edu/tsinghua/iginx/session/LastQueryDataSet.java b/session/src/main/java/cn/edu/tsinghua/iginx/session/LastQueryDataSet.java index d475895a6..ca46b0d66 100644 --- a/session/src/main/java/cn/edu/tsinghua/iginx/session/LastQueryDataSet.java +++ b/session/src/main/java/cn/edu/tsinghua/iginx/session/LastQueryDataSet.java @@ -22,6 +22,7 @@ import cn.edu.tsinghua.iginx.thrift.LastQueryResp; import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; import static cn.edu.tsinghua.iginx.utils.ByteUtils.getLongArrayFromByteBuffer; @@ -36,7 +37,7 @@ public class LastQueryDataSet { } LastQueryDataSet(LastQueryResp resp) { - points = new ArrayList<>(); + points = new LinkedList<>(); List paths = resp.getPaths(); List dataTypes = resp.getDataTypeList(); long[] timestamps = getLongArrayFromByteBuffer(resp.timestamps); From a09b8d2d2fe8ad4e29c5563c2f4a5a5924acf669 Mon Sep 17 00:00:00 2001 From: DittoTool <90056662+DittoTool@users.noreply.github.com> Date: Wed, 8 Sep 2021 17:33:15 +0800 Subject: [PATCH 06/15] Transform ArrayList to LinkedList --- .../iginx/rest/query/aggregator/QueryAggregatorSaveAs.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/aggregator/QueryAggregatorSaveAs.java b/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/aggregator/QueryAggregatorSaveAs.java index b3679d62d..7daac9852 100644 --- a/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/aggregator/QueryAggregatorSaveAs.java +++ b/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/aggregator/QueryAggregatorSaveAs.java @@ -25,6 +25,7 @@ import cn.edu.tsinghua.iginx.session.SessionQueryDataSet; import java.util.ArrayList; +import java.util.LinkedList import java.util.List; public class QueryAggregatorSaveAs extends QueryAggregator { @@ -35,7 +36,7 @@ public QueryAggregatorSaveAs() { @Override public QueryResultDataset doAggregate(RestSession session, List paths, long startTimestamp, long endTimestamp) { DataPointsParser parser = new DataPointsParser(); - List metrics = new ArrayList<>(); + List metrics = new LinkedList<>(); Metric ins = new Metric(); String name = paths.get(0).split("\\.")[paths.get(0).split("\\.").length - 1]; ins.setName(getMetric_name()); From 27c6d843fbfd9dfdbc0ee83a8c8c496820e63761 Mon Sep 17 00:00:00 2001 From: DittoTool <90056662+DittoTool@users.noreply.github.com> Date: Wed, 8 Sep 2021 17:38:28 +0800 Subject: [PATCH 07/15] Transform ArrayList to LinkedList --- .../cn/edu/tsinghua/iginx/sql/operator/SelectOperator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/cn/edu/tsinghua/iginx/sql/operator/SelectOperator.java b/core/src/main/java/cn/edu/tsinghua/iginx/sql/operator/SelectOperator.java index 52c099d11..ac03a6e1c 100644 --- a/core/src/main/java/cn/edu/tsinghua/iginx/sql/operator/SelectOperator.java +++ b/core/src/main/java/cn/edu/tsinghua/iginx/sql/operator/SelectOperator.java @@ -16,6 +16,7 @@ import cn.edu.tsinghua.iginx.utils.RpcUtils; import java.util.ArrayList; +import java.util.LinkedList; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -41,7 +42,7 @@ public class SelectOperator extends Operator { public SelectOperator() { this.operatorType = OperatorType.SELECT; this.queryType = QueryType.Unknown; - selectedFuncsAndPaths = new ArrayList<>(); + selectedFuncsAndPaths = new LinkedList<>(); funcTypeSet = new HashSet<>(); fromPath = ""; startTime = Long.MIN_VALUE; From 3393bf7d96f29aada3dcaae6fbe8e6a430bc1a0a Mon Sep 17 00:00:00 2001 From: DittoTool <90056662+DittoTool@users.noreply.github.com> Date: Wed, 8 Sep 2021 18:41:36 +0800 Subject: [PATCH 08/15] Update QueryAggregatorSaveAs.java --- .../iginx/rest/query/aggregator/QueryAggregatorSaveAs.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/aggregator/QueryAggregatorSaveAs.java b/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/aggregator/QueryAggregatorSaveAs.java index 7daac9852..0d4aabc35 100644 --- a/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/aggregator/QueryAggregatorSaveAs.java +++ b/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/aggregator/QueryAggregatorSaveAs.java @@ -25,7 +25,7 @@ import cn.edu.tsinghua.iginx.session.SessionQueryDataSet; import java.util.ArrayList; -import java.util.LinkedList +import java.util.LinkedList; import java.util.List; public class QueryAggregatorSaveAs extends QueryAggregator { From b032f1cdd4465048524c309a97b20b1bcaf739b0 Mon Sep 17 00:00:00 2001 From: DittoTool <90056662+DittoTool@users.noreply.github.com> Date: Wed, 8 Sep 2021 19:10:45 +0800 Subject: [PATCH 09/15] Update Query.java --- core/src/main/java/cn/edu/tsinghua/iginx/rest/query/Query.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/Query.java b/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/Query.java index 8ac539463..37204839d 100644 --- a/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/Query.java +++ b/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/Query.java @@ -19,7 +19,6 @@ package cn.edu.tsinghua.iginx.rest.query; import java.util.ArrayList; -import java.util.LinkedList; import java.util.List; public class Query { @@ -27,7 +26,7 @@ public class Query { private Long endAbsolute; private Long cacheTime; private String timeZone; - private List queryMetrics = new LinkedList<>(); + private List queryMetrics = new ArrayList<>(); public List getQueryMetrics() { return queryMetrics; From a683469a620d0ace79ef7262e65da5ad0ed72a4e Mon Sep 17 00:00:00 2001 From: DittoTool <90056662+DittoTool@users.noreply.github.com> Date: Wed, 8 Sep 2021 19:24:52 +0800 Subject: [PATCH 10/15] Transform ArrayList to LinkedList --- .../edu/tsinghua/iginx/query/expression/BooleanExpression.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/cn/edu/tsinghua/iginx/query/expression/BooleanExpression.java b/core/src/main/java/cn/edu/tsinghua/iginx/query/expression/BooleanExpression.java index c1f8b416a..252c5ed1c 100644 --- a/core/src/main/java/cn/edu/tsinghua/iginx/query/expression/BooleanExpression.java +++ b/core/src/main/java/cn/edu/tsinghua/iginx/query/expression/BooleanExpression.java @@ -20,6 +20,7 @@ import java.util.ArrayDeque; import java.util.ArrayList; +import java.util.LinkedList; import java.util.Deque; import java.util.List; import java.util.Map; @@ -28,7 +29,7 @@ public class BooleanExpression { private String boolExpression; private List postfixExpression; private TreeNode root; - private List timeseries = new ArrayList<>(); + private List timeseries = new LinkedList<>(); public BooleanExpression(String str) { boolExpression = str; From 1595d5b9e0487b908c7afcaead8862cac523ca40 Mon Sep 17 00:00:00 2001 From: DittoTool <90056662+DittoTool@users.noreply.github.com> Date: Wed, 8 Sep 2021 19:29:53 +0800 Subject: [PATCH 11/15] Transform ArrayList to LinkedList --- .../cn/edu/tsinghua/iginx/metadata/DefaultMetaManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/cn/edu/tsinghua/iginx/metadata/DefaultMetaManager.java b/core/src/main/java/cn/edu/tsinghua/iginx/metadata/DefaultMetaManager.java index 215881765..79aeaa533 100644 --- a/core/src/main/java/cn/edu/tsinghua/iginx/metadata/DefaultMetaManager.java +++ b/core/src/main/java/cn/edu/tsinghua/iginx/metadata/DefaultMetaManager.java @@ -42,6 +42,7 @@ import org.slf4j.LoggerFactory; import java.util.ArrayList; +import java.util.LinkedList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; @@ -105,7 +106,7 @@ private DefaultMetaManager() { break; } - storageEngineChangeHooks = Collections.synchronizedList(new ArrayList<>()); + storageEngineChangeHooks = Collections.synchronizedList(new LinkedList<>()); try { initIginx(); From dd40d86b34f30cfb8775e16c7947e7429f8f0c12 Mon Sep 17 00:00:00 2001 From: DittoTool <90056662+DittoTool@users.noreply.github.com> Date: Wed, 8 Sep 2021 19:33:47 +0800 Subject: [PATCH 12/15] Transform two ArrayList objs to LinkedList objs --- .../java/cn/edu/tsinghua/iginx/cluster/IginxWorker.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/cn/edu/tsinghua/iginx/cluster/IginxWorker.java b/core/src/main/java/cn/edu/tsinghua/iginx/cluster/IginxWorker.java index 737b98130..cba4e5000 100644 --- a/core/src/main/java/cn/edu/tsinghua/iginx/cluster/IginxWorker.java +++ b/core/src/main/java/cn/edu/tsinghua/iginx/cluster/IginxWorker.java @@ -62,7 +62,7 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.util.ArrayList; +import java.util.LinkedList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -178,7 +178,7 @@ public Status addStorageEngines(AddStorageEnginesReq req) { return RpcUtils.ACCESS_DENY; } List storageEngines = req.getStorageEngines(); - List storageEngineMetas = new ArrayList<>(); + List storageEngineMetas = new LinkedList<>(); Map checkConnectionMethods = new HashMap<>(); String[] driverInfos = ConfigDescriptor.getInstance().getConfig().getDatabaseClassNames().split(","); @@ -219,7 +219,7 @@ public Status addStorageEngines(AddStorageEnginesReq req) { Status status = RpcUtils.SUCCESS; // 检测是否与已有的存储单元冲突 List currentStorageEngines = metaManager.getStorageEngineList(); - List duplicatedStorageEngine = new ArrayList<>(); + List duplicatedStorageEngine = new LinkedList<>(); for (StorageEngineMeta storageEngine: storageEngineMetas) { for (StorageEngineMeta currentStorageEngine: currentStorageEngines) { if (currentStorageEngine.getIp().equals(storageEngine.getIp()) && currentStorageEngine.getPort() == storageEngine.getPort()) { @@ -238,7 +238,7 @@ public Status addStorageEngines(AddStorageEnginesReq req) { status.setMessage("unexpected repeated add"); } if (!storageEngineMetas.isEmpty()) { - storageEngineMetas.get(storageEngineMetas.size() - 1).setLastOfBatch(true); // 每一批最后一个是 true,表示需要进行扩容 + storageEngineMetas.getLast().setLastOfBatch(true); // 每一批最后一个是 true,表示需要进行扩容 } if (!metaManager.addStorageEngines(storageEngineMetas)) { status = RpcUtils.FAILURE; From e94a579603feef1d14c59e6e86170fd3df0074dc Mon Sep 17 00:00:00 2001 From: DittoTool <90056662+DittoTool@users.noreply.github.com> Date: Wed, 8 Sep 2021 19:39:24 +0800 Subject: [PATCH 13/15] Transform TreeMap to HashMap --- .../main/java/cn/edu/tsinghua/iginx/rest/query/QueryResult.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/QueryResult.java b/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/QueryResult.java index dc623eba9..483f779c0 100644 --- a/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/QueryResult.java +++ b/core/src/main/java/cn/edu/tsinghua/iginx/rest/query/QueryResult.java @@ -262,7 +262,7 @@ private String sampleSizeToString(int num) { private Map> getTagsFromPaths(String name, List paths) throws Exception { List> dup = new ArrayList<>(); Map> ret = new TreeMap<>(); - Map pos2path = new TreeMap<>(); + Map pos2path = new HashMap<>(); Map metricschema = metaManager.getSchemaMapping(name); if (metricschema == null) { throw new Exception("No metadata found"); From 19de47434bc1a5960cab0f2ca01f2bb84a6410e8 Mon Sep 17 00:00:00 2001 From: DittoTool <90056662+DittoTool@users.noreply.github.com> Date: Thu, 9 Sep 2021 10:58:33 +0800 Subject: [PATCH 14/15] Update IginxWorker.java Fix a bug in allocation statement --- .../main/java/cn/edu/tsinghua/iginx/cluster/IginxWorker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/cn/edu/tsinghua/iginx/cluster/IginxWorker.java b/core/src/main/java/cn/edu/tsinghua/iginx/cluster/IginxWorker.java index cba4e5000..0a5021a03 100644 --- a/core/src/main/java/cn/edu/tsinghua/iginx/cluster/IginxWorker.java +++ b/core/src/main/java/cn/edu/tsinghua/iginx/cluster/IginxWorker.java @@ -178,7 +178,7 @@ public Status addStorageEngines(AddStorageEnginesReq req) { return RpcUtils.ACCESS_DENY; } List storageEngines = req.getStorageEngines(); - List storageEngineMetas = new LinkedList<>(); + LinkedList storageEngineMetas = new LinkedList<>(); Map checkConnectionMethods = new HashMap<>(); String[] driverInfos = ConfigDescriptor.getInstance().getConfig().getDatabaseClassNames().split(","); From a1c9fe46aeec67b0caf601fca607a4fe44bad807 Mon Sep 17 00:00:00 2001 From: Yuan Zi Date: Thu, 9 Sep 2021 11:07:24 +0800 Subject: [PATCH 15/15] Update DataPointsParser.java --- .../java/cn/edu/tsinghua/iginx/rest/insert/DataPointsParser.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/main/java/cn/edu/tsinghua/iginx/rest/insert/DataPointsParser.java b/core/src/main/java/cn/edu/tsinghua/iginx/rest/insert/DataPointsParser.java index 19415ac14..c2cfa0b3a 100644 --- a/core/src/main/java/cn/edu/tsinghua/iginx/rest/insert/DataPointsParser.java +++ b/core/src/main/java/cn/edu/tsinghua/iginx/rest/insert/DataPointsParser.java @@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory; import java.io.Reader; +import java.util.ArrayList; import java.util.LinkedList; import java.util.Iterator; import java.util.List;