Mrmr888 opened a new pull request, #7875:
URL: https://github.com/apache/shenyu/pull/7875

   Fixes #7707
   
   ## Problem
   
   The runtime cache uses the metric name as its key. When multiple rules share
   the same metric, later entries overwrite earlier ones.
   
   ## Changes
   
   - Key cached rules by rule ID to preserve rules sharing the same metric.
   - Update rules by ID without removing other rules for the previous metric.
   - Preserve deletion by metric and support direct deletion by rule ID.
   - Keep cache updates after transaction commit.
   - Add regression tests for initialization, updates, deletion, and 
transaction behavior.
   
   ## Design note
   
   This implementation allows multiple rules per metric.
   
   The existing getRuleByMetricName method still returns a single rule:
   the rule with the lowest sort value, with rule ID as the tie-breaker.
   Feedback on this behavior is welcome.
   
   ## Validation
   
   - Reproduced the original failure: expected two cached rules, but found one.
   - ScaleRuleCacheTest: 8 tests passed.
   - ScaleRuleServiceTest: 10 tests passed.
   - Checkstyle validation passed.
   - Full-project clean install has not been verified for this change.
   
   ## Checklist
   
   - [ ] I have read the contribution guidelines.
   - [x] I have submitted tests that cover the changes.
   - [ ] My local tests passed ./mvnw clean install -Dmaven.javadoc.skip=true.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to