Skip to content

Commit 2006290

Browse files
committed
addendum - minor optimization
1 parent c72a556 commit 2006290

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/impl/prefetch/SingleFilePerBlockCache.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,10 @@ private void addToHeadOfLinkedList(Entry entry) {
322322
if (entry != head) {
323323
Entry prev = entry.getPrevious();
324324
Entry nxt = entry.getNext();
325+
// no-op if the block is already evicted
326+
if (!blocks.containsKey(entry.blockNumber)) {
327+
return;
328+
}
325329
if (prev != null) {
326330
prev.setNext(nxt);
327331
}

0 commit comments

Comments
 (0)