@@ -76,8 +76,8 @@ public class TopicTransactionBuffer extends TopicTransactionBufferState implemen
76
76
*/
77
77
private final LinkedMap <TxnID , PositionImpl > ongoingTxns = new LinkedMap <>();
78
78
79
- // when add abort or change max read position, the count will +1. Take snapshot will set 0 into it .
80
- private final AtomicLong changeMaxReadPositionAndAddAbortTimes = new AtomicLong ();
79
+ // when change max read position, the count will +1. Take snapshot will reset the count .
80
+ private final AtomicLong changeMaxReadPositionCount = new AtomicLong ();
81
81
82
82
private final LongAdder txnCommittedCounter = new LongAdder ();
83
83
@@ -429,15 +429,15 @@ private void handleLowWaterMark(TxnID txnID, long lowWaterMark) {
429
429
}
430
430
431
431
private void takeSnapshotByChangeTimes () {
432
- if (changeMaxReadPositionAndAddAbortTimes .get () >= takeSnapshotIntervalNumber ) {
433
- this .changeMaxReadPositionAndAddAbortTimes .set (0 );
432
+ if (changeMaxReadPositionCount .get () >= takeSnapshotIntervalNumber ) {
433
+ this .changeMaxReadPositionCount .set (0 );
434
434
this .snapshotAbortedTxnProcessor .takeAbortedTxnsSnapshot (this .maxReadPosition );
435
435
}
436
436
}
437
437
438
438
private void takeSnapshotByTimeout () {
439
- if (changeMaxReadPositionAndAddAbortTimes .get () > 0 ) {
440
- this .changeMaxReadPositionAndAddAbortTimes .set (0 );
439
+ if (changeMaxReadPositionCount .get () > 0 ) {
440
+ this .changeMaxReadPositionCount .set (0 );
441
441
this .snapshotAbortedTxnProcessor .takeAbortedTxnsSnapshot (this .maxReadPosition );
442
442
}
443
443
this .timer .newTimeout (TopicTransactionBuffer .this ,
@@ -454,7 +454,7 @@ void updateMaxReadPosition(TxnID txnID) {
454
454
maxReadPosition = (PositionImpl ) topic .getManagedLedger ().getLastConfirmedEntry ();
455
455
}
456
456
if (preMaxReadPosition .compareTo (this .maxReadPosition ) != 0 ) {
457
- this .changeMaxReadPositionAndAddAbortTimes .getAndIncrement ();
457
+ this .changeMaxReadPositionCount .getAndIncrement ();
458
458
}
459
459
}
460
460
@@ -489,7 +489,7 @@ public void syncMaxReadPositionForNormalPublish(PositionImpl position) {
489
489
} else if (checkIfReady ()) {
490
490
if (ongoingTxns .isEmpty ()) {
491
491
maxReadPosition = position ;
492
- changeMaxReadPositionAndAddAbortTimes .incrementAndGet ();
492
+ changeMaxReadPositionCount .incrementAndGet ();
493
493
}
494
494
}
495
495
}
0 commit comments