LeiRui commented on a change in pull request #262: [IOTDB-144]meta data cache
for query
URL: https://github.com/apache/incubator-iotdb/pull/262#discussion_r305601873
##########
File path:
iotdb/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
##########
@@ -447,6 +456,9 @@ public void putAllWorkingTsFileProcessorIntoClosingList() {
// TODO need a read lock, please consider the concurrency with flush manager
threads.
public QueryDataSource query(String deviceId, String measurementId,
QueryContext context) {
insertLock.readLock().lock();
+ synchronized (lruForSensorUsedInQuery) {
+ lruForSensorUsedInQuery.add(measurementId);
Review comment:
Same as above, the current `lruForSensorUsedInQuery` is for `measurementId`
only. My questions are:
1. Why not use `deviceId.measurementId`?
For example, `root.vehicle.d0.s0` and `root.vehicle.d1.s0` are different
series. However, by the current code, only `s0` is used. The hottest sensor
doesn't equal the hottest series.
2. Take it further, why not use `deviceId`
and cache `TsDeviceMetadata` for every recently used device? (Or frequenly
used device, but I prefer recently used device here. )
For example, I query d0.s0, d0.s1, d0.s2, d0.s3 and d0 is the most recently
used device.
One benefit is that if the `TsDeviceMetadata` of `file1.d0` is cached and
`file1.d0.s4` is not found in this `TsDeviceMetadata`, then `file1` can be
skipped safely with knowing that `d0.s4` doesn't exist in this file. However,
in the current pr, suppose that `List<ChunkMetadata>` of
`file1.d0.s1`、`file1.d0.s2`、`file1.d0.s3` is cached separately and
`file1.d0.s4` is not found in the cache, then `file1` needs to be read again
for `d0.s4`.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services