Skip to content

[#8871]Improve(core): fix EntityCacheWeigher and testPolicyAndTagCacheWeigher#8875

Merged
yuqi1129 merged 1 commit intobranch-1.0from
cherry-pick-branch-1.0-1a1fc0011d719a0e190e0761fa755f0e6a542574
Oct 23, 2025
Merged

[#8871]Improve(core): fix EntityCacheWeigher and testPolicyAndTagCacheWeigher#8875
yuqi1129 merged 1 commit intobranch-1.0from
cherry-pick-branch-1.0-1a1fc0011d719a0e190e0761fa755f0e6a542574

Conversation

@github-actions
Copy link
Copy Markdown

What changes were proposed in this pull request?

Fix EntityCacheWeigher priorities and update cache eviction test

This commit corrects the entity weight configuration in EntityCacheWeigher and updates the corresponding test to validate the new behavior.

The previous weight configuration was inverted:

  • Schema: weight=500 (incorrectly high, causing unwanted evictions)
  • Tag/Policy: weight=100 (incorrectly low, preventing desired evictions)

This violated the Caffeine cache principle where higher weights lead to higher eviction priority.

Why are the changes needed?

Correct EntityCacheWeigher and fix the flaky test of testPolicyAndTagCacheWeigher

Fix: #8861

Does this PR introduce any user-facing change?

No

How was this patch tested?

Unit test updated

…heWeigher (#8871)

### What changes were proposed in this pull request?

Fix EntityCacheWeigher priorities and update cache eviction test

This commit corrects the entity weight configuration in
EntityCacheWeigher and updates the corresponding test to validate the
new behavior.

The previous weight configuration was inverted:
- Schema: weight=500 (incorrectly high, causing unwanted evictions)
- Tag/Policy: weight=100 (incorrectly low, preventing desired evictions)

This violated the Caffeine cache principle where higher weights lead to
higher eviction priority.

### Why are the changes needed?

Correct EntityCacheWeigher and fix the flaky test of
testPolicyAndTagCacheWeigher

Fix: #8861 

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

Unit test updated
@github-actions github-actions Bot requested a review from jerryshao October 22, 2025 07:17
@roryqi roryqi closed this Oct 23, 2025
@roryqi roryqi reopened this Oct 23, 2025
@yuqi1129 yuqi1129 merged commit e1bdb6a into branch-1.0 Oct 23, 2025
28 checks passed
@jerryshao jerryshao deleted the cherry-pick-branch-1.0-1a1fc0011d719a0e190e0761fa755f0e6a542574 branch November 6, 2025 02:07
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.

3 participants