Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
65449074
提交
65449074
authored
11月 05, 2014
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MVStore: support for concurrent reads and writes is now enabled by default.
上级
337f0a4f
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
39 行增加
和
38 行删除
+39
-38
TestMultiThread.java
h2/src/test/org/h2/test/db/TestMultiThread.java
+10
-8
TestSpatial.java
h2/src/test/org/h2/test/db/TestSpatial.java
+6
-4
TestConcurrent.java
h2/src/test/org/h2/test/store/TestConcurrent.java
+2
-5
TestMVRTree.java
h2/src/test/org/h2/test/store/TestMVRTree.java
+2
-2
TestMVStore.java
h2/src/test/org/h2/test/store/TestMVStore.java
+10
-5
TestMVStoreBenchmark.java
h2/src/test/org/h2/test/store/TestMVStoreBenchmark.java
+8
-4
TestRandomMapOps.java
h2/src/test/org/h2/test/store/TestRandomMapOps.java
+1
-10
没有找到文件。
h2/src/test/org/h2/test/db/TestMultiThread.java
浏览文件 @
65449074
...
...
@@ -59,7 +59,7 @@ public class TestMultiThread extends TestBase implements Runnable {
testConcurrentAlter
();
testConcurrentAnalyze
();
testConcurrentInsertUpdateSelect
();
test
MetadataWith
();
test
LockModeWithMultiThreaded
();
}
private
void
testConcurrentLobAdd
()
throws
Exception
{
...
...
@@ -246,15 +246,17 @@ public class TestMultiThread extends TestBase implements Runnable {
}
}
private
void
test
MetadataWith
()
throws
Exception
{
private
void
test
LockModeWithMultiThreaded
()
throws
Exception
{
// currently the combination of LOCK_MODE=0 and MULTI_THREADED
// is not supported
. also see code in
deleteDb
(
"
concurrentAnalyz
e"
);
final
String
url
=
getURL
(
"
concurrentAnalyz
e;MULTI_THREADED=1"
,
true
);
// is not supported
deleteDb
(
"
lockMod
e"
);
final
String
url
=
getURL
(
"
lockMod
e;MULTI_THREADED=1"
,
true
);
Connection
conn
=
getConnection
(
url
);
DatabaseMetaData
dmd
=
conn
.
getMetaData
();
assertFalse
(
dmd
.
supportsTransactionIsolationLevel
(
Connection
.
TRANSACTION_READ_UNCOMMITTED
));
DatabaseMetaData
meta
=
conn
.
getMetaData
();
assertFalse
(
meta
.
supportsTransactionIsolationLevel
(
Connection
.
TRANSACTION_READ_UNCOMMITTED
));
conn
.
close
();
deleteDb
(
"
concurrentAnalyz
e"
);
deleteDb
(
"
lockMod
e"
);
}
}
h2/src/test/org/h2/test/db/TestSpatial.java
浏览文件 @
65449074
...
...
@@ -859,9 +859,10 @@ public class TestSpatial extends TestBase {
try
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"drop table if exists pt_cloud;\n"
+
"CREATE TABLE PT_CLOUD AS SELECT CONCAT('POINT(',A.X,' ',B.X,')')::geometry the_geom from"
+
"CREATE TABLE PT_CLOUD AS "
+
" SELECT CONCAT('POINT(',A.X,' ',B.X,')')::geometry the_geom from"
+
" system_range(1e6,1e6+10) A,system_range(6e6,6e6+10) B;\n"
+
"create spatial index ptindex on pt_cloud(the_geom);"
);
"create spatial index pt
_
index on pt_cloud(the_geom);"
);
// Wait some time
try
{
Thread
.
sleep
(
1000
);
...
...
@@ -869,9 +870,10 @@ public class TestSpatial extends TestBase {
throw
new
SQLException
(
ex
);
}
stat
.
execute
(
"drop table if exists pt_cloud;\n"
+
"CREATE TABLE PT_CLOUD AS SELECT CONCAT('POINT(',A.X,' ',B.X,')')::geometry the_geom from"
+
"CREATE TABLE PT_CLOUD AS "
+
" SELECT CONCAT('POINT(',A.X,' ',B.X,')')::geometry the_geom from"
+
" system_range(1e6,1e6+50) A,system_range(6e6,6e6+50) B;\n"
+
"create spatial index ptindex on pt_cloud(the_geom);\n"
+
"create spatial index pt
_
index on pt_cloud(the_geom);\n"
+
"shutdown compact;"
);
}
finally
{
// Close the database
...
...
h2/src/test/org/h2/test/store/TestConcurrent.java
浏览文件 @
65449074
...
...
@@ -19,7 +19,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import
org.h2.mvstore.DataUtils
;
import
org.h2.mvstore.MVMap
;
import
org.h2.mvstore.MVMapConcurrent
;
import
org.h2.mvstore.MVStore
;
import
org.h2.store.fs.FileChannelInputStream
;
import
org.h2.store.fs.FileUtils
;
...
...
@@ -186,8 +185,7 @@ public class TestConcurrent extends TestMVStore {
final
MVStore
s
=
new
MVStore
.
Builder
().
autoCommitDisabled
().
open
();
s
.
setVersionsToKeep
(
10
);
final
MVMapConcurrent
<
Integer
,
Integer
>
m
=
s
.
openMap
(
"data"
,
new
MVMapConcurrent
.
Builder
<
Integer
,
Integer
>());
final
MVMap
<
Integer
,
Integer
>
m
=
s
.
openMap
(
"data"
);
m
.
put
(
1
,
1
);
Task
task
=
new
Task
()
{
@Override
...
...
@@ -374,8 +372,7 @@ public class TestConcurrent extends TestMVStore {
*/
private
void
testConcurrentMap
()
throws
InterruptedException
{
final
MVStore
s
=
openStore
(
null
);
final
MVMap
<
Integer
,
Integer
>
m
=
s
.
openMap
(
"data"
,
new
MVMapConcurrent
.
Builder
<
Integer
,
Integer
>());
final
MVMap
<
Integer
,
Integer
>
m
=
s
.
openMap
(
"data"
);
final
int
size
=
20
;
final
Random
rand
=
new
Random
(
1
);
Task
task
=
new
Task
()
{
...
...
h2/src/test/org/h2/test/store/TestMVRTree.java
浏览文件 @
65449074
...
...
@@ -56,7 +56,7 @@ public class TestMVRTree extends TestMVStore {
testRandom
();
testRandomFind
();
}
private
void
testRemoveAll
()
{
String
fileName
=
getBaseDir
()
+
"/testRemoveAll.h3"
;
FileUtils
.
delete
(
fileName
);
...
...
@@ -73,7 +73,7 @@ public class TestMVRTree extends TestMVStore {
}
s
.
commit
();
map
.
clear
();
s
.
close
();
s
.
close
();
}
private
void
testRandomInsert
()
{
...
...
h2/src/test/org/h2/test/store/TestMVStore.java
浏览文件 @
65449074
...
...
@@ -1278,10 +1278,13 @@ public class TestMVStore extends TestBase {
FileUtils
.
delete
(
fileName
);
MVStore
s
;
s
=
openStore
(
fileName
);
s
.
setVersionsToKeep
(
100
);
s
.
setAutoCommitDelay
(
0
);
s
.
setRetentionTime
(
Integer
.
MAX_VALUE
);
MVMap
<
String
,
String
>
m
;
m
=
s
.
openMap
(
"data"
);
MVMap
<
String
,
String
>
m
=
s
.
openMap
(
"data"
)
;
s
.
commit
(
);
long
first
=
s
.
getCurrentVersion
();
m
.
put
(
"0"
,
"test"
);
s
.
commit
();
m
.
put
(
"1"
,
"Hello"
);
m
.
put
(
"2"
,
"World"
);
...
...
@@ -1351,10 +1354,12 @@ public class TestMVStore extends TestBase {
long
len
=
FileUtils
.
size
(
fileName
);
s
=
openStore
(
fileName
);
s
.
setRetentionTime
(
0
);
// remove
50
%
// remove
75
%
m
=
s
.
openMap
(
"data"
);
for
(
int
i
=
0
;
i
<
10
;
i
+=
2
)
{
m
.
remove
(
i
);
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
if
(
i
%
4
!=
0
)
{
m
.
remove
(
i
);
}
}
s
.
commit
();
assertTrue
(
s
.
compact
(
100
,
50
*
1024
));
...
...
h2/src/test/org/h2/test/store/TestMVStoreBenchmark.java
浏览文件 @
65449074
...
...
@@ -146,18 +146,22 @@ public class TestMVStoreBenchmark extends TestBase {
if
(!
config
.
big
)
{
return
;
}
// -mx12g -agentlib:hprof=heap=sites,depth=8
// int size = 1000;
int
size
=
1000000
;
long
hash
=
0
,
tree
=
0
,
mv
=
0
;
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
Map
<
Integer
,
String
>
map
;
MVStore
store
=
MVStore
.
open
(
null
);
map
=
store
.
openMap
(
"test"
);
mv
=
testPerformance
(
map
,
size
);
map
=
new
HashMap
<
Integer
,
String
>(
size
);
// map = new ConcurrentHashMap<Integer, String>(size);
hash
=
testPerformance
(
map
,
size
);
map
=
new
TreeMap
<
Integer
,
String
>();
// map = new ConcurrentSkipListMap<Integer, String>();
tree
=
testPerformance
(
map
,
size
);
MVStore
store
=
MVStore
.
open
(
null
);
map
=
store
.
openMap
(
"test"
);
mv
=
testPerformance
(
map
,
size
);
if
(
hash
<
tree
&&
mv
<
tree
)
{
if
(
hash
<
tree
&&
mv
<
tree
*
1.5
)
{
break
;
}
}
...
...
h2/src/test/org/h2/test/store/TestRandomMapOps.java
浏览文件 @
65449074
...
...
@@ -11,7 +11,6 @@ import java.util.Random;
import
java.util.TreeMap
;
import
org.h2.mvstore.MVMap
;
import
org.h2.mvstore.MVMapConcurrent
;
import
org.h2.mvstore.MVStore
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.test.TestBase
;
...
...
@@ -22,7 +21,6 @@ import org.h2.test.TestBase;
public
class
TestRandomMapOps
extends
TestBase
{
private
String
fileName
;
private
boolean
concurrent
;
private
int
seed
;
private
int
op
;
...
...
@@ -39,9 +37,6 @@ public class TestRandomMapOps extends TestBase {
@Override
public
void
test
()
throws
Exception
{
concurrent
=
false
;
testMap
(
"memFS:randomOps.h3"
);
concurrent
=
true
;
testMap
(
"memFS:randomOps.h3"
);
}
...
...
@@ -82,11 +77,7 @@ public class TestRandomMapOps extends TestBase {
MVStore
s
;
s
=
openStore
(
fileName
);
MVMap
<
Integer
,
byte
[]>
m
;
if
(
concurrent
)
{
m
=
s
.
openMap
(
"data"
,
new
MVMapConcurrent
.
Builder
<
Integer
,
byte
[]>());
}
else
{
m
=
s
.
openMap
(
"data"
);
}
m
=
s
.
openMap
(
"data"
);
Random
r
=
new
Random
(
seed
);
op
=
0
;
TreeMap
<
Integer
,
byte
[]>
map
=
new
TreeMap
<
Integer
,
byte
[]>();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论