Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
7a60c09e
Unverified
提交
7a60c09e
authored
1月 25, 2019
作者:
Evgenij Ryazanov
提交者:
GitHub
1月 25, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1692 from katzyn/external
Use MVTempResult unconditionally
上级
db3622d0
9d327f32
全部展开
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
77 行增加
和
362 行删除
+77
-362
MVPlainTempResult.java
h2/src/main/org/h2/mvstore/db/MVPlainTempResult.java
+2
-2
LocalResultImpl.java
h2/src/main/org/h2/result/LocalResultImpl.java
+2
-6
ResultTempTable.java
h2/src/main/org/h2/result/ResultTempTable.java
+0
-354
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+2
-0
TestMVTempResult.java
h2/src/test/org/h2/test/unit/TestMVTempResult.java
+71
-0
没有找到文件。
h2/src/main/org/h2/mvstore/db/MVPlainTempResult.java
浏览文件 @
7a60c09e
...
@@ -62,14 +62,14 @@ class MVPlainTempResult extends MVTempResult {
...
@@ -62,14 +62,14 @@ class MVPlainTempResult extends MVTempResult {
super
(
database
,
expressions
.
length
,
visibleColumnCount
);
super
(
database
,
expressions
.
length
,
visibleColumnCount
);
ValueDataType
valueType
=
new
ValueDataType
(
database
,
new
int
[
columnCount
]);
ValueDataType
valueType
=
new
ValueDataType
(
database
,
new
int
[
columnCount
]);
Builder
<
Long
,
ValueRow
>
builder
=
new
MVMap
.
Builder
<
Long
,
ValueRow
>()
Builder
<
Long
,
ValueRow
>
builder
=
new
MVMap
.
Builder
<
Long
,
ValueRow
>()
.
valueType
(
valueType
)
.
singleWriter
()
;
.
valueType
(
valueType
);
map
=
store
.
openMap
(
"tmp"
,
builder
);
map
=
store
.
openMap
(
"tmp"
,
builder
);
}
}
@Override
@Override
public
int
addRow
(
Value
[]
values
)
{
public
int
addRow
(
Value
[]
values
)
{
assert
parent
==
null
;
assert
parent
==
null
;
map
.
append
(
counter
++,
ValueRow
.
get
(
values
));
map
.
put
(
counter
++,
ValueRow
.
get
(
values
));
return
++
rowCount
;
return
++
rowCount
;
}
}
...
...
h2/src/main/org/h2/result/LocalResultImpl.java
浏览文件 @
7a60c09e
...
@@ -301,12 +301,8 @@ public class LocalResultImpl implements LocalResult {
...
@@ -301,12 +301,8 @@ public class LocalResultImpl implements LocalResult {
}
}
private
void
createExternalResult
()
{
private
void
createExternalResult
()
{
Database
database
=
session
.
getDatabase
();
external
=
MVTempResult
.
of
(
session
.
getDatabase
(),
expressions
,
distinct
,
distinctIndexes
,
visibleColumnCount
,
external
=
database
.
isMVStore
()
sort
);
||
/* not supported by ResultTempTable */
distinct
&&
expressions
.
length
!=
visibleColumnCount
||
distinctIndexes
!=
null
?
MVTempResult
.
of
(
database
,
expressions
,
distinct
,
distinctIndexes
,
visibleColumnCount
,
sort
)
:
new
ResultTempTable
(
session
,
expressions
,
distinct
,
sort
);
}
}
/**
/**
...
...
h2/src/main/org/h2/result/ResultTempTable.java
deleted
100644 → 0
浏览文件 @
db3622d0
差异被折叠。
点击展开。
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
7a60c09e
...
@@ -200,6 +200,7 @@ import org.h2.test.unit.TestJmx;
...
@@ -200,6 +200,7 @@ import org.h2.test.unit.TestJmx;
import
org.h2.test.unit.TestKeywords
;
import
org.h2.test.unit.TestKeywords
;
import
org.h2.test.unit.TestLocalResultFactory
;
import
org.h2.test.unit.TestLocalResultFactory
;
import
org.h2.test.unit.TestLocale
;
import
org.h2.test.unit.TestLocale
;
import
org.h2.test.unit.TestMVTempResult
;
import
org.h2.test.unit.TestMathUtils
;
import
org.h2.test.unit.TestMathUtils
;
import
org.h2.test.unit.TestMemoryUnmapper
;
import
org.h2.test.unit.TestMemoryUnmapper
;
import
org.h2.test.unit.TestMode
;
import
org.h2.test.unit.TestMode
;
...
@@ -960,6 +961,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
...
@@ -960,6 +961,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
addTest
(
new
TestSpinLock
());
addTest
(
new
TestSpinLock
());
addTest
(
new
TestStreamStore
());
addTest
(
new
TestStreamStore
());
addTest
(
new
TestTransactionStore
());
addTest
(
new
TestTransactionStore
());
addTest
(
new
TestMVTempResult
());
// unit
// unit
addTest
(
new
TestAnsCompression
());
addTest
(
new
TestAnsCompression
());
...
...
h2/src/test/org/h2/test/unit/TestMVTempResult.java
0 → 100644
浏览文件 @
7a60c09e
/*
* Copyright 2004-2019 H2 Group. Multiple-Licensed under the MPL 2.0,
* and the EPL 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
test
.
unit
;
import
java.lang.ProcessBuilder.Redirect
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.h2.test.TestBase
;
import
org.h2.tools.DeleteDbFiles
;
/**
* Tests that MVTempResult implementations do not produce OOME.
*/
public
class
TestMVTempResult
extends
TestBase
{
private
static
final
int
MEMORY
=
128
;
private
static
final
int
ROWS
=
1_000_000
;
/**
* May be used to run only this test and may be launched by this test in a
* subprocess.
*
* @param a
* if empty run this test, if not empty run the subprocess
*/
public
static
void
main
(
String
...
a
)
throws
Exception
{
TestMVTempResult
test
=
(
TestMVTempResult
)
TestBase
.
createCaller
().
init
();
if
(
a
.
length
==
0
)
{
test
.
test
();
}
else
{
test
.
runTest
();
}
}
@Override
public
void
test
()
throws
Exception
{
ProcessBuilder
pb
=
new
ProcessBuilder
().
redirectError
(
Redirect
.
INHERIT
);
pb
.
command
(
getJVM
(),
"-Xmx"
+
MEMORY
+
"M"
,
"-cp"
,
getClassPath
(),
"-ea"
,
getClass
().
getName
(),
"dummy"
);
assertEquals
(
0
,
pb
.
start
().
waitFor
());
}
private
void
runTest
()
throws
SQLException
{
String
dir
=
getBaseDir
();
String
name
=
"testResultExternal"
;
DeleteDbFiles
.
execute
(
dir
,
name
,
true
);
try
(
Connection
c
=
DriverManager
.
getConnection
(
"jdbc:h2:"
+
dir
+
'/'
+
name
))
{
Statement
s
=
c
.
createStatement
();
try
(
ResultSet
rs
=
s
.
executeQuery
(
"SELECT X, RAND() R FROM SYSTEM_RANGE(1, "
+
ROWS
+
") ORDER BY R"
))
{
for
(
int
i
=
1
;
i
<=
ROWS
;
i
++)
{
assertTrue
(
rs
.
next
());
}
}
try
(
ResultSet
rs
=
s
.
executeQuery
(
"SELECT X, RAND() FROM SYSTEM_RANGE(1, "
+
ROWS
+
')'
))
{
for
(
int
i
=
1
;
i
<=
ROWS
;
i
++)
{
assertTrue
(
rs
.
next
());
assertEquals
(
i
,
rs
.
getLong
(
1
));
}
}
}
DeleteDbFiles
.
execute
(
dir
,
name
,
true
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论