[ISSUE #10541] Avoid refreshing gRPC subscription versions#10542
[ISSUE #10541] Avoid refreshing gRPC subscription versions#10542qianye1001 wants to merge 1 commit into
Conversation
90ac2e8 to
631797a
Compare
631797a to
5f492fd
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #10542 +/- ##
=============================================
- Coverage 48.26% 48.16% -0.11%
+ Complexity 13436 13409 -27
=============================================
Files 1377 1377
Lines 100840 100853 +13
Branches 13035 13037 +2
=============================================
- Hits 48670 48572 -98
- Misses 46223 46312 +89
- Partials 5947 5969 +22 ☔ 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.
Review by github-manager-bot
Summary
This PR fixes unnecessary subVersion refresh in the proxy gRPC path. When FilterAPI.build() creates SubscriptionData, it always initializes subVersion to the current timestamp. For unchanged subscriptions, this causes downstream heartbeat sync and registration logs to falsely appear as subscription changes. The fix looks up the existing ConsumerGroupInfo and reuses the old subVersion when the subscription content has not actually changed.
Findings
-
[Info]
ClientActivity.java:548-551—reuseSubscriptionVersiontemporarily setssubVersionto the old value for the equality comparison, then restores it if not equal. This is functionally correct but the temporary mutation pattern is slightly fragile. Consider computing equality on the relevant fields (topic, expression type, tags/set) directly instead of relying onequals()after mutatingsubVersion. This would make the intent clearer and avoid any risk ifSubscriptionData.equals()semantics change in the future. -
[Info]
ClientActivity.java:537—getConsumerGroupInfo(ctx, consumerGroup)is called once perbuildSubscriptionDataSetinvocation, which is fine. Just confirming this is a lightweight lookup (map-based) and not a heavy operation. If it ever becomes expensive, the call should be hoisted further up. -
[Info]
ClientActivity.java:533— The method signature ofbuildSubscriptionDataSetchanged from(List<SubscriptionEntry>)to(ProxyContext, String, List<SubscriptionEntry>). Since this is aprotectedmethod, any subclass overriding it will need to update accordingly. A quick search suggests no overrides in the current codebase, but worth confirming.
Positive Notes
- Clean, well-scoped fix that addresses the root cause at the proxy gRPC layer.
- Good test coverage with both "unchanged subscription" and "changed subscription" scenarios in
ClientActivityTest. - Proper null-safety in
reuseSubscriptionVersion— handles nullconsumerGroupInfoand nulloldSubscriptionDatagracefully. - The approach of comparing with the old version and only keeping the new one when content actually changed is the right strategy.
Suggestions
- Consider adding a brief Javadoc on
reuseSubscriptionVersionexplaining the contract (mutatessubVersionto old value, restores if subscription content differs).
Automated review by github-manager-bot
RockteMQ-AI
left a comment
There was a problem hiding this comment.
LGTM — CI passed, ready for merge.
Automated by github-manager-bot
Summary
subVersionwhen gRPC Settings rebuild the same topic/filter subscription.subVersionwhen the gRPC subscription content actually changes.ClientActivityTestcoverage for unchanged and changed gRPC subscriptions.Motivation
The issue is triggered from the proxy gRPC registration/heartbeat path.
ClientActivityrebuildsSubscriptionDatafrom Settings, andFilterAPI.build()initializessubVersionfrom the current time. For unchanged subscriptions, that new timestamp is propagated through proxy heartbeat sync and makes downstream registration logs look like a real subscription change.This keeps the fix scoped to the proxy path by stabilizing the generated gRPC subscription version before registration/sync.
Closes #10541
Tests
mvn -pl proxy -am -Dtest=ClientActivityTest -DfailIfNoTests=false test