You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/01/11 10:44:30 UTC

[GitHub] [iotdb] SilverNarcissus opened a new pull request #4776: [IOTDB-2244] Support flush time management by ID table

SilverNarcissus opened a new pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776


   Since ID table is come to live, we can use it to support flush time management for saving memory.
   
   This PR has:
   - [ ] been self-reviewed.
       - [ ] concurrent read
       - [ ] concurrent write
       - [ ] concurrent read and write 
   - [ ] added documentation for new or modified features or behaviors.
   - [ ] added Javadocs for most classes and all non-trivial methods. 
   - [ ] added or updated version, __license__, or notice information
   - [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious 
     for an unfamiliar reader.
   - [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold 
     for code coverage.
   - [ ] added integration tests.
   - [ ] been tested in a test IoTDB cluster.
   
   <!-- Check the items by putting "x" in the brackets for the done things. Not all of these items 
   apply to every PR. Remove the items which are not done or not relevant to the PR. None of the items 
   from the checklist above are strictly necessary, but it would be very helpful if you at least 
   self-review the PR. -->
   
   <hr>


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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] HTHou commented on a change in pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
HTHou commented on a change in pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#discussion_r785254070



##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/IDTableFlushTimeManager.java
##########
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.engine.storagegroup;
+
+import org.apache.iotdb.db.metadata.idtable.IDTable;
+import org.apache.iotdb.db.metadata.idtable.entry.DeviceEntry;
+
+import java.util.Map;
+
+/**
+ * This class manages last time and flush time for sequence and unsequence determination This class
+ * This class is NOT thread safe, caller should ensure synchronization This class not support
+ * upgrade
+ */
+public class IDTableFlushTimeManager implements ILastFlushTimeManager {
+  IDTable idTable;
+
+  public IDTableFlushTimeManager(IDTable idTable) {
+    this.idTable = idTable;
+  }
+
+  // region set
+  @Override
+  public void setLastTimeAll(long timePartitionId, Map<String, Long> lastTimeMap) {
+    for (Map.Entry<String, Long> entry : lastTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putLastTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setLastTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putLastTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setFlushedTimeAll(long timePartitionId, Map<String, Long> flushedTimeMap) {
+    for (Map.Entry<String, Long> entry : flushedTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putFlushTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setFlushedTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putFlushTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setGlobalFlushedTimeAll(Map<String, Long> globalFlushedTimeMap) {
+    for (Map.Entry<String, Long> entry : globalFlushedTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).setGlobalFlushTime(entry.getValue());
+    }
+  }
+
+  @Override
+  public void setGlobalFlushedTime(String path, long time) {
+    idTable.getDeviceEntry(path).setGlobalFlushTime(time);
+  }
+
+  // endregion
+
+  // region update

Review comment:
       remove this




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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] sonarcloud[bot] commented on pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#issuecomment-1013071488


   SonarCloud Quality Gate failed.&nbsp; &nbsp; ![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=CODE_SMELL) [10 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=CODE_SMELL)
   
   [![70.5%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '70.5%')](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=4776&metric=new_coverage&view=list) [70.5% Coverage](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=4776&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=4776&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=4776&metric=new_duplicated_lines_density&view=list)
   
   


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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] coveralls edited a comment on pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#issuecomment-1011899641


   
   [![Coverage Status](https://coveralls.io/builds/45622834/badge)](https://coveralls.io/builds/45622834)
   
   Coverage increased (+0.02%) to 68.048% when pulling **7294c834720df4d9218061ea2625467abff2c55e on xkf_id_table_flush_time** into **302e9b9153ec1d2c39187151a425ffac9275f6b6 on master**.
   


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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] HTHou commented on a change in pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
HTHou commented on a change in pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#discussion_r785254796



##########
File path: server/src/test/java/org/apache/iotdb/db/metadata/idtable/IDTableFlushTimeTest.java
##########
@@ -0,0 +1,226 @@
+/*
+ *Licensed to the Apache Software Foundation(ASF)under one
+ *or more contributor license agreements.See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.The ASF licenses this file
+ *to you under the Apache License,Version2.0(the
+ *"License");you may not use this file except in compliance
+ *with the License.You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS"BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *KIND,either express or implied.See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */

Review comment:
       ```suggestion
   /*
    * Licensed to the Apache Software Foundation (ASF) under one
    * or more contributor license agreements.  See the NOTICE file
    * distributed with this work for additional information
    * regarding copyright ownership.  The ASF licenses this file
    * to you under the Apache License, Version 2.0 (the
    * "License"); you may not use this file except in compliance
    * with the License.  You may obtain a copy of the License at
    *
    *     http://www.apache.org/licenses/LICENSE-2.0
    *
    * Unless required by applicable law or agreed to in writing,
    * software distributed under the License is distributed on an
    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    * KIND, either express or implied.  See the License for the
    * specific language governing permissions and limitations
    * under the License.
    */
   ```




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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] sonarcloud[bot] removed a comment on pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] removed a comment on pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#issuecomment-1012791099


   SonarCloud Quality Gate failed.&nbsp; &nbsp; ![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=CODE_SMELL) [12 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=CODE_SMELL)
   
   [![70.8%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '70.8%')](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=4776&metric=new_coverage&view=list) [70.8% Coverage](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=4776&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=4776&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=4776&metric=new_duplicated_lines_density&view=list)
   
   


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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] HTHou commented on a change in pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
HTHou commented on a change in pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#discussion_r785254627



##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/VirtualStorageGroupProcessor.java
##########
@@ -263,7 +263,7 @@
   // DEFAULT_POOL_TRIM_INTERVAL_MILLIS
   private long timeWhenPoolNotEmpty = Long.MAX_VALUE;
 
-  private LastFlushTimeManager lastFlushTimeManager = new LastFlushTimeManager();
+  private ILastFlushTimeManager lastFlushTimeManager = new LastFlushTimeManager();

Review comment:
       Line 414 created a new LastFlushTimeManager, so we don't need to create new here?




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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] qiaojialin commented on a change in pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
qiaojialin commented on a change in pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#discussion_r785598835



