Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
2e98e3f4
提交
2e98e3f4
authored
12月 16, 2014
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More / fixed test cases.
上级
8e7003d9
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
59 行增加
和
11 行删除
+59
-11
TestMemoryUsage.java
h2/src/test/org/h2/test/db/TestMemoryUsage.java
+22
-5
TestOptimizations.java
h2/src/test/org/h2/test/db/TestOptimizations.java
+1
-1
TestSpatial.java
h2/src/test/org/h2/test/db/TestSpatial.java
+29
-0
TestMVStore.java
h2/src/test/org/h2/test/store/TestMVStore.java
+5
-4
TestDiskFull.java
h2/src/test/org/h2/test/synth/TestDiskFull.java
+2
-1
没有找到文件。
h2/src/test/org/h2/test/db/TestMemoryUsage.java
浏览文件 @
2e98e3f4
...
@@ -42,12 +42,14 @@ public class TestMemoryUsage extends TestBase {
...
@@ -42,12 +42,14 @@ public class TestMemoryUsage extends TestBase {
testCreateIndex
();
testCreateIndex
();
testClob
();
testClob
();
testReconnectOften
();
testReconnectOften
();
deleteDb
(
"memoryUsage"
);
deleteDb
(
"memoryUsage"
);
reconnect
();
reconnect
();
insertUpdateSelectDelete
();
insertUpdateSelectDelete
();
reconnect
();
reconnect
();
insertUpdateSelectDelete
();
insertUpdateSelectDelete
();
conn
.
close
();
conn
.
close
();
deleteDb
(
"memoryUsage"
);
deleteDb
(
"memoryUsage"
);
}
}
...
@@ -68,22 +70,37 @@ public class TestMemoryUsage extends TestBase {
...
@@ -68,22 +70,37 @@ public class TestMemoryUsage extends TestBase {
}
}
private
void
testCreateDropLoop
()
throws
SQLException
{
private
void
testCreateDropLoop
()
throws
SQLException
{
deleteDb
(
"memoryUsage"
);
deleteDb
(
"memoryUsage
CreateDropLoop
"
);
conn
=
getConnection
(
"memoryUsage"
);
conn
=
getConnection
(
"memoryUsage
CreateDropLoop
"
);
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
stat
.
execute
(
"CREATE TABLE TEST(ID INT)"
);
stat
.
execute
(
"CREATE TABLE TEST(ID INT)"
);
stat
.
execute
(
"DROP TABLE TEST"
);
stat
.
execute
(
"DROP TABLE TEST"
);
}
}
stat
.
execute
(
"checkpoint"
);
int
used
=
Utils
.
getMemoryUsed
();
int
used
=
Utils
.
getMemoryUsed
();
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
stat
.
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY)"
);
stat
.
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY)"
);
stat
.
execute
(
"DROP TABLE TEST"
);
stat
.
execute
(
"DROP TABLE TEST"
);
}
}
stat
.
execute
(
"checkpoint"
);
int
usedNow
=
Utils
.
getMemoryUsed
();
int
usedNow
=
Utils
.
getMemoryUsed
();
if
(
usedNow
>
used
*
1.3
)
{
// try to lower memory usage (because it might be wrong)
// by forcing OOME
for
(
int
i
=
1024
;;
i
*=
2
)
{
try
{
byte
[]
oome
=
new
byte
[
1024
*
1024
*
256
];
oome
[
0
]
=
(
byte
)
i
;
}
catch
(
OutOfMemoryError
e
)
{
break
;
}
}
usedNow
=
Utils
.
getMemoryUsed
();
if
(
usedNow
>
used
*
1.3
)
{
if
(
usedNow
>
used
*
1.3
)
{
assertEquals
(
used
,
usedNow
);
assertEquals
(
used
,
usedNow
);
}
}
}
conn
.
close
();
conn
.
close
();
}
}
...
@@ -101,8 +118,8 @@ public class TestMemoryUsage extends TestBase {
...
@@ -101,8 +118,8 @@ public class TestMemoryUsage extends TestBase {
if
(
config
.
memory
||
!
config
.
big
)
{
if
(
config
.
memory
||
!
config
.
big
)
{
return
;
return
;
}
}
deleteDb
(
"memoryUsage"
);
deleteDb
(
"memoryUsage
Clob
"
);
conn
=
getConnection
(
"memoryUsage"
);
conn
=
getConnection
(
"memoryUsage
Clob
"
);
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"SET MAX_LENGTH_INPLACE_LOB 8192"
);
stat
.
execute
(
"SET MAX_LENGTH_INPLACE_LOB 8192"
);
stat
.
execute
(
"SET CACHE_SIZE 8000"
);
stat
.
execute
(
"SET CACHE_SIZE 8000"
);
...
...
h2/src/test/org/h2/test/db/TestOptimizations.java
浏览文件 @
2e98e3f4
h2/src/test/org/h2/test/db/TestSpatial.java
浏览文件 @
2e98e3f4
...
@@ -88,6 +88,7 @@ public class TestSpatial extends TestBase {
...
@@ -88,6 +88,7 @@ public class TestSpatial extends TestBase {
testInPlaceUpdate
();
testInPlaceUpdate
();
testScanIndexOnNonSpatialQuery
();
testScanIndexOnNonSpatialQuery
();
testStoreCorruption
();
testStoreCorruption
();
testExplainSpatialIndexWithPk
();
}
}
private
void
testHashCode
()
{
private
void
testHashCode
()
{
...
@@ -881,4 +882,32 @@ public class TestSpatial extends TestBase {
...
@@ -881,4 +882,32 @@ public class TestSpatial extends TestBase {
}
}
deleteDb
(
"spatial"
);
deleteDb
(
"spatial"
);
}
}
private
void
testExplainSpatialIndexWithPk
()
throws
SQLException
{
deleteDb
(
"spatial"
);
Connection
conn
=
getConnection
(
url
);
try
{
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"drop table if exists pt_cloud;"
);
stat
.
execute
(
"CREATE TABLE PT_CLOUD(id serial, the_geom geometry) AS"
+
" SELECT null, CONCAT('POINT(',A.X,' ',B.X,')')::geometry the_geom "
+
"from system_range(0,120) A,system_range(0,10) B;"
);
stat
.
execute
(
"create spatial index on pt_cloud(the_geom);"
);
ResultSet
rs
=
stat
.
executeQuery
(
"explain select * from PT_CLOUD "
+
"where the_geom && 'POINT(1 1)'"
);
try
{
assertTrue
(
rs
.
next
());
assertFalse
(
"H2 should use spatial index got this explain:\n"
+
rs
.
getString
(
1
),
rs
.
getString
(
1
).
contains
(
"tableScan"
));
}
finally
{
rs
.
close
();
}
}
finally
{
// Close the database
conn
.
close
();
}
deleteDb
(
"spatial"
);
}
}
}
h2/src/test/org/h2/test/store/TestMVStore.java
浏览文件 @
2e98e3f4
...
@@ -431,7 +431,7 @@ public class TestMVStore extends TestBase {
...
@@ -431,7 +431,7 @@ public class TestMVStore extends TestBase {
header
.
put
(
"format"
,
"2"
);
header
.
put
(
"format"
,
"2"
);
MVMap
<
Integer
,
String
>
m
=
s
.
openMap
(
"data"
);
MVMap
<
Integer
,
String
>
m
=
s
.
openMap
(
"data"
);
// this is to ensure the file header is overwritten
// this is to ensure the file header is overwritten
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
for
(
int
i
=
0
;
i
<
10
0
;
i
++)
{
m
.
put
(
0
,
"Hello World "
+
i
);
m
.
put
(
0
,
"Hello World "
+
i
);
s
.
commit
();
s
.
commit
();
if
(
i
>
5
)
{
if
(
i
>
5
)
{
...
@@ -445,7 +445,8 @@ public class TestMVStore extends TestBase {
...
@@ -445,7 +445,8 @@ public class TestMVStore extends TestBase {
encryptionKey
(
"007"
.
toCharArray
()).
encryptionKey
(
"007"
.
toCharArray
()).
fileName
(
fileName
).
fileName
(
fileName
).
open
();
open
();
fail
();
header
=
s
.
getStoreHeader
();
fail
(
header
.
toString
());
}
catch
(
IllegalStateException
e
)
{
}
catch
(
IllegalStateException
e
)
{
assertEquals
(
DataUtils
.
ERROR_UNSUPPORTED_FORMAT
,
assertEquals
(
DataUtils
.
ERROR_UNSUPPORTED_FORMAT
,
DataUtils
.
getErrorCode
(
e
.
getMessage
()));
DataUtils
.
getErrorCode
(
e
.
getMessage
()));
...
@@ -480,12 +481,12 @@ public class TestMVStore extends TestBase {
...
@@ -480,12 +481,12 @@ public class TestMVStore extends TestBase {
autoCommitDisabled
().
autoCommitDisabled
().
open
();
open
();
MVMap
<
Integer
,
String
>
m
;
MVMap
<
Integer
,
String
>
m
;
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
for
(
int
i
=
0
;
i
<
10
0
;
i
++)
{
m
=
s
.
openMap
(
"data"
+
i
);
m
=
s
.
openMap
(
"data"
+
i
);
m
.
put
(
0
,
"Hello World"
);
m
.
put
(
0
,
"Hello World"
);
s
.
commit
();
s
.
commit
();
}
}
for
(
int
i
=
0
;
i
<
10
;
i
+=
2
)
{
for
(
int
i
=
0
;
i
<
10
0
;
i
+=
2
)
{
m
=
s
.
openMap
(
"data"
+
i
);
m
=
s
.
openMap
(
"data"
+
i
);
s
.
removeMap
(
m
);
s
.
removeMap
(
m
);
s
.
commit
();
s
.
commit
();
...
...
h2/src/test/org/h2/test/synth/TestDiskFull.java
浏览文件 @
2e98e3f4
...
@@ -93,7 +93,8 @@ public class TestDiskFull extends TestBase {
...
@@ -93,7 +93,8 @@ public class TestDiskFull extends TestBase {
}
catch
(
SQLException
e2
)
{
}
catch
(
SQLException
e2
)
{
if
(
e2
.
getErrorCode
()
!=
ErrorCode
.
IO_EXCEPTION_1
if
(
e2
.
getErrorCode
()
!=
ErrorCode
.
IO_EXCEPTION_1
&&
e2
.
getErrorCode
()
!=
ErrorCode
.
IO_EXCEPTION_2
&&
e2
.
getErrorCode
()
!=
ErrorCode
.
IO_EXCEPTION_2
&&
e2
.
getErrorCode
()
!=
ErrorCode
.
DATABASE_IS_CLOSED
)
{
&&
e2
.
getErrorCode
()
!=
ErrorCode
.
DATABASE_IS_CLOSED
&&
e2
.
getErrorCode
()
!=
ErrorCode
.
OBJECT_CLOSED
)
{
throw
e2
;
throw
e2
;
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论