Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
224cefae
提交
224cefae
authored
9月 22, 2013
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MVTableEngine
上级
d50a6d4b
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
40 行增加
和
34 行删除
+40
-34
changelog.html
h2/src/docsrc/html/changelog.html
+4
-1
mvstore.html
h2/src/docsrc/html/mvstore.html
+2
-2
MVMap.java
h2/src/main/org/h2/mvstore/MVMap.java
+1
-1
MVStore.java
h2/src/main/org/h2/mvstore/MVStore.java
+17
-0
TestMVTableEngine.java
h2/src/test/org/h2/test/store/TestMVTableEngine.java
+16
-30
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
224cefae
...
...
@@ -18,7 +18,10 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
To compile user defined functions, the javax.tools.JavaCompiler is now used if available,
<ul><li>
To use the MVStore storage engine (which is still work in progress), append
";mv_store=true" to the database URL. Using the MVTableEngine when creating the table
is no longer recommended.
</li><li>
To compile user defined functions, the javax.tools.JavaCompiler is now used if available,
and no temporary files are created. This should solve problems when
multiple H2 database concurrently compile the same user defined functions.
To disable, system the system property "h2.javaSystemCompiler" to false.
...
...
h2/src/docsrc/html/mvstore.html
浏览文件 @
224cefae
...
...
@@ -41,7 +41,7 @@ MVStore
<a
href=
"#encryption"
>
- Encrypted Files
</a><br
/>
<a
href=
"#tools"
>
- Tools
</a><br
/>
<a
href=
"#exceptionHandling"
>
- Exception Handling
</a><br
/>
<a
href=
"#
tableEngine"
>
- Tabl
e Engine for H2
</a><br
/>
<a
href=
"#
storageEngine"
>
- Storag
e Engine for H2
</a><br
/>
<a
href=
"#differences"
>
Similar Projects and Differences to Other Storage Engines
</a><br
/>
...
...
@@ -461,7 +461,7 @@ The following exceptions can occur:
</li><li><code>
ConcurrentModificationException
</code>
if the object is modified concurrently.
</li></ul>
<h3
id=
"
tableEngine"
>
Tabl
e Engine for H2
</h3>
<h3
id=
"
storageEngine"
>
Storag
e Engine for H2
</h3>
<p>
The plan is to use the MVStore as the default storage engine for the H2 database
in the future (supporting SQL, JDBC, transactions, MVCC, and so on).
...
...
h2/src/main/org/h2/mvstore/MVMap.java
浏览文件 @
224cefae
...
...
@@ -879,7 +879,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
* Forget those old versions that are no longer needed.
*/
void
removeUnusedOldVersions
()
{
long
oldest
=
store
.
getRetainVersion
();
long
oldest
=
store
.
getRetain
OrStore
Version
();
if
(
oldest
==
-
1
)
{
return
;
}
...
...
h2/src/main/org/h2/mvstore/MVStore.java
浏览文件 @
224cefae
...
...
@@ -47,6 +47,8 @@ TestMVStoreDataLoss
MVTableEngine:
- use StreamStore
- when the MVStore was enabled before, use it again
(probably by checking existence of the mvstore file)
TransactionStore:
...
...
@@ -1528,6 +1530,21 @@ public class MVStore {
return
v
;
}
/**
* Get the oldest version to retain in memory, which is the manually set
* retain version, or the current store version (whatever is older).
*
* @return the version
*/
long
getRetainOrStoreVersion
()
{
long
v
=
retainVersion
;
long
storeVersion
=
currentStoreVersion
;
if
(
storeVersion
>
-
1
)
{
v
=
Math
.
min
(
v
,
storeVersion
);
}
return
v
;
}
/**
* Check whether all data can be read from this version. This requires that
* all chunks referenced by this version are still available (not
...
...
h2/src/test/org/h2/test/store/TestMVTableEngine.java
浏览文件 @
224cefae
...
...
@@ -374,10 +374,9 @@ public class TestMVTableEngine extends TestBase {
Connection
conn
;
Statement
stat
;
ResultSet
rs
;
conn
=
getConnection
(
"mvstore"
);
conn
=
getConnection
(
"mvstore
;MV_STORE=TRUE
"
);
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create table test(id int) "
+
"engine \"org.h2.mvstore.db.MVTableEngine\""
);
stat
.
execute
(
"create table test(id int)"
);
stat
.
execute
(
"set write_delay 0"
);
stat
.
execute
(
"insert into test values(1)"
);
stat
.
execute
(
"shutdown immediately"
);
...
...
@@ -386,8 +385,7 @@ public class TestMVTableEngine extends TestBase {
}
catch
(
Exception
e
)
{
// ignore
}
conn
=
getConnection
(
"mvstore"
);
conn
=
getConnection
(
"mvstore;MV_STORE=TRUE"
);
stat
=
conn
.
createStatement
();
rs
=
stat
.
executeQuery
(
"select * from test"
);
assertTrue
(
rs
.
next
());
...
...
@@ -399,11 +397,10 @@ public class TestMVTableEngine extends TestBase {
Connection
conn
;
Statement
stat
;
ResultSet
rs
;
conn
=
getConnection
(
"mvstore"
);
conn
=
getConnection
(
"mvstore
;MV_STORE=TRUE
"
);
for
(
int
i
=
0
;
i
<
2
;
i
++)
{
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create table test(id int primary key, name varchar) "
+
"engine \"org.h2.mvstore.db.MVTableEngine\""
);
stat
.
execute
(
"create table test(id int primary key, name varchar)"
);
stat
.
execute
(
"create index on test(name)"
);
conn
.
setAutoCommit
(
false
);
stat
.
execute
(
"insert into test values(1, 'Hello')"
);
...
...
@@ -433,12 +430,11 @@ public class TestMVTableEngine extends TestBase {
FileUtils
.
deleteRecursive
(
getBaseDir
(),
true
);
Connection
conn
;
Statement
stat
;
conn
=
getConnection
(
"mvstore"
);
conn
=
getConnection
(
"mvstore
;MV_STORE=TRUE
"
);
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create table test(id int, name varchar) "
+
"engine \"org.h2.mvstore.db.MVTableEngine\""
);
stat
.
execute
(
"create table test(id int, name varchar)"
);
conn
.
close
();
conn
=
getConnection
(
"mvstore"
);
conn
=
getConnection
(
"mvstore
;MV_STORE=TRUE
"
);
stat
=
conn
.
createStatement
();
stat
.
execute
(
"drop table test"
);
conn
.
close
();
...
...
@@ -446,8 +442,7 @@ public class TestMVTableEngine extends TestBase {
private
void
testBlob
()
throws
SQLException
,
IOException
{
FileUtils
.
deleteRecursive
(
getBaseDir
(),
true
);
String
dbName
=
"mvstore"
+
";MV_STORE=TRUE"
;
String
dbName
=
"mvstore;MV_STORE=TRUE"
;
Connection
conn
;
Statement
stat
;
conn
=
getConnection
(
dbName
);
...
...
@@ -474,8 +469,7 @@ public class TestMVTableEngine extends TestBase {
private
void
testEncryption
()
throws
Exception
{
FileUtils
.
deleteRecursive
(
getBaseDir
(),
true
);
String
dbName
=
"mvstore"
+
";MV_STORE=TRUE"
;
String
dbName
=
"mvstore;MV_STORE=TRUE"
;
Connection
conn
;
Statement
stat
;
String
url
=
getURL
(
dbName
+
";CIPHER=AES"
,
true
);
...
...
@@ -495,8 +489,7 @@ public class TestMVTableEngine extends TestBase {
private
void
testExclusiveLock
()
throws
Exception
{
FileUtils
.
deleteRecursive
(
getBaseDir
(),
true
);
String
dbName
=
"mvstore"
+
";MV_STORE=TRUE"
;
String
dbName
=
"mvstore;MV_STORE=TRUE"
;
Connection
conn
,
conn2
;
Statement
stat
,
stat2
;
conn
=
getConnection
(
dbName
);
...
...
@@ -519,8 +512,7 @@ public class TestMVTableEngine extends TestBase {
private
void
testReadOnly
()
throws
Exception
{
FileUtils
.
deleteRecursive
(
getBaseDir
(),
true
);
String
dbName
=
"mvstore"
+
";MV_STORE=TRUE"
;
String
dbName
=
"mvstore;MV_STORE=TRUE"
;
Connection
conn
;
Statement
stat
;
conn
=
getConnection
(
dbName
);
...
...
@@ -537,8 +529,7 @@ public class TestMVTableEngine extends TestBase {
private
void
testReuseDiskSpace
()
throws
Exception
{
FileUtils
.
deleteRecursive
(
getBaseDir
(),
true
);
String
dbName
=
"mvstore"
+
";MV_STORE=TRUE"
;
String
dbName
=
"mvstore;MV_STORE=TRUE"
;
Connection
conn
;
Statement
stat
;
long
maxSize
=
0
;
...
...
@@ -563,8 +554,7 @@ public class TestMVTableEngine extends TestBase {
private
void
testDataTypes
()
throws
Exception
{
FileUtils
.
deleteRecursive
(
getBaseDir
(),
true
);
String
dbName
=
"mvstore"
+
";MV_STORE=TRUE"
;
String
dbName
=
"mvstore;MV_STORE=TRUE"
;
Connection
conn
=
getConnection
(
dbName
);
Statement
stat
=
conn
.
createStatement
();
...
...
@@ -713,8 +703,7 @@ public class TestMVTableEngine extends TestBase {
private
void
testLocking
()
throws
Exception
{
FileUtils
.
deleteRecursive
(
getBaseDir
(),
true
);
String
dbName
=
"mvstore"
+
";MV_STORE=TRUE"
;
String
dbName
=
"mvstore;MV_STORE=TRUE"
;
Connection
conn
=
getConnection
(
dbName
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"set lock_timeout 1000"
);
...
...
@@ -750,12 +739,9 @@ public class TestMVTableEngine extends TestBase {
private
void
testSimple
()
throws
Exception
{
FileUtils
.
deleteRecursive
(
getBaseDir
(),
true
);
String
dbName
=
"mvstore"
+
";MV_STORE=TRUE"
;
String
dbName
=
"mvstore;MV_STORE=TRUE"
;
Connection
conn
=
getConnection
(
dbName
);
Statement
stat
=
conn
.
createStatement
();
// create table test(id int, name varchar)
// engine "org.h2.mvstore.db.MVStoreTableEngine"
stat
.
execute
(
"create table test(id int primary key, name varchar)"
);
stat
.
execute
(
"insert into test values(1, 'Hello'), (2, 'World')"
);
ResultSet
rs
=
stat
.
executeQuery
(
"select *, _rowid_ from test"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论