You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2022/08/09 07:09:46 UTC

[iotdb] branch ml_0808_test_exp1_parallel updated: previous fix is not correct I think, let's use this one

This is an automated email from the ASF dual-hosted git repository.

xingtanzjr pushed a commit to branch ml_0808_test_exp1_parallel
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/ml_0808_test_exp1_parallel by this push:
     new 6d3a295aeb previous fix is not correct I think, let's use this one
6d3a295aeb is described below

commit 6d3a295aebf7510afd821b45f46c1457a27e731c
Author: Jinrui.Zhang <xi...@gmail.com>
AuthorDate: Tue Aug 9 15:09:29 2022 +0800

    previous fix is not correct I think, let's use this one
---
 .../db/consensus/statemachine/DataRegionStateMachine.java      | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/consensus/statemachine/DataRegionStateMachine.java b/server/src/main/java/org/apache/iotdb/db/consensus/statemachine/DataRegionStateMachine.java
index f6f1628d2d..259d88b9fb 100644
--- a/server/src/main/java/org/apache/iotdb/db/consensus/statemachine/DataRegionStateMachine.java
+++ b/server/src/main/java/org/apache/iotdb/db/consensus/statemachine/DataRegionStateMachine.java
@@ -155,6 +155,10 @@ public class DataRegionStateMachine extends BaseStateMachine {
           boolean timeout =
               !queueSortCondition.await(CACHE_WINDOW_TIME_IN_MS, TimeUnit.MILLISECONDS);
           if (timeout) {
+            // although the timeout is triggered, current thread cannot write its request
+            // if current thread does not hold the peek request. And there should be some
+            // other thread who hold the peek request. In this scenario, current thread
+            // should go into await again and wait until its request becoming peek request
             if (requestCache.peek().getStartSyncIndex() == insertNodeWrapper.getStartSyncIndex()) {
               // current thread hold the peek request thus it can write the peek immediately.
               logger.info(
@@ -163,12 +167,6 @@ public class DataRegionStateMachine extends BaseStateMachine {
                   nextSyncIndex);
               requestCache.remove(insertNodeWrapper);
               break;
-            } else {
-              // although the timeout is triggered, current thread cannot write its request
-              // because there should be some other thread who hold the peek request.
-              // And current thread should signal all the other threads to let the thread
-              // who holds the peed request to execute write operation.
-              queueSortCondition.signalAll();
             }
           }
         } catch (InterruptedException e) {