Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
e3695afe
提交
e3695afe
authored
5月 08, 2013
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MVStore table engine (reduced memory usage and improved performance)
上级
47da2c44
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
192 行增加
和
186 行删除
+192
-186
changelog.html
h2/src/docsrc/html/changelog.html
+2
-1
MVPrimaryIndex.java
h2/src/main/org/h2/mvstore/db/MVPrimaryIndex.java
+1
-1
MVTable.java
h2/src/main/org/h2/mvstore/db/MVTable.java
+1
-1
TransactionStore.java
h2/src/main/org/h2/mvstore/db/TransactionStore.java
+167
-150
DataType.java
h2/src/main/org/h2/mvstore/type/DataType.java
+2
-1
RegularTable.java
h2/src/main/org/h2/table/RegularTable.java
+1
-1
TestMVTableEngine.java
h2/src/test/org/h2/test/store/TestMVTableEngine.java
+16
-28
TestTransactionStore.java
h2/src/test/org/h2/test/store/TestTransactionStore.java
+2
-3
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
e3695afe
...
@@ -18,7 +18,8 @@ Change Log
...
@@ -18,7 +18,8 @@ Change Log
<h1>
Change Log
</h1>
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
The optimization for IN(...) queries combined with OR could result
<ul><li>
The auto-analyze feature now only reads 1000 rows per table instead of 10000.
</li><li>
The optimization for IN(...) queries combined with OR could result
in a strange exception of the type "column x must be included in the group by list".
in a strange exception of the type "column x must be included in the group by list".
</li><li>
Issue 454: Use Charset for type-safety.
</li><li>
Issue 454: Use Charset for type-safety.
</li><li>
Queries with both LIMIT and OFFSET could throw an IllegalArgumentException.
</li><li>
Queries with both LIMIT and OFFSET could throw an IllegalArgumentException.
...
...
h2/src/main/org/h2/mvstore/db/MVPrimaryIndex.java
浏览文件 @
e3695afe
...
@@ -103,7 +103,7 @@ public class MVPrimaryIndex extends BaseIndex {
...
@@ -103,7 +103,7 @@ public class MVPrimaryIndex extends BaseIndex {
row
.
setKey
(++
lastKey
);
row
.
setKey
(++
lastKey
);
}
}
}
else
{
}
else
{
L
ong
c
=
row
.
getValue
(
mainIndexColumn
).
getLong
();
l
ong
c
=
row
.
getValue
(
mainIndexColumn
).
getLong
();
row
.
setKey
(
c
);
row
.
setKey
(
c
);
}
}
...
...
h2/src/main/org/h2/mvstore/db/MVTable.java
浏览文件 @
e3695afe
...
@@ -554,7 +554,7 @@ public class MVTable extends TableBase {
...
@@ -554,7 +554,7 @@ public class MVTable extends TableBase {
if
(
n
>
0
)
{
if
(
n
>
0
)
{
nextAnalyze
=
n
;
nextAnalyze
=
n
;
}
}
int
rows
=
session
.
getDatabase
().
getSettings
().
analyzeSample
;
int
rows
=
session
.
getDatabase
().
getSettings
().
analyzeSample
/
10
;
Analyze
.
analyzeTable
(
session
,
this
,
rows
,
false
);
Analyze
.
analyzeTable
(
session
,
this
,
rows
,
false
);
}
}
...
...
h2/src/main/org/h2/mvstore/db/TransactionStore.java
浏览文件 @
e3695afe
差异被折叠。
点击展开。
h2/src/main/org/h2/mvstore/type/DataType.java
浏览文件 @
e3695afe
...
@@ -15,10 +15,11 @@ public interface DataType {
...
@@ -15,10 +15,11 @@ public interface DataType {
/**
/**
* Compare two keys.
* Compare two keys.
*
*
* @param a the first key
* @param a the first key
* @param b the second key
* @param b the second key
* @return -1 if the first key is smaller, 1 if larger, and 0 if equal
* @return -1 if the first key is smaller, 1 if larger, and 0 if equal
* @throws UnsupportedOperationException if the type is not orderable
*/
*/
int
compare
(
Object
a
,
Object
b
);
int
compare
(
Object
a
,
Object
b
);
...
...
h2/src/main/org/h2/table/RegularTable.java
浏览文件 @
e3695afe
...
@@ -401,7 +401,7 @@ public class RegularTable extends TableBase {
...
@@ -401,7 +401,7 @@ public class RegularTable extends TableBase {
if
(
n
>
0
)
{
if
(
n
>
0
)
{
nextAnalyze
=
n
;
nextAnalyze
=
n
;
}
}
int
rows
=
session
.
getDatabase
().
getSettings
().
analyzeSample
;
int
rows
=
session
.
getDatabase
().
getSettings
().
analyzeSample
/
10
;
Analyze
.
analyzeTable
(
session
,
this
,
rows
,
false
);
Analyze
.
analyzeTable
(
session
,
this
,
rows
,
false
);
}
}
...
...
h2/src/test/org/h2/test/store/TestMVTableEngine.java
浏览文件 @
e3695afe
...
@@ -8,7 +8,6 @@ package org.h2.test.store;
...
@@ -8,7 +8,6 @@ package org.h2.test.store;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayInputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.PrintWriter
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.sql.Connection
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.DriverManager
;
...
@@ -16,12 +15,12 @@ import java.sql.PreparedStatement;
...
@@ -16,12 +15,12 @@ import java.sql.PreparedStatement;
import
java.sql.ResultSet
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.sql.Statement
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.ErrorCode
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Constants
;
import
org.h2.mvstore.db.MVTableEngine
;
import
org.h2.mvstore.db.MVTableEngine
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
import
org.h2.util.Profiler
;
import
org.h2.util.Task
;
import
org.h2.util.Task
;
/**
/**
...
@@ -39,7 +38,7 @@ public class TestMVTableEngine extends TestBase {
...
@@ -39,7 +38,7 @@ public class TestMVTableEngine extends TestBase {
}
}
public
void
test
()
throws
Exception
{
public
void
test
()
throws
Exception
{
//
testSpeed();
//
testSpeed();
testReopen
();
testReopen
();
testBlob
();
testBlob
();
testExclusiveLock
();
testExclusiveLock
();
...
@@ -95,32 +94,21 @@ int tes;
...
@@ -95,32 +94,21 @@ int tes;
// -mx4g
// -mx4g
// fast size
// fast size
// 10000 / 8000
// 1278 mvstore;LOCK_MODE=0 before
// 1524 mvstore;LOCK_MODE=0 after
// 790 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0 before
// 834 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0 after
// 1000 / 80000
// 1753 mvstore;LOCK_MODE=0 before
// 1998 mvstore;LOCK_MODE=0 after
// 810 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0 before
// 818 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0 after
// 100 / 800000
// 2270 mvstore;LOCK_MODE=0 before
// 2841 mvstore;LOCK_MODE=0 after
// 2107 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0 before
// 2116 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0 after
// 10 / 800000
// 10 / 800000
// 1312 mvstore;LOCK_MODE=0 before
// 1265 mvstore;LOCK_MODE=0 before
// 1500 mvstore;LOCK_MODE=0 after
// 1434 mvstore;LOCK_MODE=0 after
// 1541 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0 before
// 1126 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0;LOG=0 before
// 1551 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0 after
// 1136 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0;LOG=0 after
prep
.
setString
(
2
,
new
String
(
new
char
[
100
]).
replace
((
char
)
0
,
'x'
));
// 100 / 800000
for
(
int
i
=
0
;
i
<
200000
;
i
++)
{
// 2010 mvstore;LOCK_MODE=0 before
// 2261 mvstore;LOCK_MODE=0 after
// 1536 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0;LOG=0 before
// 1546 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0;LOG=0 after
prep
.
setString
(
2
,
new
String
(
new
char
[
10
]).
replace
((
char
)
0
,
'x'
));
// for (int i = 0; i < 20000; i++) {
for
(
int
i
=
0
;
i
<
800000
;
i
++)
{
prep
.
setInt
(
1
,
i
);
prep
.
setInt
(
1
,
i
);
prep
.
execute
();
prep
.
execute
();
...
...
h2/src/test/org/h2/test/store/TestTransactionStore.java
浏览文件 @
e3695afe
...
@@ -40,7 +40,6 @@ public class TestTransactionStore extends TestBase {
...
@@ -40,7 +40,6 @@ public class TestTransactionStore extends TestBase {
public
void
test
()
throws
Exception
{
public
void
test
()
throws
Exception
{
FileUtils
.
createDirectories
(
getBaseDir
());
FileUtils
.
createDirectories
(
getBaseDir
());
testKeyIterator
();
testKeyIterator
();
testMultiStatement
();
testMultiStatement
();
testTwoPhaseCommit
();
testTwoPhaseCommit
();
...
@@ -205,7 +204,7 @@ public class TestTransactionStore extends TestBase {
...
@@ -205,7 +204,7 @@ public class TestTransactionStore extends TestBase {
list
=
ts
.
getOpenTransactions
();
list
=
ts
.
getOpenTransactions
();
assertEquals
(
1
,
list
.
size
());
assertEquals
(
1
,
list
.
size
());
txOld
=
list
.
get
(
0
);
txOld
=
list
.
get
(
0
);
assertTrue
(
tx
==
txOld
);
assertTrue
(
tx
.
getId
()
==
txOld
.
getId
()
);
s
.
commit
();
s
.
commit
();
ts
.
close
();
ts
.
close
();
s
.
close
();
s
.
close
();
...
@@ -233,7 +232,7 @@ public class TestTransactionStore extends TestBase {
...
@@ -233,7 +232,7 @@ public class TestTransactionStore extends TestBase {
tx
=
ts
.
begin
();
tx
=
ts
.
begin
();
m
=
tx
.
openMap
(
"test"
);
m
=
tx
.
openMap
(
"test"
);
// TransactionStore was not closed, so we lost some ids
// TransactionStore was not closed, so we lost some ids
assertEquals
(
33
,
tx
.
getId
());
assertEquals
(
65
,
tx
.
getId
());
list
=
ts
.
getOpenTransactions
();
list
=
ts
.
getOpenTransactions
();
assertEquals
(
2
,
list
.
size
());
assertEquals
(
2
,
list
.
size
());
txOld
=
list
.
get
(
1
);
txOld
=
list
.
get
(
1
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论