-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[improve][broker]Increase the number of delayed messages sent whose delay time exceeds the TTL statistical metric #25010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Denovo1998
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments.
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
Outdated
Show resolved
Hide resolved
|
@Denovo1998 Hello, could you please help me review again |
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
Outdated
Show resolved
Hide resolved
|
@Denovo1998 Hello, could you please help me review again |
| if (deliverAtTime >= (messageTTLInSeconds * 1000L) + System.currentTimeMillis()) { | ||
| this.incrementExceedTTLDelayedMessages(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no guarantee that messageTTLInSeconds > 0.
I suggest wrapping the counting logic in
if (messageTTLInSeconds != null && messageTTLInSeconds > 0)| @Getter | ||
| private final PersistentTopicMetrics persistentTopicMetrics = new PersistentTopicMetrics(); | ||
|
|
||
| private final Rate exceedTTLDelayedMessage = new Rate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exceedTTLDelayedMessage doesn't read well. It seems that ttlExceededDelayedMessagesRate would be more accurate for this field.
In addition, it would be necessary to add a comment to this field to explain it.
| /** The number of delay messages that exceed TTL delay. */ | ||
| public long exceedTTLDelayedMessages; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similar comment about exceedTTLDelayedMessages as in the previous comment. It doesn't read well. I think that ttlExceededDelayedMessages would be better. In the comment, it should be made explicit that this is the number of delayed messsages that exceeded TTL at publish time.
lhotari
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check the review comments.
In addition, please revisit the PR title. It's currently [improve][broker]Increase the number of delayed messages sent whose delay time exceeds the TTL statistical metric which is not very clear. Something like [improve][broker] Add counter to topic stats for delayed messages which exceed TTL at publish time would be more accurate.
Motivation
Currently, Pulsar Broker lacks a metric to track instances where delayed messages exceed their TTL. This results in messages set with delayed delivery times exceeding the TTL expiring before being consumed by users, with no mechanism to detect this occurrence. Consequently, there is a significant risk of message loss.
Modifications
Documentation
docdoc-requireddoc-not-neededdoc-complete