BewareMyPower commented on code in PR #24945:
URL: https://github.com/apache/pulsar/pull/24945#discussion_r2508540457


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java:
##########
@@ -108,6 +106,9 @@ public class TopicTransactionBuffer extends 
TopicTransactionBufferState implemen
 
     private final AbortedTxnProcessor.SnapshotType snapshotType;
     private final MaxReadPositionCallBack maxReadPositionCallBack;
+    private volatile CompletableFuture<Void> firstSnapshottingFuture = new 
CompletableFuture<>();
+    /** if the first snapshot is in progress, it will pending following 
publishing tasks. **/
+    private final LinkedList<PendingAppendingTxnBufferTask> 
pendingAppendingTxnBufferTasks = new LinkedList<>();

Review Comment:
   No need to use `LinkedList` here. The `offer` method can be replaced by 
`add`. The `poll` method call is always used to iterate over the whole list 
within the synchronized block, so it can be replaced by the composite calls of 
`forEach` and `clear`.
   
   This list is only used for `add` and `forEach + clear`, `ArrayList` should 
be better.



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java:
##########
@@ -108,6 +106,9 @@ public class TopicTransactionBuffer extends 
TopicTransactionBufferState implemen
 
     private final AbortedTxnProcessor.SnapshotType snapshotType;
     private final MaxReadPositionCallBack maxReadPositionCallBack;
+    private volatile CompletableFuture<Void> firstSnapshottingFuture = new 
CompletableFuture<>();

Review Comment:
   This field is never used.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to