3434 */
3535final class SoftDeletesPolicy {
3636 private final LongSupplier globalCheckpointSupplier ;
37- private int retentionNumLocks = 0 ;
37+ private int retentionLockCount ;
3838 private long checkpointOfSafeCommit ;
3939 private volatile long minRequiredSeqNoForRecovery ;
4040 private volatile long retentionOperations ;
@@ -44,6 +44,7 @@ final class SoftDeletesPolicy {
4444 this .retentionOperations = retentionOperations ;
4545 this .checkpointOfSafeCommit = SequenceNumbers .NO_OPS_PERFORMED ;
4646 this .minRequiredSeqNoForRecovery = checkpointOfSafeCommit + 1 ;
47+ this .retentionLockCount = 0 ;
4748 }
4849
4950 /**
@@ -69,7 +70,7 @@ synchronized void setCheckpointOfSafeCommit(long newCheckpoint) {
6970
7071 private void updateMinRequiredSeqNoForRecovery () {
7172 assert Thread .holdsLock (this ) : Thread .currentThread ().getName ();
72- if (retentionNumLocks == 0 ) {
73+ if (retentionLockCount == 0 ) {
7374 // Need to keep all operations after the local checkpoint of the safe commit for recovery purpose.
7475 this .minRequiredSeqNoForRecovery = checkpointOfSafeCommit + 1 ;
7576 }
@@ -81,8 +82,8 @@ private void updateMinRequiredSeqNoForRecovery() {
8182 * This is a analogy to the translog's retention lock; see {@link Translog#acquireRetentionLock()}
8283 */
8384 synchronized Releasable acquireRetentionLock () {
84- retentionNumLocks ++;
85- assert retentionNumLocks > 0 : "Invalid number of retention locks [" + retentionNumLocks + "]" ;
85+ retentionLockCount ++;
86+ assert retentionLockCount > 0 : "Invalid number of retention locks [" + retentionLockCount + "]" ;
8687 final AtomicBoolean released = new AtomicBoolean ();
8788 return () -> {
8889 if (released .compareAndSet (false , true )) {
@@ -92,8 +93,8 @@ synchronized Releasable acquireRetentionLock() {
9293 }
9394
9495 private synchronized void releaseRetentionLock () {
95- retentionNumLocks --;
96- assert retentionNumLocks >= 0 : "Invalid number of retention locks [" + retentionNumLocks + "]" ;
96+ retentionLockCount --;
97+ assert retentionLockCount >= 0 : "Invalid number of retention locks [" + retentionLockCount + "]" ;
9798 updateMinRequiredSeqNoForRecovery ();
9899 }
99100
0 commit comments