提交 264212b5 authored 作者: Thomas Mueller's avatar Thomas Mueller

New system property h2.pageStoreTrim to disable shrinking the database size when closing.

上级 3f1260f0
...@@ -18,6 +18,9 @@ Change Log ...@@ -18,6 +18,9 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>New system property h2.pageStoreTrim to disable shrinking the database size when closing
(disabled by default, meaning by default the database is trimmed).
</li></ul>
<h2>Version 1.2.120 (2009-09-26)</h2> <h2>Version 1.2.120 (2009-09-26)</h2>
<ul><li>This is a beta version. <ul><li>This is a beta version.
......
...@@ -538,6 +538,12 @@ public class SysProperties { ...@@ -538,6 +538,12 @@ public class SysProperties {
*/ */
public static final boolean PAGE_STORE = getBooleanSetting(H2_PAGE_STORE, Constants.VERSION >= 1.2); public static final boolean PAGE_STORE = getBooleanSetting(H2_PAGE_STORE, Constants.VERSION >= 1.2);
/**
* System property <code>h2.pageStoreTrim</code> (default: true).<br />
* Trim the database size when closing.
*/
public static final boolean PAGE_STORE_TRIM = getBooleanSetting("h2.pageStoreTrim", true);
/** /**
* System property <code>h2.pgClientEncoding</code> (default: UTF-8).<br /> * System property <code>h2.pgClientEncoding</code> (default: UTF-8).<br />
* Default client encoding for PG server. It is used if the client does not * Default client encoding for PG server. It is used if the client does not
......
...@@ -354,6 +354,9 @@ public class PageStore implements CacheWriter { ...@@ -354,6 +354,9 @@ public class PageStore implements CacheWriter {
* Shrink the file so there are no empty pages at the end. * Shrink the file so there are no empty pages at the end.
*/ */
public void trim() throws SQLException { public void trim() throws SQLException {
if (!SysProperties.PAGE_STORE_TRIM) {
return;
}
// find the last used page // find the last used page
int lastUsed = -1; int lastUsed = -1;
for (int i = getFreeListId(pageCount); i >= 0; i--) { for (int i = getFreeListId(pageCount); i >= 0; i--) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论