fix: enforce Lite subscription quota - #10896
Conversation
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
This PR fixes the Lite subscription quota enforcement to properly handle partial and complete subscription updates. Key improvements:
- Net-change quota calculation — The old code checked
getActiveSubscriptionNum() >= maxCountbefore mutation, blocking even idempotent retries at the limit. The newensureQuotamethod calculates the net effect (adds minus removes) before rejecting. - Synchronized methods — Both
addPartialSubscriptionandaddCompleteSubscriptionare nowsynchronized, preventing race conditions in concurrent subscription updates. - Edge case handling — Properly handles
maxLiteSubscriptionCount <= 0and emptylmqNameSet. - 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
left a comment
There was a problem hiding this comment.
Summary
Enforces Lite subscription quota for partial and complete updates. Proper overflow rejection before mutation.
LGTM.
Automated review by github-manager-bot
Summary
Closes #10894
Tests
mvn -pl broker -am -Dtest=LiteSubscriptionRegistryImplTest -DfailIfNoTests=false test(JDK 8)