You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ta...@apache.org on 2023/11/10 07:55:53 UTC

(iotdb) branch check_iot_consensus_searchIndex updated (ed34ab8826e -> 152f54b1e31)

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

tanxinyu pushed a change to branch check_iot_consensus_searchIndex
in repository https://gitbox.apache.org/repos/asf/iotdb.git


 discard ed34ab8826e fix
     new 152f54b1e31 fix

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (ed34ab8826e)
            \
             N -- N -- N   refs/heads/check_iot_consensus_searchIndex (152f54b1e31)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java | 1 -
 1 file changed, 1 deletion(-)


(iotdb) 01/01: fix

Posted by ta...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 152f54b1e3103cfe83c8ce0cb2de1e2b3c094cd1
Author: OneSizeFitQuorum <ta...@apache.org>
AuthorDate: Fri Nov 10 15:48:33 2023 +0800

    fix
    
    Signed-off-by: OneSizeFitQuorum <ta...@apache.org>
---
 .../iotdb/consensus/iot/IoTConsensusServerImpl.java | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java
index 66b7ccd976a..1f8b50ee2bb 100644
--- a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java
+++ b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java
@@ -148,6 +148,8 @@ public class IoTConsensusServerImpl {
     // This prevents wal from being piled up if the safelyDeletedSearchIndex is not updated after
     // the restart and Leader migration occurs
     checkAndUpdateSafeDeletedSearchIndex();
+    // see message in logs for details
+    checkAndUpdateSearchIndex();
   }
 
   public IStateMachine getStateMachine() {
@@ -803,6 +805,25 @@ public class IoTConsensusServerImpl {
     }
   }
 
+  public void checkAndUpdateSearchIndex() {
+    long currentSearchIndex = searchIndex.get();
+    long safelyDeletedSearchIndex = getCurrentSafelyDeletedSearchIndex();
+    if (currentSearchIndex < safelyDeletedSearchIndex) {
+      logger.warn(
+          "The searchIndex for this region({}) is smaller than the safelyDeletedSearchIndex when "
+              + "the node is restarted, which means that the data of the current region is not flushed "
+              + "by the wal, but has been synchronized to other nodes. At this point, "
+              + "different replicas have been inconsistent and cannot be automatically recovered. "
+              + "To prevent subsequent logs from marking smaller searchIndex and exacerbating the "
+              + "inconsistency, we manually set the searchIndex({}) to safelyDeletedSearchIndex({}) "
+              + "here to reduce the impact of this problem in the future",
+          consensusGroupId,
+          currentSearchIndex,
+          safelyDeletedSearchIndex);
+      searchIndex.set(safelyDeletedSearchIndex);
+    }
+  }
+
   public TSStatus syncLog(int sourcePeerId, IConsensusRequest request) {
     return cacheQueueMap
         .computeIfAbsent(sourcePeerId, SyncLogCacheQueue::new)