Skip to content

Conversation

@shibd
Copy link
Member

@shibd shibd commented Jun 14, 2024

Motivation

The #21816 introduces the pulsar_storage_backlog_age_seconds metrics, and refactors logic for checkTimeBacklogExceeded. It has two problems:

  1. Even if the consumers under the topic have consumed all the data, pulsar_storage_backlog_age_seconds will not become 0 and will continue to increase over time. This is because its calculation: current time - publish time of the last message.
  2. If the user has configured BacklogQuota.message_age, it will also affect the ability of producers to continue sending messages, even if there is currently no backlog under this topic.

Modifications

  1. In PersistentTopic.checkTimeBacklogExceeded method, if the topic has no backlog, it should return false directly.
  2. In PersistentTopic.asyncGetStats method, if the topic has no backlog, it should be set oldestBacklogMessageAgeSeconds = 0

Verifying this change

  • Add backlogsStatsPreciseWithNoBacklog unit test to cover this case with configuration: preciseTimeBasedBacklogQuotaCheck=true, exposePreciseBacklogInPrometheus=true
  • Add backlogsStatsNotPreciseWithNoBacklog unit test to cover this case with configuration: preciseTimeBasedBacklogQuotaCheck=false, exposePreciseBacklogInPrometheus=false

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

@shibd shibd added type/bug The PR fixed a bug or issue reported a bug ready-to-test labels Jun 14, 2024
@shibd shibd self-assigned this Jun 14, 2024
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jun 14, 2024
@shibd shibd added this to the 3.4.0 milestone Jun 14, 2024
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lhotari
Copy link
Member

lhotari commented Jun 14, 2024

Good work @shibd

@lhotari lhotari changed the title [fix][monitor] Fix topic status for oldestBacklogMessageAgeSeconds continuously increases even when there is no backlog. [fix][broker] Fix topic status for oldestBacklogMessageAgeSeconds continuously increases even when there is no backlog. Jun 14, 2024
@lhotari lhotari merged commit 6831231 into apache:master Jun 14, 2024
shibd added a commit that referenced this pull request Jun 16, 2024
…tinuously increases even when there is no backlog. (#22907)

(cherry picked from commit 6831231)
shibd added a commit that referenced this pull request Jun 16, 2024
…tinuously increases even when there is no backlog. (#22907)

(cherry picked from commit 6831231)
nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 21, 2024
…tinuously increases even when there is no backlog. (apache#22907)

(cherry picked from commit 6831231)
(cherry picked from commit 73b50e5)
nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 25, 2024
…tinuously increases even when there is no backlog. (apache#22907)

(cherry picked from commit 6831231)
(cherry picked from commit 73b50e5)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Jul 1, 2024
…tinuously increases even when there is no backlog. (apache#22907)

(cherry picked from commit 6831231)
(cherry picked from commit 73b50e5)
hanmz pushed a commit to hanmz/pulsar that referenced this pull request Feb 12, 2025
…tinuously increases even when there is no backlog. (apache#22907)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants