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

kxiao pushed a commit to branch revert-29373-revert-29310-cherry-pick/29205
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 11a86b895811073e6855799398f2cb12d35d6148
Author: Kang <kxiao.ti...@gmail.com>
AuthorDate: Tue Jan 2 15:34:35 2024 +0800

    Revert "Revert "[fix](journal) Fix infinite block due to initial BDB 
journal failed (#29205) (#29310)" (#29373)"
    
    This reverts commit b9c5b13ce37e86bed60c87ed3c5bc465f99d4de5.
---
 .../java/org/apache/doris/journal/bdbje/BDBJEJournal.java   | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/journal/bdbje/BDBJEJournal.java 
b/fe/fe-core/src/main/java/org/apache/doris/journal/bdbje/BDBJEJournal.java
index d805bf1d5a4..cd0d54c6420 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/journal/bdbje/BDBJEJournal.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/journal/bdbje/BDBJEJournal.java
@@ -276,6 +276,15 @@ public class BDBJEJournal implements Journal { // 
CHECKSTYLE IGNORE THIS LINE: B
 
     @Override
     public long getMaxJournalId() {
+        return getMaxJournalIdInternal(true);
+    }
+
+    // get max journal id but do not check whether the txn is matched.
+    private long getMaxJournalIdWithoutCheck() {
+        return getMaxJournalIdInternal(false);
+    }
+
+    private long getMaxJournalIdInternal(boolean checkTxnMatched) {
         long ret = -1;
         if (bdbEnvironment == null) {
             return ret;
@@ -292,7 +301,7 @@ public class BDBJEJournal implements Journal { // 
CHECKSTYLE IGNORE THIS LINE: B
         String dbName = dbNames.get(index).toString();
         long dbNumberName = dbNames.get(index);
         Database database = bdbEnvironment.openDatabase(dbName);
-        if (!isReplicaTxnAreMatched(database, dbNumberName)) {
+        if (checkTxnMatched && !isReplicaTxnAreMatched(database, 
dbNumberName)) {
             LOG.warn("The current replica hasn't synced up with the master, 
current db name: {}", dbNumberName);
             if (index != 0) {
                 // Because roll journal occurs after write, the previous write 
must have
@@ -423,7 +432,7 @@ public class BDBJEJournal implements Journal { // 
CHECKSTYLE IGNORE THIS LINE: B
                 }
 
                 // set next journal id
-                nextJournalId.set(getMaxJournalId() + 1);
+                nextJournalId.set(getMaxJournalIdWithoutCheck() + 1);
 
                 break;
             } catch (InsufficientLogException insufficientLogEx) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to