You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "coderzc (via GitHub)" <gi...@apache.org> on 2023/03/05 15:22:15 UTC

[GitHub] [pulsar] coderzc opened a new pull request, #19716: [feat][broker][PIP-195] Add metrics for bucket delayed message tracker

coderzc opened a new pull request, #19716:
URL: https://github.com/apache/pulsar/pull/19716

   PIP: #16763
   
   ### Motivation
   
   Add metrics for bucket delayed message tracker.
   
   ### Modifications
   
   Add metrics for bucket delayed message tracker.
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: <!-- ENTER URL HERE -->
   
   <!--
   After opening this PR, the build in apache/pulsar will fail and instructions will
   be provided for opening a PR in the PR author's forked repository.
   
   apache/pulsar pull requests should be first tested in your own fork since the 
   apache/pulsar CI based on GitHub Actions has constrained resources and quota.
   GitHub Actions provides separate quota for pull requests that are executed in 
   a forked repository.
   
   The tests will be run in the forked repository until all PR review comments have
   been handled, the tests pass and the PR is approved by a reviewer.
   -->
   


-- 
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


[GitHub] [pulsar] michaeljmarshall commented on a diff in pull request #19716: [feat][broker][PIP-195] Add metrics for bucket delayed message tracker

Posted by "michaeljmarshall (via GitHub)" <gi...@apache.org>.
michaeljmarshall commented on code in PR #19716:
URL: https://github.com/apache/pulsar/pull/19716#discussion_r1153994376


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/DelayedDeliveryTracker.java:
##########
@@ -67,12 +67,6 @@ public interface DelayedDeliveryTracker extends AutoCloseable {
      */
     boolean shouldPauseAllDeliveries();
 
-    /**
-     * Tells whether this DelayedDeliveryTracker contains this message index,
-     * if the tracker is not supported it or disabled this feature also will return false.
-     */
-    boolean containsMessage(long ledgerId, long entryId);

Review Comment:
   Thanks for the context!



-- 
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


[GitHub] [pulsar] coderzc commented on a diff in pull request #19716: [feat][broker][PIP-195] Add metrics for bucket delayed message tracker

Posted by "coderzc (via GitHub)" <gi...@apache.org>.
coderzc commented on code in PR #19716:
URL: https://github.com/apache/pulsar/pull/19716#discussion_r1151662444


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BookkeeperBucketSnapshotStorage.java:
##########
@@ -212,8 +208,8 @@ private CompletableFuture<Void> addEntry(LedgerHandle ledgerHandle, byte[] data)
         });
     }
 
-    CompletableFuture<Enumeration<LedgerEntry>> getLedgerEntryThenCloseLedger(LedgerHandle ledger,
-                                                                              long firstEntryId, long lastEntryId) {
+    CompletableFuture<Enumeration<LedgerEntry>> getLedgerEntry(LedgerHandle ledger,

Review Comment:
   Ledger is already closed after `createBucketSnapshot`, so we don't need to close it again.



-- 
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


[GitHub] [pulsar] dao-jun commented on a diff in pull request #19716: [feat][broker][PIP-195] Add metrics for bucket delayed message tracker

Posted by "dao-jun (via GitHub)" <gi...@apache.org>.
dao-jun commented on code in PR #19716:
URL: https://github.com/apache/pulsar/pull/19716#discussion_r1133763465


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/util/StatsBuckets.java:
##########
@@ -73,6 +73,19 @@ public void refresh() {
         this.count = count;
     }
 
+    public void collect() {
+        long count = 0;
+        sum = sumCounter.sum();
+
+        for (int i = 0; i < buckets.length; i++) {
+            long value = buckets[i].sum();
+            count += value;
+            values[i] = value;
+        }
+
+        this.count = count;

Review Comment:
   There seems to be a problem. For Histogram, `count` is the times of add/observe method invoked



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java:
##########
@@ -1117,6 +1117,11 @@ public SubscriptionStatsImpl getStats(Boolean getPreciseBacklog, boolean subscri
         if (dispatcher instanceof PersistentDispatcherMultipleConsumers) {
             subStats.delayedMessageIndexSizeInBytes =
                     ((PersistentDispatcherMultipleConsumers) dispatcher).getDelayedTrackerMemoryUsage();
+
+            subStats.bucketDelayedIndexStats =
+                    ((PersistentDispatcherMultipleConsumers) dispatcher).getBucketDelayedIndexStats();
+
+            System.out.println();

Review Comment:
   Should be removed?



-- 
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


[GitHub] [pulsar] mattisonchao closed pull request #19716: [feat][broker][PIP-195] Add metrics for bucket delayed message tracker

Posted by "mattisonchao (via GitHub)" <gi...@apache.org>.
mattisonchao closed pull request #19716: [feat][broker][PIP-195] Add metrics for bucket delayed message tracker
URL: https://github.com/apache/pulsar/pull/19716


-- 
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


[GitHub] [pulsar] coderzc merged pull request #19716: [feat][broker][PIP-195] Add metrics for bucket delayed message tracker

Posted by "coderzc (via GitHub)" <gi...@apache.org>.
coderzc merged PR #19716:
URL: https://github.com/apache/pulsar/pull/19716


-- 
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


[GitHub] [pulsar] michaeljmarshall commented on a diff in pull request #19716: [feat][broker][PIP-195] Add metrics for bucket delayed message tracker

Posted by "michaeljmarshall (via GitHub)" <gi...@apache.org>.
michaeljmarshall commented on code in PR #19716:
URL: https://github.com/apache/pulsar/pull/19716#discussion_r1153424672


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/DelayedDeliveryTracker.java:
##########
@@ -67,12 +67,6 @@ public interface DelayedDeliveryTracker extends AutoCloseable {
      */
     boolean shouldPauseAllDeliveries();
 
-    /**
-     * Tells whether this DelayedDeliveryTracker contains this message index,
-     * if the tracker is not supported it or disabled this feature also will return false.
-     */
-    boolean containsMessage(long ledgerId, long entryId);

Review Comment:
   Why did we remove this method in this PR?



-- 
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


[GitHub] [pulsar] coderzc commented on a diff in pull request #19716: [feat][broker][PIP-195] Add metrics for bucket delayed message tracker

Posted by "coderzc (via GitHub)" <gi...@apache.org>.
coderzc commented on code in PR #19716:
URL: https://github.com/apache/pulsar/pull/19716#discussion_r1153964922


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/DelayedDeliveryTracker.java:
##########
@@ -67,12 +67,6 @@ public interface DelayedDeliveryTracker extends AutoCloseable {
      */
     boolean shouldPauseAllDeliveries();
 
-    /**
-     * Tells whether this DelayedDeliveryTracker contains this message index,
-     * if the tracker is not supported it or disabled this feature also will return false.
-     */
-    boolean containsMessage(long ledgerId, long entryId);

Review Comment:
   Oh, sorry this addresses a previous comment.
   See: https://github.com/apache/pulsar/pull/17677#pullrequestreview-1178729635



-- 
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