You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2021/06/09 03:44:03 UTC
[iotdb] 02/02: add java doc for cache, SGP, TsFileResource, query
This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch add-java-doc
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit a122d74d9015ff0da5b6bc28393226090030c090
Author: JackieTien97 <Ja...@foxmail.com>
AuthorDate: Wed Jun 9 11:43:20 2021 +0800
add java doc for cache, SGP, TsFileResource, query
---
.../iotdb/db/engine/cache/TimeSeriesMetadataCache.java | 14 ++++++++++++++
.../db/engine/storagegroup/StorageGroupProcessor.java | 4 ++++
.../iotdb/db/engine/storagegroup/TsFileResource.java | 4 ++++
.../iotdb/db/qp/physical/crud/RawDataQueryPlan.java | 18 ++++++++++++++++++
4 files changed, 40 insertions(+)
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java b/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java
index 69d709b..889ba9e 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/cache/TimeSeriesMetadataCache.java
@@ -303,6 +303,10 @@ public class TimeSeriesMetadataCache {
try {
timeSeriesMetadataList.forEach(
metadata -> {
+ // for root.sg1.d1.vector1.s1, key.device of vector will only return root.sg1.d1
+ // metadata.getMeasurementId() will return s1, the vector1 is saved in
+ // key.measurement
+ // so we should concat them to get the deviceId for root.sg1.d1.vector1.s1
TimeSeriesMetadataCacheKey k =
new TimeSeriesMetadataCacheKey(
key.filePath,
@@ -340,6 +344,16 @@ public class TimeSeriesMetadataCache {
}
}
+ /**
+ * !!!Attention!!!
+ *
+ * <p>For a vector, e.g. root.sg1.d1.vector1(s1, s2) TimeSeriesMetadataCacheKey for vector1 should
+ * be {filePath: ""./data/data/seq/......., device: root.sg1.d1.vector1, measurement: vector1},
+ * vector1 will be in both device and measurement TimeSeriesMetadataCacheKey for vector1.s1 should
+ * be {filePath: ""./data/data/seq/......., device: root.sg1.d1.vector1, measurement: s1}
+ * TimeSeriesMetadataCacheKey for vector1.s2 should be {filePath: ""./data/data/seq/.......,
+ * device: root.sg1.d1.vector1, measurement: s2}
+ */
private void getVectorTimeSeriesMetadataListFromCache(
TimeSeriesMetadataCacheKey key, List<String> subSensorList, List<TimeseriesMetadata> res) {
lock.readLock().lock();
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
index eb304e7..2b2185d 100755
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
@@ -289,6 +289,10 @@ public class StorageGroupProcessor {
// DEFAULT_POOL_TRIM_INTERVAL_MILLIS
private long timeWhenPoolNotEmpty = Long.MAX_VALUE;
+ /**
+ * record the insertWriteLock in SG is being hold by which method, it will be empty string if on
+ * one holds the insertWriteLock
+ */
private String insertWriteLockHolder = "";
/** get the direct byte buffer from pool, each fetch contains two ByteBuffer */
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
index 1d46900..9449437 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
@@ -217,6 +217,10 @@ public class TsFileResource {
this.timeIndexType = 1;
}
+ /**
+ * Because the unclosed tsfile don't have TimeSeriesMetadata and memtables in the memory don't
+ * have chunkMetadata, but query will use these, so we need to generate it for them.
+ */
@SuppressWarnings("squid:S3776") // high Cognitive Complexity
private void generateTimeSeriesMetadata() throws IOException {
TimeseriesMetadata timeTimeSeriesMetadata = new TimeseriesMetadata();
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/RawDataQueryPlan.java b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/RawDataQueryPlan.java
index 15d9b48..796acc3 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/RawDataQueryPlan.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/physical/crud/RawDataQueryPlan.java
@@ -46,7 +46,9 @@ public class RawDataQueryPlan extends QueryPlan {
private IExpression expression = null;
private Map<String, Set<String>> deviceToMeasurements = new HashMap<>();
+ /** used to group all the sub sensors of one vector into VectorPartialPath */
private List<PartialPath> deduplicatedVectorPaths = new ArrayList<>();
+
private List<TSDataType> deduplicatedVectorDataTypes = new ArrayList<>();
public RawDataQueryPlan() {
@@ -93,9 +95,15 @@ public class RawDataQueryPlan extends QueryPlan {
}
}
+ // TODO Maybe we should get VectorPartialPath above from MTree
+ // Currently, the above processing will only produce PartialPath instead of VectorPartialPath
+ // even if the queried time series is vector
+ // So, we need to transform the PartialPath to VectorPartialPath if is is a vector.
if (!isRawQuery()) {
transformPaths(IoTDB.metaManager);
} else {
+ // if it is a RawQueryWithoutValueFilter, we also need to group all the subSensors of one
+ // vector into one VectorPartialPath
transformVectorPaths(physicalGenerator, columnForDisplaySet);
}
}
@@ -178,6 +186,12 @@ public class RawDataQueryPlan extends QueryPlan {
}
}
+ /**
+ * Group all the subSensors of one vector into one VectorPartialPath save the grouped
+ * VectorPartialPath in deduplicatedVectorPaths and deduplicatedVectorDataTypes instead of putting
+ * them directly into deduplicatedPaths and deduplicatedDataTypes, because we don't know whether
+ * the raw query has value filter here.
+ */
public void transformVectorPaths(
PhysicalGenerator physicalGenerator, Set<String> columnForDisplaySet)
throws MetadataException {
@@ -214,6 +228,10 @@ public class RawDataQueryPlan extends QueryPlan {
this.deduplicatedVectorDataTypes = deduplicatedVectorDataTypes;
}
+ /**
+ * RawQueryWithoutValueFilter should call this method to use grouped vector partial path to
+ * replace the previous deduplicatedPaths and deduplicatedDataTypes
+ */
public void transformToVector() {
if (!this.deduplicatedVectorPaths.isEmpty()) {
this.deduplicatedPaths = this.deduplicatedVectorPaths;