HTHou commented on a change in pull request #1269:
URL: https://github.com/apache/incubator-iotdb/pull/1269#discussion_r431538186



##########
File path: 
server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileResource.java
##########
@@ -339,12 +362,106 @@ public long getFileSize() {
     return file.length();
   }
 
-  public Map<String, Long> getStartTimeMap() {
-    return startTimeMap;
+  public long getStartTime(String deviceId) {
+    if (!deviceToIndex.containsKey(deviceId)) {
+      return -1;
+    }
+    return startTimes[deviceToIndex.get(deviceId)];
+  }
+
+  public long getStartTime(int index) {
+    return startTimes[index];
+  }
+
+  public long getEndTime(String deviceId) {
+    if (!deviceToIndex.containsKey(deviceId)) {
+      return -1;

Review comment:
       Fixed~

##########
File path: 
server/src/main/java/org/apache/iotdb/db/query/executor/fill/LastPointReader.java
##########
@@ -183,11 +182,8 @@ private boolean shouldUpdate(long time, long version, long 
newTime, long newVers
     PriorityQueue<TsFileResource> unseqTsFilesSet =
         new PriorityQueue<>(
             (o1, o2) -> {
-              Map<String, Long> startTimeMap = o1.getEndTimeMap();
-              Long minTimeOfO1 = startTimeMap.get(seriesPath.getDevice());
-              Map<String, Long> startTimeMap2 = o2.getEndTimeMap();
-              Long minTimeOfO2 = startTimeMap2.get(seriesPath.getDevice());
-
+              Long minTimeOfO1 = o1.getEndTime(seriesPath.getDevice());
+              Long minTimeOfO2 = o2.getEndTime(seriesPath.getDevice());

Review comment:
       Fixed~

##########
File path: 
server/src/main/java/org/apache/iotdb/db/writelog/recover/LogReplayer.java
##########
@@ -127,8 +127,8 @@ private void replayBatchInsert(InsertTabletPlan 
insertTabletPlan)
       throws WriteProcessException, QueryProcessException {
     if (currentTsFileResource != null) {
       // the last chunk group may contain the same data with the logs, ignore 
such logs in seq file
-      Long lastEndTime = 
currentTsFileResource.getEndTimeMap().get(insertTabletPlan.getDeviceId());
-      if (lastEndTime != null && lastEndTime >= insertTabletPlan.getMinTime() 
&&
+      long lastEndTime = 
currentTsFileResource.getEndTime(insertTabletPlan.getDeviceId());
+      if (lastEndTime >= 0 && lastEndTime >= insertTabletPlan.getMinTime() &&

Review comment:
       Fixed~

##########
File path: 
server/src/main/java/org/apache/iotdb/db/writelog/recover/LogReplayer.java
##########
@@ -155,8 +155,8 @@ private void replayBatchInsert(InsertTabletPlan 
insertTabletPlan)
   private void replayInsert(InsertPlan insertPlan) {
     if (currentTsFileResource != null) {
       // the last chunk group may contain the same data with the logs, ignore 
such logs in seq file
-      Long lastEndTime = 
currentTsFileResource.getEndTimeMap().get(insertPlan.getDeviceId());
-      if (lastEndTime != null && lastEndTime >= insertPlan.getTime() &&
+      long lastEndTime = 
currentTsFileResource.getEndTime(insertPlan.getDeviceId());
+      if (lastEndTime >= 0 && lastEndTime >= insertPlan.getTime() &&

Review comment:
       Fixed~

##########
File path: 
server/src/main/java/org/apache/iotdb/db/engine/merge/task/MergeMultiChunkTask.java
##########
@@ -152,9 +152,9 @@ private void pathsMergeOneFile(int seqFileIdx, 
IPointReader[] unseqReaders)
       throws IOException {
     TsFileResource currTsFile = resource.getSeqFiles().get(seqFileIdx);
     String deviceId = currMergingPaths.get(0).getDevice();
-    Long currDeviceMinTime = currTsFile.getStartTimeMap().get(deviceId);
+    long currDeviceMinTime = currTsFile.getStartTime(deviceId);
     //COMMENTS: is this correct? how about if there are other devices (in the 
currMergingPaths) that have unseq data?
-    if (currDeviceMinTime == null) {
+    if (currDeviceMinTime < 0) {

Review comment:
       Fixed~




----------------------------------------------------------------
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]


Reply via email to