poorbarcode commented on code in PR #19631:
URL: https://github.com/apache/pulsar/pull/19631#discussion_r1119561849
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/AbortedTxnProcessor.java:
##########
@@ -65,10 +66,9 @@ public interface AbortedTxnProcessor {
CompletableFuture<Void> takeAbortedTxnsSnapshot(PositionImpl
maxReadPosition);
/**
- * Get the lastSnapshotTimestamps.
- * @return the lastSnapshotTimestamps.
+ * Get the snapshot stats form the processor.
*/
- long getLastSnapshotTimestamps();
+ void getSnapshotStats(TransactionBufferStats stats);
Review Comment:
The implementation of this method is to set the property of stat. Why does
it named `getxxx`?
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/SnapshotSegmentAbortedTxnProcessorImpl.java:
##########
@@ -384,8 +385,12 @@ public CompletableFuture<Void> clearAbortedTxnSnapshot() {
}
@Override
- public long getLastSnapshotTimestamps() {
- return this.lastSnapshotTimestamps;
+ public void getSnapshotStats(TransactionBufferStats stats) {
+ stats.lastSnapshotTimestamps = this.lastSnapshotTimestamps;
+ TransactionBufferStats.SnapshotStats snapshotStats = new
TransactionBufferStats.SnapshotStats();
+ snapshotStats.segmentsSize = this.indexes.size();
+ snapshotStats.unsealedAbortTxnIDs = this.unsealedTxnIds.size();
+ stats.snapshotStats = snapshotStats;
Review Comment:
If there has an in flight task which is typed `write segment`, there is an
issue:
- the variable `unsealedAbortTxnIDs` will be zero
- the variable `segmentsSize` is one less than the correct value
--
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]