BUAAserein commented on code in PR #11691:
URL: https://github.com/apache/iotdb/pull/11691#discussion_r1422243185
##########
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/logdispatcher/LogDispatcher.java:
##########
@@ -157,6 +159,15 @@ public synchronized OptionalLong getMinFlushedSyncIndex() {
return
threads.stream().mapToLong(LogDispatcherThread::getLastFlushedSyncIndex).min();
}
+ public void checkAndFlushIndex() {
+ threads.forEach(
+ thread -> {
+ IndexController controller = thread.getController();
+ controller.update(controller.getCurrentIndex(), false);
Review Comment:
maybe we can use `controller.update(controller.getCurrentIndex(), true);` to
force update periodically
##########
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/logdispatcher/IndexController.java:
##########
@@ -101,12 +102,15 @@ public long getLastFlushedIndex() {
}
private void checkPersist(boolean forcePersist) {
- if (forcePersist || currentIndex - lastFlushedIndex >= checkpointGap) {
+ if (forcePersist
+ || currentIndex - lastFlushedIndex >= checkpointGap
+ || System.nanoTime() - updateTime >=
IoTConsensus.READER_UPDATE_INTERVAL_IN_NS) {
Review Comment:
in this way, we don't need to do the time check
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]