Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
2fd7815c
提交
2fd7815c
authored
1月 15, 2015
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
New connection setting "REUSE_SPACE".
上级
c722ed60
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
59 行增加
和
1 行删除
+59
-1
changelog.html
h2/src/docsrc/html/changelog.html
+5
-1
DbSettings.java
h2/src/main/org/h2/engine/DbSettings.java
+7
-0
MVTableEngine.java
h2/src/main/org/h2/mvstore/db/MVTableEngine.java
+3
-0
TestMVTableEngine.java
h2/src/test/org/h2/test/store/TestMVTableEngine.java
+44
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
2fd7815c
...
...
@@ -17,7 +17,11 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
Issue 587: MVStore: concurrent compaction and store operations could result in an IllegalStateException.
<ul><li>
New connection setting "REUSE_SPACE" (default: true). If disabled,
all changes are appended to the database file, and existing content is never overwritten.
This allows to rollback to a previous state of the database by truncating
the database file.
</li><li>
Issue 587: MVStore: concurrent compaction and store operations could result in an IllegalStateException.
</li><li>
Issue 594: Profiler.copyInThread does not work properly.
</li><li>
Script tool: Now, SCRIPT ... TO is always used (for higher speed and lower disk space usage).
</li><li>
Script tool: Fix parsing of BLOCKSIZE parameter, original patch by Ken Jorissen.
...
...
h2/src/main/org/h2/engine/DbSettings.java
浏览文件 @
2fd7815c
...
...
@@ -281,6 +281,13 @@ public class DbSettings extends SettingsBase {
* milliseconds before updating the database.
*/
public
final
int
reconnectCheckDelay
=
get
(
"RECONNECT_CHECK_DELAY"
,
200
);
/**
* Database setting <code>REUSE_SPACE</code> (default: true).<br />
* If disabled, all changes are appended to the database file, and existing
* content is never overwritten. This setting has no effect if the database is already open.
*/
public
final
boolean
reuseSpace
=
get
(
"REUSE_SPACE"
,
true
);
/**
* Database setting <code>ROWID</code> (default: true).<br />
...
...
h2/src/main/org/h2/mvstore/db/MVTableEngine.java
浏览文件 @
2fd7815c
...
...
@@ -160,6 +160,9 @@ public class MVTableEngine implements TableEngine {
public
Store
(
Database
db
,
MVStore
.
Builder
builder
)
{
this
.
store
=
builder
.
open
();
if
(!
db
.
getSettings
().
reuseSpace
)
{
store
.
setReuseSpace
(
false
);
}
this
.
transactionStore
=
new
TransactionStore
(
store
,
new
ValueDataType
(
null
,
db
,
null
));
...
...
h2/src/test/org/h2/test/store/TestMVTableEngine.java
浏览文件 @
2fd7815c
...
...
@@ -9,6 +9,7 @@ import java.io.ByteArrayInputStream;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.math.BigDecimal
;
import
java.nio.channels.FileChannel
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.PreparedStatement
;
...
...
@@ -48,6 +49,7 @@ public class TestMVTableEngine extends TestBase {
@Override
public
void
test
()
throws
Exception
{
testAppendOnly
();
testLowRetentionTime
();
testOldAndNew
();
testTemporaryTables
();
...
...
@@ -79,6 +81,48 @@ public class TestMVTableEngine extends TestBase {
testLocking
();
testSimple
();
}
private
void
testAppendOnly
()
throws
Exception
{
deleteDb
(
"testAppendOnly"
);
Connection
conn
=
getConnection
(
"testAppendOnly"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"set retention_time 0"
);
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
stat
.
execute
(
"create table dummy"
+
i
+
" as select x, space(100) from system_range(1, 1000)"
);
stat
.
execute
(
"checkpoint"
);
}
stat
.
execute
(
"create table test as select x from system_range(1, 1000)"
);
conn
.
close
();
String
fileName
=
getBaseDir
()
+
"/testAppendOnly"
+
Constants
.
SUFFIX_MV_FILE
;
long
fileSize
=
FileUtils
.
size
(
fileName
);
conn
=
getConnection
(
"testAppendOnly;reuse_space=false"
);
stat
=
conn
.
createStatement
();
stat
.
execute
(
"set retention_time 0"
);
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
stat
.
execute
(
"drop table dummy"
+
i
);
stat
.
execute
(
"checkpoint"
);
}
stat
.
execute
(
"alter table test alter column x rename to y"
);
stat
.
execute
(
"select y from test where 1 = 0"
);
stat
.
execute
(
"create table test2 as select x from system_range(1, 1000)"
);
conn
.
close
();
FileChannel
fc
=
FileUtils
.
open
(
fileName
,
"rw"
);
// undo all changes
fc
.
truncate
(
fileSize
);
conn
=
getConnection
(
"testAppendOnly"
);
stat
=
conn
.
createStatement
();
stat
.
execute
(
"select * from dummy0 where 1 = 0"
);
stat
.
execute
(
"select * from dummy9 where 1 = 0"
);
stat
.
execute
(
"select x from test where 1 = 0"
);
conn
.
close
();
}
private
void
testLowRetentionTime
()
throws
SQLException
{
deleteDb
(
"testLowRetentionTime"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论