Skip to content

Commit 8f2f947

Browse files
Fix force evict by shard (and add assert)
1 parent 7515470 commit 8f2f947

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

x-pack/plugin/blob-cache/src/main/java/org/elasticsearch/blobcache/shared/SharedBlobCacheService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1758,7 +1758,7 @@ public void onFailure(Exception e) {
17581758
@Override
17591759
public int forceEvict(ShardId shard, Predicate<KeyType> cacheKeyPredicate) {
17601760
final List<LFUCacheEntry> matchingEntries = new ArrayList<>();
1761-
keyMapping.forEach((key, entry) -> {
1761+
keyMapping.forEach(shard, (key, entry) -> {
17621762
if (cacheKeyPredicate.test(key.file)) {
17631763
matchingEntries.add(entry);
17641764
}
@@ -1773,6 +1773,7 @@ public int forceEvict(ShardId shard, Predicate<KeyType> cacheKeyPredicate) {
17731773
boolean evicted = entry.chunk.forceEvict();
17741774
if (evicted && entry.chunk.volatileIO() != null) {
17751775
unlink(entry);
1776+
assert shard.equals(entry.chunk.regionKey.file.shardId());
17761777
keyMapping.remove(shard, entry.chunk.regionKey, entry);
17771778
evictedCount++;
17781779
if (frequency > 0) {

0 commit comments

Comments
 (0)