提交 977b7111 authored 作者: Thomas Mueller's avatar Thomas Mueller

Database file growth can now be limited using the database setting PAGE_STORE_MAX_GROWTH.

上级 d514b826
...@@ -245,6 +245,13 @@ public class DbSettings extends SettingsBase { ...@@ -245,6 +245,13 @@ public class DbSettings extends SettingsBase {
*/ */
public final boolean optimizeUpdate = get("OPTIMIZE_UPDATE", true); public final boolean optimizeUpdate = get("OPTIMIZE_UPDATE", true);
/**
* Database setting <code>PAGE_STORE_MAX_GROWTH_RATE</code>
* (default: Integer.MAX_VALUE).<br />
* The maximum number of pages the file grows at any time.
*/
public final int pageStoreMaxGrowth = get("PAGE_STORE_MAX_GROWTH", Integer.MAX_VALUE);
/** /**
* Database setting <code>PAGE_STORE_INTERNAL_COUNT</code> * Database setting <code>PAGE_STORE_INTERNAL_COUNT</code>
* (default: false).<br /> * (default: false).<br />
......
...@@ -123,7 +123,6 @@ public class PageStore implements CacheWriter { ...@@ -123,7 +123,6 @@ public class PageStore implements CacheWriter {
private static final int MIN_PAGE_COUNT = 6; private static final int MIN_PAGE_COUNT = 6;
private static final int INCREMENT_KB = 1024; private static final int INCREMENT_KB = 1024;
private static final int INCREMENT_PERCENT_MIN = 20; private static final int INCREMENT_PERCENT_MIN = 20;
private static final int INCREMENT_MAX_PAGES = 128;
private static final int READ_VERSION = 3; private static final int READ_VERSION = 3;
private static final int WRITE_VERSION = 3; private static final int WRITE_VERSION = 3;
private static final int META_TYPE_DATA_INDEX = 0; private static final int META_TYPE_DATA_INDEX = 0;
...@@ -1135,8 +1134,9 @@ public class PageStore implements CacheWriter { ...@@ -1135,8 +1134,9 @@ public class PageStore implements CacheWriter {
if (increment < percent) { if (increment < percent) {
increment = (1 + (percent / increment)) * increment; increment = (1 + (percent / increment)) * increment;
} }
if (increment > INCREMENT_MAX_PAGES) { int max = database.getSettings().pageStoreMaxGrowth;
increment = INCREMENT_MAX_PAGES; if (increment > max) {
increment = max;
} }
increaseFileSize(increment); increaseFileSize(increment);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论