fanhualta commented on a change in pull request #664: [IOTDB-333] Storage group
divide by time range
URL: https://github.com/apache/incubator-iotdb/pull/664#discussion_r361038719
##########
File path:
server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
##########
@@ -389,20 +431,40 @@ public void insert(InsertPlan insertPlan) throws
QueryProcessException {
continue;
}
results[i] = TSStatusCode.SUCCESS_STATUS.getStatusCode();
+ long timeRangeId = fromTimeToTimeRange(currTime);
if (currTime > lastFlushTime) {
- sequenceIndexes.add(i);
+ // for sequence
+ List<Integer> curIndex = sequenceTimeRangeIndexes.get(timeRangeId);
+ if (curIndex == null) {
+ // if map not contains this time range
+ curIndex = new ArrayList<>();
+ sequenceTimeRangeIndexes.put(timeRangeId, curIndex);
+ }
+
+ curIndex.add(i);
Review comment:
These codes are a little bit tedious. The following implementation is better:
```
sequenceTimeRangeIndexes.computeIfAbsent(timeRangeId, k -> new
ArrayList<>()).add(i);
```
----------------------------------------------------------------
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