提交 585a36ef authored 作者: noelgrandin@gmail.com's avatar noelgrandin@gmail.com

When using MV_STORE=TRUE and the SET CACHE_SIZE setting, the cache size was incorrectly set,

so that it was effectly 1024 times smaller than it should be.
上级 70f2f798
...@@ -1826,7 +1826,7 @@ public class Database implements DataHandler { ...@@ -1826,7 +1826,7 @@ public class Database implements DataHandler {
pageStore.getCache().setMaxMemory(kb); pageStore.getCache().setMaxMemory(kb);
} }
if (mvStore != null) { if (mvStore != null) {
mvStore.setCacheSize(Math.max(1, kb / 1024)); mvStore.setCacheSize(Math.max(1, kb));
} }
} }
......
...@@ -277,7 +277,7 @@ public class CacheLongKeyLIRS<V> { ...@@ -277,7 +277,7 @@ public class CacheLongKeyLIRS<V> {
* immediately cause entries to get removed however; it will only change * immediately cause entries to get removed however; it will only change
* the limit. To resize the internal array, call the clear method. * the limit. To resize the internal array, call the clear method.
* *
* @param maxMemory the maximum size (1 or larger) * @param maxMemory the maximum size (1 or larger) in bytes
*/ */
public void setMaxMemory(long maxMemory) { public void setMaxMemory(long maxMemory) {
DataUtils.checkArgument( DataUtils.checkArgument(
...@@ -533,7 +533,7 @@ public class CacheLongKeyLIRS<V> { ...@@ -533,7 +533,7 @@ public class CacheLongKeyLIRS<V> {
private final int stackMoveDistance; private final int stackMoveDistance;
/** /**
* The maximum memory this cache should use. * The maximum memory this cache should use in bytes.
*/ */
private long maxMemory; private long maxMemory;
...@@ -1075,7 +1075,7 @@ public class CacheLongKeyLIRS<V> { ...@@ -1075,7 +1075,7 @@ public class CacheLongKeyLIRS<V> {
* immediately cause entries to get removed however; it will only change * immediately cause entries to get removed however; it will only change
* the limit. To resize the internal array, call the clear method. * the limit. To resize the internal array, call the clear method.
* *
* @param maxMemory the maximum size (1 or larger) * @param maxMemory the maximum size (1 or larger) in bytes
*/ */
void setMaxMemory(long maxMemory) { void setMaxMemory(long maxMemory) {
this.maxMemory = maxMemory; this.maxMemory = maxMemory;
......
...@@ -285,6 +285,11 @@ public class MVTableEngine implements TableEngine { ...@@ -285,6 +285,11 @@ public class MVTableEngine implements TableEngine {
return result; return result;
} }
/**
* Set the maximum memory to be used by the cache.
*
* @param kb the maximum size in KB
*/
public void setCacheSize(int kb) { public void setCacheSize(int kb) {
store.setCacheSize(Math.max(1, kb / 1024)); store.setCacheSize(Math.max(1, kb / 1024));
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论