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

yiguolei pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new d23a1171d7d [fix](journal) Fix infinite block due to initial BDB 
journal failed (#29205) (#29310)
d23a1171d7d is described below

commit d23a1171d7d53d67a90d9182b3b03a1f725ba6b8
Author: walter <[email protected]>
AuthorDate: Fri Dec 29 19:17:42 2023 +0800

    [fix](journal) Fix infinite block due to initial BDB journal failed 
(#29205) (#29310)
    
    Opening a BDBJournal will acquire the max journal id, but it doesn't
    need to check whether the replica txn is matched with the master.
---
 .../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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to