Skip to content

fix: enforce Lite subscription quota - #10896

Open
Aias00 wants to merge 1 commit into
apache:developfrom
Aias00:fix/lite-subscription-quota-enforcement
Open

fix: enforce Lite subscription quota#10896
Aias00 wants to merge 1 commit into
apache:developfrom
Aias00:fix/lite-subscription-quota-enforcement

Conversation

@Aias00

@Aias00 Aias00 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • enforce the Lite subscription limit for partial and complete updates
  • preserve idempotent partial retries at the configured limit
  • reject overflow before mutating the subscription registry

Closes #10894

Tests

  • mvn -pl broker -am -Dtest=LiteSubscriptionRegistryImplTest -DfailIfNoTests=false test (JDK 8)

Copilot AI lite review requested due to automatic review settings August 10, 2026 04:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 48.33%. Comparing base (e345861) to head (d038ce3).

Files with missing lines Patch % Lines
...etmq/broker/lite/LiteSubscriptionRegistryImpl.java 96.29% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #10896      +/-   ##
=============================================
- Coverage      48.41%   48.33%   -0.09%     
+ Complexity     13571    13542      -29     
=============================================
  Files           1380     1380              
  Lines         101165   101179      +14     
  Branches       13127    13130       +3     
=============================================
- Hits           48981    48905      -76     
- Misses         46220    46281      +61     
- Partials        5964     5993      +29     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Summary

This PR fixes the Lite subscription quota enforcement to properly handle partial and complete subscription updates. Key improvements:

  1. Net-change quota calculation — The old code checked getActiveSubscriptionNum() >= maxCount before mutation, blocking even idempotent retries at the limit. The new ensureQuota method calculates the net effect (adds minus removes) before rejecting.
  2. Synchronized methods — Both addPartialSubscription and addCompleteSubscription are now synchronized, preventing race conditions in concurrent subscription updates.
  3. Edge case handling — Properly handles maxLiteSubscriptionCount <= 0 and empty lmqNameSet.
  4. Test coverage — Tests cover batch exceeding quota, complete subscription overflow, and idempotent retry at quota.

Verdict: LGTM — solid fix that correctly addresses the quota enforcement gap while preserving idempotent retry semantics.


Automated review by github-manager-bot

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Summary

Enforces Lite subscription quota for partial and complete updates. Proper overflow rejection before mutation.

LGTM.


Automated review by github-manager-bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Enforce Lite subscription quota for complete and batch updates

4 participants