提交 4aee4f68 authored 作者: Thomas Mueller's avatar Thomas Mueller

LIRS cache: bugfix for very large cache sizes.

上级 56118c48
...@@ -18,7 +18,8 @@ Change Log ...@@ -18,7 +18,8 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>For in-memory databases, queries with a "group by" column that <ul><li>LIRS cache: bugfix for very large cache sizes.
</li><li>For in-memory databases, queries with a "group by" column that
is also a hash index threw a RuntimeException. is also a hash index threw a RuntimeException.
</li><li>Improved error message for some syntax errors. </li><li>Improved error message for some syntax errors.
</li><li>File system abstraction: if used directly, some file systems did not work correctly </li><li>File system abstraction: if used directly, some file systems did not work correctly
......
...@@ -777,9 +777,9 @@ public class CacheLongKeyLIRS<V> { ...@@ -777,9 +777,9 @@ public class CacheLongKeyLIRS<V> {
*/ */
private void evict(Entry<V> newCold) { private void evict(Entry<V> newCold) {
// ensure there are not too many hot entries: // ensure there are not too many hot entries:
// left shift of 5 is multiplication by 32, that means if there are less // right shift of 5 is division by 32, that means if there are less
// than 1/32 (3.125%) cold entries, a new hot entry needs to become cold // than 1/32 (3.125%) cold entries, a new hot entry needs to become cold
while ((queueSize << 5) < mapSize) { while (queueSize < (mapSize >>> 5)) {
convertOldestHotToCold(); convertOldestHotToCold();
} }
if (stackSize > 0) { if (stackSize > 0) {
......
...@@ -725,9 +725,9 @@ public class CacheLIRS<K, V> extends AbstractMap<K, V> { ...@@ -725,9 +725,9 @@ public class CacheLIRS<K, V> extends AbstractMap<K, V> {
*/ */
private void evict(Entry<K, V> newCold) { private void evict(Entry<K, V> newCold) {
// ensure there are not too many hot entries: // ensure there are not too many hot entries:
// left shift of 5 is multiplication by 32, that means if there are less // right shift of 5 is division by 32, that means if there are less
// than 1/32 (3.125%) cold entries, a new hot entry needs to become cold // than 1/32 (3.125%) cold entries, a new hot entry needs to become cold
while ((queueSize << 5) < mapSize) { while (queueSize < (mapSize >>> 5)) {
convertOldestHotToCold(); convertOldestHotToCold();
} }
if (stackSize > 0) { if (stackSize > 0) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论