You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by ta...@apache.org on 2025/04/28 07:34:59 UTC

(ratis) 01/04: RATIS-2240. updatePurgeIndex doesn't need to hold RaftLogBase.writeLock (#1214)

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

tanxinyu pushed a commit to branch snapshot-3
in repository https://gitbox.apache.org/repos/asf/ratis.git

commit 6708ab940628d5b7e7df9573b7c4732d80f432fc
Author: William Song <48...@users.noreply.github.com>
AuthorDate: Thu Jan 23 00:38:00 2025 +0800

    RATIS-2240. updatePurgeIndex doesn't need to hold RaftLogBase.writeLock (#1214)
---
 .../src/main/java/org/apache/ratis/server/raftlog/RaftLogBase.java  | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/ratis-server/src/main/java/org/apache/ratis/server/raftlog/RaftLogBase.java b/ratis-server/src/main/java/org/apache/ratis/server/raftlog/RaftLogBase.java
index b37d40c28..710dede48 100644
--- a/ratis-server/src/main/java/org/apache/ratis/server/raftlog/RaftLogBase.java
+++ b/ratis-server/src/main/java/org/apache/ratis/server/raftlog/RaftLogBase.java
@@ -141,10 +141,8 @@ public abstract class RaftLogBase implements RaftLog {
   }
 
   protected void updatePurgeIndex(Long purged) {
-    try (AutoCloseableLock writeLock = writeLock()) {
-      if (purged != null) {
-        purgeIndex.updateToMax(purged, infoIndexChange);
-      }
+    if (purged != null) {
+      purgeIndex.updateToMax(purged, infoIndexChange);
     }
   }