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

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 66a7d11b532 [fix](fe) modify tablet cooldownConfLock to reduce memory 
(#59356)
66a7d11b532 is described below

commit 66a7d11b5325657b01f04d7c4eda3effbd370ff0
Author: meiyi <[email protected]>
AuthorDate: Sat Dec 27 01:59:36 2025 +0800

    [fix](fe) modify tablet cooldownConfLock to reduce memory (#59356)
    
    ### What problem does this PR solve?
    
    the usage of `cooldownConfLock` is simple, does not need
    ReentrantReadWriteLock because it cost too much memory, especially when
    a cluster has many tablets.
    
    before:
    <img width="1280" height="575" alt="1"
    
src="https://github.com/user-attachments/assets/df626e1e-84ef-4078-8da7-d857ac960678";
    />
    
    after:
    <img width="1280" height="510" alt="2"
    
src="https://github.com/user-attachments/assets/3fee7407-0743-4d07-9462-a9f0e101765f";
    />
---
 .../src/main/java/org/apache/doris/catalog/Tablet.java   | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Tablet.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Tablet.java
index 379cc0a17da..0a07ffe82d3 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Tablet.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Tablet.java
@@ -25,7 +25,6 @@ import org.apache.doris.common.Config;
 import org.apache.doris.common.FeConstants;
 import org.apache.doris.common.Pair;
 import org.apache.doris.common.UserException;
-import org.apache.doris.common.lock.MonitoredReentrantReadWriteLock;
 import org.apache.doris.resource.Tag;
 import org.apache.doris.system.Backend;
 import org.apache.doris.system.SystemInfoService;
@@ -123,7 +122,7 @@ public class Tablet extends MetaObject {
     private long cooldownReplicaId = -1;
     @SerializedName(value = "ctm", alternate = {"cooldownTerm"})
     private long cooldownTerm = -1;
-    private MonitoredReentrantReadWriteLock cooldownConfLock = new 
MonitoredReentrantReadWriteLock();
+    private final Object cooldownConfLock = new Object();
 
     // last time that the tablet checker checks this tablet.
     // no need to persist
@@ -184,10 +183,10 @@ public class Tablet extends MetaObject {
     }
 
     public void setCooldownConf(long cooldownReplicaId, long cooldownTerm) {
-        cooldownConfLock.writeLock().lock();
-        this.cooldownReplicaId = cooldownReplicaId;
-        this.cooldownTerm = cooldownTerm;
-        cooldownConfLock.writeLock().unlock();
+        synchronized (cooldownConfLock) {
+            this.cooldownReplicaId = cooldownReplicaId;
+            this.cooldownTerm = cooldownTerm;
+        }
     }
 
     public long getCooldownReplicaId() {
@@ -195,11 +194,8 @@ public class Tablet extends MetaObject {
     }
 
     public Pair<Long, Long> getCooldownConf() {
-        cooldownConfLock.readLock().lock();
-        try {
+        synchronized (cooldownConfLock) {
             return Pair.of(cooldownReplicaId, cooldownTerm);
-        } finally {
-            cooldownConfLock.readLock().unlock();
         }
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to