You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "liangyepianzhou (via GitHub)" <gi...@apache.org> on 2023/06/12 01:45:19 UTC

[GitHub] [pulsar] liangyepianzhou commented on a diff in pull request #19631: [improve][txn] PIP-251: Add snapshot stats in TransactionBufferStats

liangyepianzhou commented on code in PR #19631:
URL: https://github.com/apache/pulsar/pull/19631#discussion_r1226000303


##########
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:
   In my view, this particular call is only retrieving data at the lastSnapshotTimestamps timestamp. If the user has an expected result, they can make multiple admin calls for that purpose.
   



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org