##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/IDTableFlushTimeManager.java
##########
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.engine.storagegroup;
+
+import org.apache.iotdb.db.metadata.idtable.IDTable;
+import org.apache.iotdb.db.metadata.idtable.entry.DeviceEntry;
+
+import java.util.Map;
+
+/**
+ * This class manages last time and flush time for sequence and unsequence determination This class
+ * This class is NOT thread safe, caller should ensure synchronization This class not support
+ * upgrade
+ */
+public class IDTableFlushTimeManager implements ILastFlushTimeManager {
+  IDTable idTable;
+
+  public IDTableFlushTimeManager(IDTable idTable) {
+    this.idTable = idTable;
+  }
+
+  // region set
+  @Override
+  public void setLastTimeAll(long timePartitionId, Map<String, Long> lastTimeMap) {
+    for (Map.Entry<String, Long> entry : lastTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putLastTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setLastTime(long timePartitionId, String path, long time) {

Review comment:
       ```suggestion
     public void setOneDeviceLastTime(long timePartitionId, String path, long time) {
   ```

##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/idtable/entry/DeviceEntry.java
##########
@@ -32,9 +32,18 @@
 
   boolean isAligned;
 
+  // for manages flush time

Review comment:
       ```suggestion
     // for managing flush time
   ```
   
   Add javadoc for key and value, time partition -> flushTime

##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/IDTableFlushTimeManager.java
##########
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.engine.storagegroup;
+
+import org.apache.iotdb.db.metadata.idtable.IDTable;
+import org.apache.iotdb.db.metadata.idtable.entry.DeviceEntry;
+
+import java.util.Map;
+
+/**
+ * This class manages last time and flush time for sequence and unsequence determination This class
+ * This class is NOT thread safe, caller should ensure synchronization This class not support
+ * upgrade
+ */
+public class IDTableFlushTimeManager implements ILastFlushTimeManager {
+  IDTable idTable;
+
+  public IDTableFlushTimeManager(IDTable idTable) {
+    this.idTable = idTable;
+  }
+
+  // region set
+  @Override
+  public void setLastTimeAll(long timePartitionId, Map<String, Long> lastTimeMap) {
+    for (Map.Entry<String, Long> entry : lastTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putLastTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setLastTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putLastTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setFlushedTimeAll(long timePartitionId, Map<String, Long> flushedTimeMap) {
+    for (Map.Entry<String, Long> entry : flushedTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putFlushTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setFlushedTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putFlushTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setGlobalFlushedTimeAll(Map<String, Long> globalFlushedTimeMap) {

Review comment:
       ```suggestion
     public void setMultiDeviceGlobalFlushedTime(Map<String, Long> globalFlushedTimeMap) {
   ```

##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/IDTableFlushTimeManager.java
##########
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.engine.storagegroup;
+
+import org.apache.iotdb.db.metadata.idtable.IDTable;
+import org.apache.iotdb.db.metadata.idtable.entry.DeviceEntry;
+
+import java.util.Map;
+
+/**
+ * This class manages last time and flush time for sequence and unsequence determination This class
+ * This class is NOT thread safe, caller should ensure synchronization This class not support
+ * upgrade
+ */
+public class IDTableFlushTimeManager implements ILastFlushTimeManager {
+  IDTable idTable;
+
+  public IDTableFlushTimeManager(IDTable idTable) {
+    this.idTable = idTable;
+  }
+
+  // region set
+  @Override
+  public void setLastTimeAll(long timePartitionId, Map<String, Long> lastTimeMap) {
+    for (Map.Entry<String, Long> entry : lastTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putLastTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setLastTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putLastTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setFlushedTimeAll(long timePartitionId, Map<String, Long> flushedTimeMap) {
+    for (Map.Entry<String, Long> entry : flushedTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putFlushTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setFlushedTime(long timePartitionId, String path, long time) {

Review comment:
       ```suggestion
     public void setOneDeviceFlushedTime(long timePartitionId, String path, long time) {
   ```

##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/IDTableFlushTimeManager.java
##########
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.engine.storagegroup;
+
+import org.apache.iotdb.db.metadata.idtable.IDTable;
+import org.apache.iotdb.db.metadata.idtable.entry.DeviceEntry;
+
+import java.util.Map;
+
+/**
+ * This class manages last time and flush time for sequence and unsequence determination This class
+ * This class is NOT thread safe, caller should ensure synchronization This class not support
+ * upgrade
+ */
+public class IDTableFlushTimeManager implements ILastFlushTimeManager {
+  IDTable idTable;
+
+  public IDTableFlushTimeManager(IDTable idTable) {
+    this.idTable = idTable;
+  }
+
+  // region set
+  @Override
+  public void setLastTimeAll(long timePartitionId, Map<String, Long> lastTimeMap) {
+    for (Map.Entry<String, Long> entry : lastTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putLastTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setLastTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putLastTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setFlushedTimeAll(long timePartitionId, Map<String, Long> flushedTimeMap) {
+    for (Map.Entry<String, Long> entry : flushedTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putFlushTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setFlushedTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putFlushTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setGlobalFlushedTimeAll(Map<String, Long> globalFlushedTimeMap) {
+    for (Map.Entry<String, Long> entry : globalFlushedTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).setGlobalFlushTime(entry.getValue());
+    }
+  }
+
+  @Override
+  public void setGlobalFlushedTime(String path, long time) {

Review comment:
       ```suggestion
     public void setOneDeviceGlobalFlushedTime(String path, long time) {
   ```

##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/idtable/entry/DeviceEntry.java
##########
@@ -32,9 +32,18 @@
 
   boolean isAligned;
 
+  // for manages flush time
+  Map<Long, Long> lastTimeMap;
+
+  Map<Long, Long> flushTimeMap;

Review comment:
       ```suggestion
     Map<Long, Long> flushTimeOfEachPartition;
   ```

##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/IDTableFlushTimeManager.java
##########
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.engine.storagegroup;
+
+import org.apache.iotdb.db.metadata.idtable.IDTable;
+import org.apache.iotdb.db.metadata.idtable.entry.DeviceEntry;
+
+import java.util.Map;
+
+/**
+ * This class manages last time and flush time for sequence and unsequence determination This class
+ * This class is NOT thread safe, caller should ensure synchronization This class not support
+ * upgrade
+ */
+public class IDTableFlushTimeManager implements ILastFlushTimeManager {
+  IDTable idTable;
+
+  public IDTableFlushTimeManager(IDTable idTable) {
+    this.idTable = idTable;
+  }
+
+  // region set
+  @Override
+  public void setLastTimeAll(long timePartitionId, Map<String, Long> lastTimeMap) {
+    for (Map.Entry<String, Long> entry : lastTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putLastTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setLastTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putLastTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setFlushedTimeAll(long timePartitionId, Map<String, Long> flushedTimeMap) {

Review comment:
       ```suggestion
     public void setMultiDeviceFlushedTime(long timePartitionId, Map<String, Long> flushedTimeMap) {
   ```

##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/IDTableFlushTimeManager.java
##########
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.engine.storagegroup;
+
+import org.apache.iotdb.db.metadata.idtable.IDTable;
+import org.apache.iotdb.db.metadata.idtable.entry.DeviceEntry;
+
+import java.util.Map;
+
+/**
+ * This class manages last time and flush time for sequence and unsequence determination This class
+ * This class is NOT thread safe, caller should ensure synchronization This class not support
+ * upgrade
+ */
+public class IDTableFlushTimeManager implements ILastFlushTimeManager {
+  IDTable idTable;
+
+  public IDTableFlushTimeManager(IDTable idTable) {
+    this.idTable = idTable;
+  }
+
+  // region set
+  @Override
+  public void setLastTimeAll(long timePartitionId, Map<String, Long> lastTimeMap) {

Review comment:
       ```suggestion
     public void setMultiDeviceLastTime(long timePartitionId, Map<String, Long> lastTimeMap) {
   ```




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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] sonarcloud[bot] removed a comment on pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] removed a comment on pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#issuecomment-1013071488


   SonarCloud Quality Gate failed.&nbsp; &nbsp; ![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=CODE_SMELL) [10 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=CODE_SMELL)
   
   [![70.5%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '70.5%')](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=4776&metric=new_coverage&view=list) [70.5% Coverage](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=4776&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=4776&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=4776&metric=new_duplicated_lines_density&view=list)
   
   


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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] coveralls commented on pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
coveralls commented on pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#issuecomment-1011899641


   
   [![Coverage Status](https://coveralls.io/builds/45591109/badge)](https://coveralls.io/builds/45591109)
   
   Coverage increased (+0.3%) to 67.958% when pulling **d4b70685428cfa2a6604a9691d98bdc149c978eb on xkf_id_table_flush_time** into **50f171b65c6a7f456902a5fe0e482ddcbeb2344b on master**.
   


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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] SilverNarcissus commented on a change in pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
SilverNarcissus commented on a change in pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#discussion_r785268245



##########
File path: server/src/test/java/org/apache/iotdb/db/metadata/idtable/IDTableFlushTimeTest.java
##########
@@ -0,0 +1,226 @@
+/*
+ *Licensed to the Apache Software Foundation(ASF)under one
+ *or more contributor license agreements.See the NOTICE file
+ *distributed with this work for additional information
+ *regarding copyright ownership.The ASF licenses this file
+ *to you under the Apache License,Version2.0(the
+ *"License");you may not use this file except in compliance
+ *with the License.You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *Unless required by applicable law or agreed to in writing,
+ *software distributed under the License is distributed on an
+ *"AS IS"BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *KIND,either express or implied.See the License for the
+ *specific language governing permissions and limitations
+ *under the License.
+ */

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.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] HTHou commented on a change in pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
HTHou commented on a change in pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#discussion_r785254127



##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/IDTableFlushTimeManager.java
##########
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.engine.storagegroup;
+
+import org.apache.iotdb.db.metadata.idtable.IDTable;
+import org.apache.iotdb.db.metadata.idtable.entry.DeviceEntry;
+
+import java.util.Map;
+
+/**
+ * This class manages last time and flush time for sequence and unsequence determination This class
+ * This class is NOT thread safe, caller should ensure synchronization This class not support
+ * upgrade
+ */
+public class IDTableFlushTimeManager implements ILastFlushTimeManager {
+  IDTable idTable;
+
+  public IDTableFlushTimeManager(IDTable idTable) {
+    this.idTable = idTable;
+  }
+
+  // region set
+  @Override
+  public void setLastTimeAll(long timePartitionId, Map<String, Long> lastTimeMap) {
+    for (Map.Entry<String, Long> entry : lastTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putLastTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setLastTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putLastTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setFlushedTimeAll(long timePartitionId, Map<String, Long> flushedTimeMap) {
+    for (Map.Entry<String, Long> entry : flushedTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putFlushTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setFlushedTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putFlushTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setGlobalFlushedTimeAll(Map<String, Long> globalFlushedTimeMap) {
+    for (Map.Entry<String, Long> entry : globalFlushedTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).setGlobalFlushTime(entry.getValue());
+    }
+  }
+
+  @Override
+  public void setGlobalFlushedTime(String path, long time) {
+    idTable.getDeviceEntry(path).setGlobalFlushTime(time);
+  }
+
+  // endregion
+
+  // region update
+
+  @Override
+  public void updateLastTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).updateLastTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void updateFlushedTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).updateFlushTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void updateGlobalFlushedTime(String path, long time) {
+    idTable.getDeviceEntry(path).updateGlobalFlushTime(time);
+  }
+
+  @Override
+  public void updateNewlyFlushedPartitionLatestFlushedTimeForEachDevice(
+      long partitionId, String deviceId, long time) {
+    throw new UnsupportedOperationException("IDTableFlushTimeManager doesn't support upgrade");
+  }
+
+  // endregion
+
+  // region ensure

Review comment:
       remove this




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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] SilverNarcissus commented on a change in pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
SilverNarcissus commented on a change in pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#discussion_r785268250



##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/VirtualStorageGroupProcessor.java
##########
@@ -263,7 +263,7 @@
   // DEFAULT_POOL_TRIM_INTERVAL_MILLIS
   private long timeWhenPoolNotEmpty = Long.MAX_VALUE;
 
-  private LastFlushTimeManager lastFlushTimeManager = new LastFlushTimeManager();
+  private ILastFlushTimeManager lastFlushTimeManager = new LastFlushTimeManager();

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.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] coveralls edited a comment on pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#issuecomment-1011899641


   
   [![Coverage Status](https://coveralls.io/builds/45623278/badge)](https://coveralls.io/builds/45623278)
   
   Coverage increased (+0.03%) to 68.057% when pulling **7294c834720df4d9218061ea2625467abff2c55e on xkf_id_table_flush_time** into **302e9b9153ec1d2c39187151a425ffac9275f6b6 on master**.
   


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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] coveralls edited a comment on pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#issuecomment-1011899641


   
   [![Coverage Status](https://coveralls.io/builds/45631025/badge)](https://coveralls.io/builds/45631025)
   
   Coverage increased (+0.02%) to 68.049% when pulling **12f3a98ed64c4e3a0a6061e52d16279131561395 on xkf_id_table_flush_time** into **302e9b9153ec1d2c39187151a425ffac9275f6b6 on master**.
   


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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] HeimingZ commented on a change in pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
HeimingZ commented on a change in pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#discussion_r783923408



##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/idtable/entry/DeviceEntry.java
##########
@@ -32,9 +32,18 @@
 
   boolean isAligned;
 
+  // for manages flush time
+  Map<Long, Long> lastTimeMap;
+
+  Map<Long, Long> flushTimeMap;

Review comment:
       ACK, your implementation is better.




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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] SilverNarcissus commented on a change in pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
SilverNarcissus commented on a change in pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#discussion_r785810053



##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/idtable/entry/DeviceEntry.java
##########
@@ -32,9 +32,18 @@
 
   boolean isAligned;
 
+  // for manages flush time
+  Map<Long, Long> lastTimeMap;
+
+  Map<Long, Long> flushTimeMap;

Review comment:
       fixed~

##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/IDTableFlushTimeManager.java
##########
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.engine.storagegroup;
+
+import org.apache.iotdb.db.metadata.idtable.IDTable;
+import org.apache.iotdb.db.metadata.idtable.entry.DeviceEntry;
+
+import java.util.Map;
+
+/**
+ * This class manages last time and flush time for sequence and unsequence determination This class
+ * This class is NOT thread safe, caller should ensure synchronization This class not support
+ * upgrade
+ */
+public class IDTableFlushTimeManager implements ILastFlushTimeManager {
+  IDTable idTable;
+
+  public IDTableFlushTimeManager(IDTable idTable) {
+    this.idTable = idTable;
+  }
+
+  // region set
+  @Override
+  public void setLastTimeAll(long timePartitionId, Map<String, Long> lastTimeMap) {
+    for (Map.Entry<String, Long> entry : lastTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putLastTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setLastTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putLastTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setFlushedTimeAll(long timePartitionId, Map<String, Long> flushedTimeMap) {
+    for (Map.Entry<String, Long> entry : flushedTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putFlushTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setFlushedTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putFlushTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setGlobalFlushedTimeAll(Map<String, Long> globalFlushedTimeMap) {
+    for (Map.Entry<String, Long> entry : globalFlushedTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).setGlobalFlushTime(entry.getValue());
+    }
+  }
+
+  @Override
+  public void setGlobalFlushedTime(String path, long time) {

Review comment:
       fixed~

##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/IDTableFlushTimeManager.java
##########
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.engine.storagegroup;
+
+import org.apache.iotdb.db.metadata.idtable.IDTable;
+import org.apache.iotdb.db.metadata.idtable.entry.DeviceEntry;
+
+import java.util.Map;
+
+/**
+ * This class manages last time and flush time for sequence and unsequence determination This class
+ * This class is NOT thread safe, caller should ensure synchronization This class not support
+ * upgrade
+ */
+public class IDTableFlushTimeManager implements ILastFlushTimeManager {
+  IDTable idTable;
+
+  public IDTableFlushTimeManager(IDTable idTable) {
+    this.idTable = idTable;
+  }
+
+  // region set
+  @Override
+  public void setLastTimeAll(long timePartitionId, Map<String, Long> lastTimeMap) {
+    for (Map.Entry<String, Long> entry : lastTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putLastTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setLastTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putLastTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setFlushedTimeAll(long timePartitionId, Map<String, Long> flushedTimeMap) {
+    for (Map.Entry<String, Long> entry : flushedTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putFlushTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setFlushedTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putFlushTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setGlobalFlushedTimeAll(Map<String, Long> globalFlushedTimeMap) {

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.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] qiaojialin merged pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
qiaojialin merged pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776


   


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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] SilverNarcissus commented on a change in pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
SilverNarcissus commented on a change in pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#discussion_r785268201



##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/IDTableFlushTimeManager.java
##########
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.engine.storagegroup;
+
+import org.apache.iotdb.db.metadata.idtable.IDTable;
+import org.apache.iotdb.db.metadata.idtable.entry.DeviceEntry;
+
+import java.util.Map;
+
+/**
+ * This class manages last time and flush time for sequence and unsequence determination This class
+ * This class is NOT thread safe, caller should ensure synchronization This class not support
+ * upgrade
+ */
+public class IDTableFlushTimeManager implements ILastFlushTimeManager {
+  IDTable idTable;
+
+  public IDTableFlushTimeManager(IDTable idTable) {
+    this.idTable = idTable;
+  }
+
+  // region set
+  @Override
+  public void setLastTimeAll(long timePartitionId, Map<String, Long> lastTimeMap) {
+    for (Map.Entry<String, Long> entry : lastTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putLastTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setLastTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putLastTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setFlushedTimeAll(long timePartitionId, Map<String, Long> flushedTimeMap) {
+    for (Map.Entry<String, Long> entry : flushedTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putFlushTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setFlushedTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putFlushTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setGlobalFlushedTimeAll(Map<String, Long> globalFlushedTimeMap) {
+    for (Map.Entry<String, Long> entry : globalFlushedTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).setGlobalFlushTime(entry.getValue());
+    }
+  }
+
+  @Override
+  public void setGlobalFlushedTime(String path, long time) {
+    idTable.getDeviceEntry(path).setGlobalFlushTime(time);
+  }
+
+  // endregion
+
+  // region update

Review comment:
       This is to support structure view in idea

##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/IDTableFlushTimeManager.java
##########
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.engine.storagegroup;
+
+import org.apache.iotdb.db.metadata.idtable.IDTable;
+import org.apache.iotdb.db.metadata.idtable.entry.DeviceEntry;
+
+import java.util.Map;
+
+/**
+ * This class manages last time and flush time for sequence and unsequence determination This class
+ * This class is NOT thread safe, caller should ensure synchronization This class not support
+ * upgrade
+ */
+public class IDTableFlushTimeManager implements ILastFlushTimeManager {
+  IDTable idTable;
+
+  public IDTableFlushTimeManager(IDTable idTable) {
+    this.idTable = idTable;
+  }
+
+  // region set
+  @Override
+  public void setLastTimeAll(long timePartitionId, Map<String, Long> lastTimeMap) {
+    for (Map.Entry<String, Long> entry : lastTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putLastTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setLastTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putLastTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setFlushedTimeAll(long timePartitionId, Map<String, Long> flushedTimeMap) {
+    for (Map.Entry<String, Long> entry : flushedTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putFlushTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setFlushedTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putFlushTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setGlobalFlushedTimeAll(Map<String, Long> globalFlushedTimeMap) {
+    for (Map.Entry<String, Long> entry : globalFlushedTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).setGlobalFlushTime(entry.getValue());
+    }
+  }
+
+  @Override
+  public void setGlobalFlushedTime(String path, long time) {
+    idTable.getDeviceEntry(path).setGlobalFlushTime(time);
+  }
+
+  // endregion
+
+  // region update
+
+  @Override
+  public void updateLastTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).updateLastTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void updateFlushedTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).updateFlushTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void updateGlobalFlushedTime(String path, long time) {
+    idTable.getDeviceEntry(path).updateGlobalFlushTime(time);
+  }
+
+  @Override
+  public void updateNewlyFlushedPartitionLatestFlushedTimeForEachDevice(
+      long partitionId, String deviceId, long time) {
+    throw new UnsupportedOperationException("IDTableFlushTimeManager doesn't support upgrade");
+  }
+
+  // endregion
+
+  // region ensure

Review comment:
       This is to support structure view in idea




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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] SilverNarcissus commented on a change in pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
SilverNarcissus commented on a change in pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#discussion_r783919617



##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/idtable/entry/DeviceEntry.java
##########
@@ -32,9 +32,18 @@
 
   boolean isAligned;
 
+  // for manages flush time
+  Map<Long, Long> lastTimeMap;
+
+  Map<Long, Long> flushTimeMap;

Review comment:
       There is another class implements ILastFlushTimeManager called LastFlushTimeMananger which uses map to maintain flush time of each device. However, if we enable id table, id table has a map which key is device ID and value is device entry. So there is no need to hold another map keyed by device. We can manage our flush time in that device entry. So I let DeviceEntry hold these 2 flush time maps. To sum up, this implementation can save memory by using id table's map rather than an redundant device map.




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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] SilverNarcissus commented on a change in pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
SilverNarcissus commented on a change in pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#discussion_r785809703



##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/idtable/entry/DeviceEntry.java
##########
@@ -32,9 +32,18 @@
 
   boolean isAligned;
 
+  // for manages flush time
+  Map<Long, Long> lastTimeMap;
+
+  Map<Long, Long> flushTimeMap;

Review comment:
       fixed~

##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/IDTableFlushTimeManager.java
##########
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.engine.storagegroup;
+
+import org.apache.iotdb.db.metadata.idtable.IDTable;
+import org.apache.iotdb.db.metadata.idtable.entry.DeviceEntry;
+
+import java.util.Map;
+
+/**
+ * This class manages last time and flush time for sequence and unsequence determination This class
+ * This class is NOT thread safe, caller should ensure synchronization This class not support
+ * upgrade
+ */
+public class IDTableFlushTimeManager implements ILastFlushTimeManager {
+  IDTable idTable;
+
+  public IDTableFlushTimeManager(IDTable idTable) {
+    this.idTable = idTable;
+  }
+
+  // region set
+  @Override
+  public void setLastTimeAll(long timePartitionId, Map<String, Long> lastTimeMap) {
+    for (Map.Entry<String, Long> entry : lastTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putLastTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setLastTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putLastTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setFlushedTimeAll(long timePartitionId, Map<String, Long> flushedTimeMap) {
+    for (Map.Entry<String, Long> entry : flushedTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putFlushTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setFlushedTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putFlushTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setGlobalFlushedTimeAll(Map<String, Long> globalFlushedTimeMap) {
+    for (Map.Entry<String, Long> entry : globalFlushedTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).setGlobalFlushTime(entry.getValue());
+    }
+  }
+
+  @Override
+  public void setGlobalFlushedTime(String path, long time) {

Review comment:
       fixed~

##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/IDTableFlushTimeManager.java
##########
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.engine.storagegroup;
+
+import org.apache.iotdb.db.metadata.idtable.IDTable;
+import org.apache.iotdb.db.metadata.idtable.entry.DeviceEntry;
+
+import java.util.Map;
+
+/**
+ * This class manages last time and flush time for sequence and unsequence determination This class
+ * This class is NOT thread safe, caller should ensure synchronization This class not support
+ * upgrade
+ */
+public class IDTableFlushTimeManager implements ILastFlushTimeManager {
+  IDTable idTable;
+
+  public IDTableFlushTimeManager(IDTable idTable) {
+    this.idTable = idTable;
+  }
+
+  // region set
+  @Override
+  public void setLastTimeAll(long timePartitionId, Map<String, Long> lastTimeMap) {
+    for (Map.Entry<String, Long> entry : lastTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putLastTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setLastTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putLastTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setFlushedTimeAll(long timePartitionId, Map<String, Long> flushedTimeMap) {
+    for (Map.Entry<String, Long> entry : flushedTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putFlushTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setFlushedTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putFlushTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setGlobalFlushedTimeAll(Map<String, Long> globalFlushedTimeMap) {

Review comment:
       fixed~

##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/IDTableFlushTimeManager.java
##########
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.engine.storagegroup;
+
+import org.apache.iotdb.db.metadata.idtable.IDTable;
+import org.apache.iotdb.db.metadata.idtable.entry.DeviceEntry;
+
+import java.util.Map;
+
+/**
+ * This class manages last time and flush time for sequence and unsequence determination This class
+ * This class is NOT thread safe, caller should ensure synchronization This class not support
+ * upgrade
+ */
+public class IDTableFlushTimeManager implements ILastFlushTimeManager {
+  IDTable idTable;
+
+  public IDTableFlushTimeManager(IDTable idTable) {
+    this.idTable = idTable;
+  }
+
+  // region set
+  @Override
+  public void setLastTimeAll(long timePartitionId, Map<String, Long> lastTimeMap) {
+    for (Map.Entry<String, Long> entry : lastTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putLastTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setLastTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putLastTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setFlushedTimeAll(long timePartitionId, Map<String, Long> flushedTimeMap) {
+    for (Map.Entry<String, Long> entry : flushedTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putFlushTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setFlushedTime(long timePartitionId, String path, long time) {

Review comment:
       fixed~

##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/IDTableFlushTimeManager.java
##########
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.engine.storagegroup;
+
+import org.apache.iotdb.db.metadata.idtable.IDTable;
+import org.apache.iotdb.db.metadata.idtable.entry.DeviceEntry;
+
+import java.util.Map;
+
+/**
+ * This class manages last time and flush time for sequence and unsequence determination This class
+ * This class is NOT thread safe, caller should ensure synchronization This class not support
+ * upgrade
+ */
+public class IDTableFlushTimeManager implements ILastFlushTimeManager {
+  IDTable idTable;
+
+  public IDTableFlushTimeManager(IDTable idTable) {
+    this.idTable = idTable;
+  }
+
+  // region set
+  @Override
+  public void setLastTimeAll(long timePartitionId, Map<String, Long> lastTimeMap) {
+    for (Map.Entry<String, Long> entry : lastTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putLastTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setLastTime(long timePartitionId, String path, long time) {
+    idTable.getDeviceEntry(path).putLastTimeMap(timePartitionId, time);
+  }
+
+  @Override
+  public void setFlushedTimeAll(long timePartitionId, Map<String, Long> flushedTimeMap) {

Review comment:
       fixed~

##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/IDTableFlushTimeManager.java
##########
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.engine.storagegroup;
+
+import org.apache.iotdb.db.metadata.idtable.IDTable;
+import org.apache.iotdb.db.metadata.idtable.entry.DeviceEntry;
+
+import java.util.Map;
+
+/**
+ * This class manages last time and flush time for sequence and unsequence determination This class
+ * This class is NOT thread safe, caller should ensure synchronization This class not support
+ * upgrade
+ */
+public class IDTableFlushTimeManager implements ILastFlushTimeManager {
+  IDTable idTable;
+
+  public IDTableFlushTimeManager(IDTable idTable) {
+    this.idTable = idTable;
+  }
+
+  // region set
+  @Override
+  public void setLastTimeAll(long timePartitionId, Map<String, Long> lastTimeMap) {
+    for (Map.Entry<String, Long> entry : lastTimeMap.entrySet()) {
+      idTable.getDeviceEntry(entry.getKey()).putLastTimeMap(timePartitionId, entry.getValue());
+    }
+  }
+
+  @Override
+  public void setLastTime(long timePartitionId, String path, long time) {

Review comment:
       fixed~

##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/IDTableFlushTimeManager.java
##########
@@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.engine.storagegroup;
+
+import org.apache.iotdb.db.metadata.idtable.IDTable;
+import org.apache.iotdb.db.metadata.idtable.entry.DeviceEntry;
+
+import java.util.Map;
+
+/**
+ * This class manages last time and flush time for sequence and unsequence determination This class
+ * This class is NOT thread safe, caller should ensure synchronization This class not support
+ * upgrade
+ */
+public class IDTableFlushTimeManager implements ILastFlushTimeManager {
+  IDTable idTable;
+
+  public IDTableFlushTimeManager(IDTable idTable) {
+    this.idTable = idTable;
+  }
+
+  // region set
+  @Override
+  public void setLastTimeAll(long timePartitionId, Map<String, Long> lastTimeMap) {

Review comment:
       fixed~

##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/idtable/entry/DeviceEntry.java
##########
@@ -32,9 +32,18 @@
 
   boolean isAligned;
 
+  // for manages flush time

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.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] sonarcloud[bot] commented on pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#issuecomment-1012791099


   SonarCloud Quality Gate failed.&nbsp; &nbsp; ![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=CODE_SMELL) [12 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=CODE_SMELL)
   
   [![70.8%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '70.8%')](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=4776&metric=new_coverage&view=list) [70.8% Coverage](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=4776&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=4776&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=4776&metric=new_duplicated_lines_density&view=list)
   
   


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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] sonarcloud[bot] commented on pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#issuecomment-1013631908


   SonarCloud Quality Gate failed.&nbsp; &nbsp; ![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=CODE_SMELL) [10 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=4776&resolved=false&types=CODE_SMELL)
   
   [![70.3%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '70.3%')](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=4776&metric=new_coverage&view=list) [70.3% Coverage](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=4776&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=4776&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=4776&metric=new_duplicated_lines_density&view=list)
   
   


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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] coveralls edited a comment on pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#issuecomment-1011899641


   
   [![Coverage Status](https://coveralls.io/builds/45652618/badge)](https://coveralls.io/builds/45652618)
   
   Coverage increased (+0.02%) to 68.041% when pulling **1c35f779af4d282c607c7075b2fa8b18f552212f on xkf_id_table_flush_time** into **302e9b9153ec1d2c39187151a425ffac9275f6b6 on master**.
   


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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [iotdb] HeimingZ commented on a change in pull request #4776: [IOTDB-2244] Support flush time management by ID table

Posted by GitBox <gi...@apache.org>.
HeimingZ commented on a change in pull request #4776:
URL: https://github.com/apache/iotdb/pull/4776#discussion_r783859393



##########
File path: server/src/main/java/org/apache/iotdb/db/metadata/idtable/entry/DeviceEntry.java
##########
@@ -32,9 +32,18 @@
 
   boolean isAligned;
 
+  // for manages flush time
+  Map<Long, Long> lastTimeMap;
+
+  Map<Long, Long> flushTimeMap;

Review comment:
       Why not put both two maps in IDTableFlushTimeManager, like what LastFlushTimeManager does? I think it's IFlushTimeManager's responsibility to maintain both maps.




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

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org