Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
0aff2147
提交
0aff2147
authored
4月 16, 2013
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MVTableEngine
上级
4b6e796a
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
41 行增加
和
24 行删除
+41
-24
TransactionStore.java
h2/src/main/org/h2/mvstore/db/TransactionStore.java
+15
-3
TestMVTableEngine.java
h2/src/test/org/h2/test/store/TestMVTableEngine.java
+26
-21
没有找到文件。
h2/src/main/org/h2/mvstore/db/TransactionStore.java
浏览文件 @
0aff2147
...
@@ -128,6 +128,7 @@ public class TransactionStore {
...
@@ -128,6 +128,7 @@ public class TransactionStore {
// no entry
// no entry
}
else
if
(
last
[
0
]
==
id
)
{
}
else
if
(
last
[
0
]
==
id
)
{
Transaction
t
=
new
Transaction
(
this
,
id
,
status
,
name
,
last
[
1
]);
Transaction
t
=
new
Transaction
(
this
,
id
,
status
,
name
,
last
[
1
]);
t
.
setStored
(
true
);
openTransactionMap
.
put
(
id
,
t
);
openTransactionMap
.
put
(
id
,
t
);
}
}
}
}
...
@@ -168,10 +169,11 @@ public class TransactionStore {
...
@@ -168,10 +169,11 @@ public class TransactionStore {
if
(
store
.
getUnsavedPageCount
()
>
MAX_UNSAVED_PAGES
)
{
if
(
store
.
getUnsavedPageCount
()
>
MAX_UNSAVED_PAGES
)
{
store
.
commit
();
store
.
commit
();
}
}
long
transactionId
=
t
.
getId
();
if
(
t
.
isStored
())
{
if
(
openTransactions
.
containsKey
(
transactionId
))
{
return
;
return
;
}
}
t
.
setStored
(
true
);
long
transactionId
=
t
.
getId
();
Object
[]
v
=
{
t
.
getStatus
(),
null
};
Object
[]
v
=
{
t
.
getStatus
(),
null
};
openTransactions
.
put
(
transactionId
,
v
);
openTransactions
.
put
(
transactionId
,
v
);
openTransactionMap
.
put
(
transactionId
,
t
);
openTransactionMap
.
put
(
transactionId
,
t
);
...
@@ -347,6 +349,8 @@ public class TransactionStore {
...
@@ -347,6 +349,8 @@ public class TransactionStore {
private
int
status
;
private
int
status
;
private
String
name
;
private
String
name
;
private
boolean
stored
;
Transaction
(
TransactionStore
store
,
long
transactionId
,
int
status
,
String
name
,
long
logId
)
{
Transaction
(
TransactionStore
store
,
long
transactionId
,
int
status
,
String
name
,
long
logId
)
{
this
.
store
=
store
;
this
.
store
=
store
;
...
@@ -357,6 +361,14 @@ public class TransactionStore {
...
@@ -357,6 +361,14 @@ public class TransactionStore {
this
.
logId
=
logId
;
this
.
logId
=
logId
;
}
}
boolean
isStored
()
{
return
stored
;
}
void
setStored
(
boolean
stored
)
{
this
.
stored
=
stored
;
}
/**
/**
* Get the transaction id.
* Get the transaction id.
*
*
...
@@ -1047,7 +1059,7 @@ public class TransactionStore {
...
@@ -1047,7 +1059,7 @@ public class TransactionStore {
buff
.
put
((
byte
)
0
);
buff
.
put
((
byte
)
0
);
}
else
{
}
else
{
buff
.
put
((
byte
)
1
);
buff
.
put
((
byte
)
1
);
t
.
write
(
buff
,
o
);
buff
=
t
.
write
(
buff
,
o
);
}
}
}
}
return
buff
;
return
buff
;
...
...
h2/src/test/org/h2/test/store/TestMVTableEngine.java
浏览文件 @
0aff2147
...
@@ -35,7 +35,7 @@ public class TestMVTableEngine extends TestBase {
...
@@ -35,7 +35,7 @@ public class TestMVTableEngine extends TestBase {
}
}
public
void
test
()
throws
Exception
{
public
void
test
()
throws
Exception
{
//
testSpeed();
//testSpeed();
testExclusiveLock
();
testExclusiveLock
();
testEncryption
();
testEncryption
();
testReadOnly
();
testReadOnly
();
...
@@ -71,6 +71,11 @@ int tes;
...
@@ -71,6 +71,11 @@ int tes;
String
url
=
getURL
(
dbName
,
true
);
String
url
=
getURL
(
dbName
,
true
);
String
user
=
getUser
();
String
user
=
getUser
();
String
password
=
getPassword
();
String
password
=
getPassword
();
//Profiler prof = new Profiler();
//prof.sumClasses=true;
//prof.startCollecting();
conn
=
DriverManager
.
getConnection
(
url
,
user
,
password
);
conn
=
DriverManager
.
getConnection
(
url
,
user
,
password
);
stat
=
conn
.
createStatement
();
stat
=
conn
.
createStatement
();
long
time
=
System
.
currentTimeMillis
();
long
time
=
System
.
currentTimeMillis
();
...
@@ -82,39 +87,39 @@ int tes;
...
@@ -82,39 +87,39 @@ int tes;
.
prepareStatement
(
"insert into test values(?, ?)"
);
.
prepareStatement
(
"insert into test values(?, ?)"
);
// -mx4g
// -mx4g
// fast size
// 10000 / 8000
// 10000 / 8000
// 12
29 mvstore;LOCK_MODE=0
// 12
78 mvstore;LOCK_MODE=0 before
// 1
455 mvstore;LOCK_MODE=0
// 1
524 mvstore;LOCK_MODE=0 after
//
19 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0
//
790 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0 before
//
659 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0
//
834 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0 after
// 1000 / 80000
// 1000 / 80000
// 1
383 mvstore;LOCK_MODE=0
// 1
753 mvstore;LOCK_MODE=0 before
// 1
618 mvstore;LOCK_MODE=0
// 1
998 mvstore;LOCK_MODE=0 after
//
244 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0
//
810 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0 before
//
965 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0
//
818 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0 after
// 100 / 800000
// 100 / 800000
// 2
061 mvstore;LOCK_MODE=0
// 2
270 mvstore;LOCK_MODE=0 before
// 2
281 mvstore;LOCK_MODE=0
// 2
841 mvstore;LOCK_MODE=0 after
//
1414 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0
//
2107 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0 before
// 2
647 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0
// 2
116 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0 after
// 10 / 800000
0
// 10 / 800000
// 1
1453 mvstore;LOCK_MODE=0
// 1
312 mvstore;LOCK_MODE=0 before
// 1
1720 mvstore;LOCK_MODE=0
// 1
500 mvstore;LOCK_MODE=0 after
// 1
3605 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0
// 1
541 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0 before
//
25172 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0
//
1551 mvstore;DEFAULT_TABLE_ENGINE=org.h2.mvstore.db.MVTableEngine;LOCK_MODE=0 after
prep
.
setString
(
2
,
new
String
(
new
char
[
10
]).
replace
((
char
)
0
,
'x'
));
prep
.
setString
(
2
,
new
String
(
new
char
[
10
]).
replace
((
char
)
0
,
'x'
));
for
(
int
i
=
0
;
i
<
80000
0
;
i
++)
{
for
(
int
i
=
0
;
i
<
80000
;
i
++)
{
prep
.
setInt
(
1
,
i
);
prep
.
setInt
(
1
,
i
);
prep
.
execute
();
prep
.
execute
();
}
}
System
.
out
.
println
((
System
.
currentTimeMillis
()
-
time
)
+
" "
+
dbName
+
" before"
);
System
.
out
.
println
((
System
.
currentTimeMillis
()
-
time
)
+
" "
+
dbName
+
" before"
);
//Profiler prof = new Profiler().startCollecting();
conn
.
close
();
conn
.
close
();
//System.out.println(prof.getTop(10));
//System.out.println(prof.getTop(10));
System
.
out
.
println
((
System
.
currentTimeMillis
()
-
time
)
+
" "
+
dbName
+
" after"
);
System
.
out
.
println
((
System
.
currentTimeMillis
()
-
time
)
+
" "
+
dbName
+
" after"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论