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

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


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 203680f0acd branch-2.1: [fix](bdb) reset interrupted flag before 
calling bdbje #47874 (#47943)
203680f0acd is described below

commit 203680f0acdcae1c1213ba80b4e5d7df33541824
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Feb 18 13:50:51 2025 +0800

    branch-2.1: [fix](bdb) reset interrupted flag before calling bdbje #47874 
(#47943)
    
    Cherry-picked from #47874
    
    Co-authored-by: Mingyu Chen (Rayner) <morning...@163.com>
---
 .../src/main/java/org/apache/doris/journal/bdbje/BDBEnvironment.java | 5 +++++
 .../src/main/java/org/apache/doris/journal/bdbje/BDBJEJournal.java   | 5 +++++
 2 files changed, 10 insertions(+)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/journal/bdbje/BDBEnvironment.java 
b/fe/fe-core/src/main/java/org/apache/doris/journal/bdbje/BDBEnvironment.java
index 11bea966cd9..b1be42b5b36 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/journal/bdbje/BDBEnvironment.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/journal/bdbje/BDBEnvironment.java
@@ -336,6 +336,11 @@ public class BDBEnvironment {
 
     // get journal db names and sort the names
     public List<Long> getDatabaseNames() {
+        // The operation before may set the current thread as interrupted.
+        // MUST reset the interrupted flag of current thread to false,
+        // otherwise replicatedEnvironment.getDatabaseNames() will fail 
because it will call lock.tryLock(),
+        // which will check the interrupted flag.
+        Thread.interrupted();
         List<Long> ret = new ArrayList<Long>();
         List<String> names = null;
         int tried = 0;
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 2e71826d770..7869930ce4d 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
@@ -224,6 +224,11 @@ public class BDBJEJournal implements Journal { // 
CHECKSTYLE IGNORE THIS LINE: B
 
     @Override
     public synchronized long write(short op, Writable writable) throws 
IOException {
+        // The operation before may set the current thread as interrupted.
+        // MUST reset the interrupted flag of current thread to false,
+        // otherwise edit log writing may fail because it will call 
lock.tryLock(),
+        // which will check the interrupted flag.
+        Thread.interrupted();
         JournalEntity entity = new JournalEntity();
         entity.setOpCode(op);
         entity.setData(writable);


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

Reply via email to