|
|
@ -115,8 +115,12 @@ public final class DfsBlockCache { |
|
|
|
DfsBlockCache oc = cache; |
|
|
|
DfsBlockCache oc = cache; |
|
|
|
cache = nc; |
|
|
|
cache = nc; |
|
|
|
|
|
|
|
|
|
|
|
if (oc != null && oc.readAheadService != null) |
|
|
|
if (oc != null) { |
|
|
|
oc.readAheadService.shutdown(); |
|
|
|
if (oc.readAheadService != null) |
|
|
|
|
|
|
|
oc.readAheadService.shutdown(); |
|
|
|
|
|
|
|
for (DfsPackFile pack : oc.getPackFiles()) |
|
|
|
|
|
|
|
pack.key.cachedSize.set(0); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** @return the currently active DfsBlockCache. */ |
|
|
|
/** @return the currently active DfsBlockCache. */ |
|
|
@ -343,6 +347,7 @@ public final class DfsBlockCache { |
|
|
|
e2 = table.get(slot); |
|
|
|
e2 = table.get(slot); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
key.cachedSize.addAndGet(v.size()); |
|
|
|
Ref<DfsBlock> ref = new Ref<DfsBlock>(key, position, v.size(), v); |
|
|
|
Ref<DfsBlock> ref = new Ref<DfsBlock>(key, position, v.size(), v); |
|
|
|
ref.hot = true; |
|
|
|
ref.hot = true; |
|
|
|
for (;;) { |
|
|
|
for (;;) { |
|
|
@ -389,6 +394,7 @@ public final class DfsBlockCache { |
|
|
|
dead.next = null; |
|
|
|
dead.next = null; |
|
|
|
dead.value = null; |
|
|
|
dead.value = null; |
|
|
|
live -= dead.size; |
|
|
|
live -= dead.size; |
|
|
|
|
|
|
|
dead.pack.cachedSize.addAndGet(-dead.size); |
|
|
|
statEvict++; |
|
|
|
statEvict++; |
|
|
|
} while (maxBytes < live); |
|
|
|
} while (maxBytes < live); |
|
|
|
clockHand = prev; |
|
|
|
clockHand = prev; |
|
|
@ -438,6 +444,7 @@ public final class DfsBlockCache { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
key.cachedSize.addAndGet(size); |
|
|
|
ref = new Ref<T>(key, pos, size, v); |
|
|
|
ref = new Ref<T>(key, pos, size, v); |
|
|
|
ref.hot = true; |
|
|
|
ref.hot = true; |
|
|
|
for (;;) { |
|
|
|
for (;;) { |
|
|
|