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 {
...
@@ -59,7 +59,7 @@ public class TestMultiThread extends TestBase implements Runnable {
testConcurrentAlter
();
testConcurrentAlter
();
testConcurrentAnalyze
();
testConcurrentAnalyze
();
testConcurrentInsertUpdateSelect
();
testConcurrentInsertUpdateSelect
();
test
MetadataWith
();
test
LockModeWithMultiThreaded
();
}
}
private
void
testConcurrentLobAdd
()
throws
Exception
{
private
void
testConcurrentLobAdd
()
throws
Exception
{
...
@@ -246,15 +246,17 @@ public class TestMultiThread extends TestBase implements Runnable {
...
@@ -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
// currently the combination of LOCK_MODE=0 and MULTI_THREADED
// is not supported
. also see code in
// is not supported
deleteDb
(
"
concurrentAnalyz
e"
);
deleteDb
(
"
lockMod
e"
);
final
String
url
=
getURL
(
"
concurrentAnalyz
e;MULTI_THREADED=1"
,
true
);
final
String
url
=
getURL
(
"
lockMod
e;MULTI_THREADED=1"
,
true
);
Connection
conn
=
getConnection
(
url
);
Connection
conn
=
getConnection
(
url
);
DatabaseMetaData
dmd
=
conn
.
getMetaData
();
DatabaseMetaData
meta
=
conn
.
getMetaData
();
assertFalse
(
dmd
.
supportsTransactionIsolationLevel
(
Connection
.
TRANSACTION_READ_UNCOMMITTED
));
assertFalse
(
meta
.
supportsTransactionIsolationLevel
(
Connection
.
TRANSACTION_READ_UNCOMMITTED
));
conn
.
close
();
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 {
...
@@ -859,9 +859,10 @@ public class TestSpatial extends TestBase {
try
{
try
{
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"drop table if exists pt_cloud;\n"
+
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"
+
" 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
// Wait some time
try
{
try
{
Thread
.
sleep
(
1000
);
Thread
.
sleep
(
1000
);
...
@@ -869,9 +870,10 @@ public class TestSpatial extends TestBase {
...
@@ -869,9 +870,10 @@ public class TestSpatial extends TestBase {
throw
new
SQLException
(
ex
);
throw
new
SQLException
(
ex
);
}
}
stat
.
execute
(
"drop table if exists pt_cloud;\n"
+
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"
+
" 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;"
);
"shutdown compact;"
);
}
finally
{
}
finally
{
// Close the database
// Close the database
...
...
h2/src/test/org/h2/test/store/TestConcurrent.java
浏览文件 @
65449074
...
@@ -19,7 +19,6 @@ import java.util.concurrent.atomic.AtomicInteger;
...
@@ -19,7 +19,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import
org.h2.mvstore.DataUtils
;
import
org.h2.mvstore.DataUtils
;
import
org.h2.mvstore.MVMap
;
import
org.h2.mvstore.MVMap
;
import
org.h2.mvstore.MVMapConcurrent
;
import
org.h2.mvstore.MVStore
;
import
org.h2.mvstore.MVStore
;
import
org.h2.store.fs.FileChannelInputStream
;
import
org.h2.store.fs.FileChannelInputStream
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.store.fs.FileUtils
;
...
@@ -186,8 +185,7 @@ public class TestConcurrent extends TestMVStore {
...
@@ -186,8 +185,7 @@ public class TestConcurrent extends TestMVStore {
final
MVStore
s
=
new
MVStore
.
Builder
().
final
MVStore
s
=
new
MVStore
.
Builder
().
autoCommitDisabled
().
open
();
autoCommitDisabled
().
open
();
s
.
setVersionsToKeep
(
10
);
s
.
setVersionsToKeep
(
10
);
final
MVMapConcurrent
<
Integer
,
Integer
>
m
=
s
.
openMap
(
"data"
,
final
MVMap
<
Integer
,
Integer
>
m
=
s
.
openMap
(
"data"
);
new
MVMapConcurrent
.
Builder
<
Integer
,
Integer
>());
m
.
put
(
1
,
1
);
m
.
put
(
1
,
1
);
Task
task
=
new
Task
()
{
Task
task
=
new
Task
()
{
@Override
@Override
...
@@ -374,8 +372,7 @@ public class TestConcurrent extends TestMVStore {
...
@@ -374,8 +372,7 @@ public class TestConcurrent extends TestMVStore {
*/
*/
private
void
testConcurrentMap
()
throws
InterruptedException
{
private
void
testConcurrentMap
()
throws
InterruptedException
{
final
MVStore
s
=
openStore
(
null
);
final
MVStore
s
=
openStore
(
null
);
final
MVMap
<
Integer
,
Integer
>
m
=
s
.
openMap
(
"data"
,
final
MVMap
<
Integer
,
Integer
>
m
=
s
.
openMap
(
"data"
);
new
MVMapConcurrent
.
Builder
<
Integer
,
Integer
>());
final
int
size
=
20
;
final
int
size
=
20
;
final
Random
rand
=
new
Random
(
1
);
final
Random
rand
=
new
Random
(
1
);
Task
task
=
new
Task
()
{
Task
task
=
new
Task
()
{
...
...
h2/src/test/org/h2/test/store/TestMVRTree.java
浏览文件 @
65449074
h2/src/test/org/h2/test/store/TestMVStore.java
浏览文件 @
65449074
...
@@ -1278,10 +1278,13 @@ public class TestMVStore extends TestBase {
...
@@ -1278,10 +1278,13 @@ public class TestMVStore extends TestBase {
FileUtils
.
delete
(
fileName
);
FileUtils
.
delete
(
fileName
);
MVStore
s
;
MVStore
s
;
s
=
openStore
(
fileName
);
s
=
openStore
(
fileName
);
s
.
setVersionsToKeep
(
100
);
s
.
setAutoCommitDelay
(
0
);
s
.
setRetentionTime
(
Integer
.
MAX_VALUE
);
s
.
setRetentionTime
(
Integer
.
MAX_VALUE
);
MVMap
<
String
,
String
>
m
;
MVMap
<
String
,
String
>
m
=
s
.
openMap
(
"data"
)
;
m
=
s
.
openMap
(
"data"
);
s
.
commit
(
);
long
first
=
s
.
getCurrentVersion
();
long
first
=
s
.
getCurrentVersion
();
m
.
put
(
"0"
,
"test"
);
s
.
commit
();
s
.
commit
();
m
.
put
(
"1"
,
"Hello"
);
m
.
put
(
"1"
,
"Hello"
);
m
.
put
(
"2"
,
"World"
);
m
.
put
(
"2"
,
"World"
);
...
@@ -1351,11 +1354,13 @@ public class TestMVStore extends TestBase {
...
@@ -1351,11 +1354,13 @@ public class TestMVStore extends TestBase {
long
len
=
FileUtils
.
size
(
fileName
);
long
len
=
FileUtils
.
size
(
fileName
);
s
=
openStore
(
fileName
);
s
=
openStore
(
fileName
);
s
.
setRetentionTime
(
0
);
s
.
setRetentionTime
(
0
);
// remove
50
%
// remove
75
%
m
=
s
.
openMap
(
"data"
);
m
=
s
.
openMap
(
"data"
);
for
(
int
i
=
0
;
i
<
10
;
i
+=
2
)
{
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
if
(
i
%
4
!=
0
)
{
m
.
remove
(
i
);
m
.
remove
(
i
);
}
}
}
s
.
commit
();
s
.
commit
();
assertTrue
(
s
.
compact
(
100
,
50
*
1024
));
assertTrue
(
s
.
compact
(
100
,
50
*
1024
));
s
.
close
();
s
.
close
();
...
...
h2/src/test/org/h2/test/store/TestMVStoreBenchmark.java
浏览文件 @
65449074
...
@@ -146,18 +146,22 @@ public class TestMVStoreBenchmark extends TestBase {
...
@@ -146,18 +146,22 @@ public class TestMVStoreBenchmark extends TestBase {
if
(!
config
.
big
)
{
if
(!
config
.
big
)
{
return
;
return
;
}
}
// -mx12g -agentlib:hprof=heap=sites,depth=8
// int size = 1000;
int
size
=
1000000
;
int
size
=
1000000
;
long
hash
=
0
,
tree
=
0
,
mv
=
0
;
long
hash
=
0
,
tree
=
0
,
mv
=
0
;
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
Map
<
Integer
,
String
>
map
;
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
HashMap
<
Integer
,
String
>(
size
);
// map = new ConcurrentHashMap<Integer, String>(size);
hash
=
testPerformance
(
map
,
size
);
hash
=
testPerformance
(
map
,
size
);
map
=
new
TreeMap
<
Integer
,
String
>();
map
=
new
TreeMap
<
Integer
,
String
>();
// map = new ConcurrentSkipListMap<Integer, String>();
tree
=
testPerformance
(
map
,
size
);
tree
=
testPerformance
(
map
,
size
);
MVStore
store
=
MVStore
.
open
(
null
);
if
(
hash
<
tree
&&
mv
<
tree
*
1.5
)
{
map
=
store
.
openMap
(
"test"
);
mv
=
testPerformance
(
map
,
size
);
if
(
hash
<
tree
&&
mv
<
tree
)
{
break
;
break
;
}
}
}
}
...
...
h2/src/test/org/h2/test/store/TestRandomMapOps.java
浏览文件 @
65449074
...
@@ -11,7 +11,6 @@ import java.util.Random;
...
@@ -11,7 +11,6 @@ import java.util.Random;
import
java.util.TreeMap
;
import
java.util.TreeMap
;
import
org.h2.mvstore.MVMap
;
import
org.h2.mvstore.MVMap
;
import
org.h2.mvstore.MVMapConcurrent
;
import
org.h2.mvstore.MVStore
;
import
org.h2.mvstore.MVStore
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
...
@@ -22,7 +21,6 @@ import org.h2.test.TestBase;
...
@@ -22,7 +21,6 @@ import org.h2.test.TestBase;
public
class
TestRandomMapOps
extends
TestBase
{
public
class
TestRandomMapOps
extends
TestBase
{
private
String
fileName
;
private
String
fileName
;
private
boolean
concurrent
;
private
int
seed
;
private
int
seed
;
private
int
op
;
private
int
op
;
...
@@ -39,9 +37,6 @@ public class TestRandomMapOps extends TestBase {
...
@@ -39,9 +37,6 @@ public class TestRandomMapOps extends TestBase {
@Override
@Override
public
void
test
()
throws
Exception
{
public
void
test
()
throws
Exception
{
concurrent
=
false
;
testMap
(
"memFS:randomOps.h3"
);
concurrent
=
true
;
testMap
(
"memFS:randomOps.h3"
);
testMap
(
"memFS:randomOps.h3"
);
}
}
...
@@ -82,11 +77,7 @@ public class TestRandomMapOps extends TestBase {
...
@@ -82,11 +77,7 @@ public class TestRandomMapOps extends TestBase {
MVStore
s
;
MVStore
s
;
s
=
openStore
(
fileName
);
s
=
openStore
(
fileName
);
MVMap
<
Integer
,
byte
[]>
m
;
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
);
Random
r
=
new
Random
(
seed
);
op
=
0
;
op
=
0
;
TreeMap
<
Integer
,
byte
[]>
map
=
new
TreeMap
<
Integer
,
byte
[]>();
TreeMap
<
Integer
,
byte
[]>
map
=
new
TreeMap
<
Integer
,
byte
[]>();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论