提交 524c1ed8 authored 作者: Noel Grandin's avatar Noel Grandin

#453 MVStore setCacheSize() should also limit the cacheChunkRef

上级 66eb7e81
...@@ -21,6 +21,8 @@ Change Log ...@@ -21,6 +21,8 @@ Change Log
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul> <ul>
<li>Issue #453: MVStore setCacheSize() should also limit the cacheChunkRef
</li>
<li>Issue #448: Newly added TO_DATE and TO_TIMESTAMP functions have wrong datatype <li>Issue #448: Newly added TO_DATE and TO_TIMESTAMP functions have wrong datatype
</li> </li>
<li>The "nioMemLZF" filesystem now supports an extra option "nioMemLZF:12:" to tweak the size of the compress later cache. <li>The "nioMemLZF" filesystem now supports an extra option "nioMemLZF:12:" to tweak the size of the compress later cache.
......
...@@ -2525,10 +2525,15 @@ public class MVStore { ...@@ -2525,10 +2525,15 @@ public class MVStore {
* @param mb the cache size in MB. * @param mb the cache size in MB.
*/ */
public void setCacheSize(int mb) { public void setCacheSize(int mb) {
final long bytes = (long) mb * 1024 * 1024;
if (cache != null) { if (cache != null) {
cache.setMaxMemory((long) mb * 1024 * 1024); cache.setMaxMemory(bytes);
cache.clear(); cache.clear();
} }
if (cacheChunkRef != null) {
cacheChunkRef.setMaxMemory(bytes / 4);
cacheChunkRef.clear();
}
} }
public boolean isClosed() { public boolean isClosed() {
...@@ -2637,6 +2642,8 @@ public class MVStore { ...@@ -2637,6 +2642,8 @@ public class MVStore {
/** /**
* Get the amount of memory used for caching, in MB. * Get the amount of memory used for caching, in MB.
* Note that this does not include the page chunk references cache, which is
* 25% of the size of the page cache.
* *
* @return the amount of memory used for caching * @return the amount of memory used for caching
*/ */
...@@ -2649,6 +2656,8 @@ public class MVStore { ...@@ -2649,6 +2656,8 @@ public class MVStore {
/** /**
* Get the maximum cache size, in MB. * Get the maximum cache size, in MB.
* Note that this does not include the page chunk references cache, which is
* 25% of the size of the page cache.
* *
* @return the cache size * @return the cache size
*/ */
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论