Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
542100a4
Unverified
提交
542100a4
authored
5月 10, 2018
作者:
Evgenij Ryazanov
提交者:
GitHub
5月 10, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1126 from katzyn/misc
Fix an issue with code coverage and building of documentation
上级
96883799
2aaf41be
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
82 行增加
和
46 行删除
+82
-46
changelog.html
h2/src/docsrc/html/changelog.html
+34
-0
Insert.java
h2/src/main/org/h2/command/dml/Insert.java
+1
-1
Select.java
h2/src/main/org/h2/command/dml/Select.java
+7
-4
Database.java
h2/src/main/org/h2/engine/Database.java
+2
-1
Aggregate.java
h2/src/main/org/h2/expression/Aggregate.java
+2
-2
PageDataIndex.java
h2/src/main/org/h2/index/PageDataIndex.java
+4
-3
RegularTable.java
h2/src/main/org/h2/table/RegularTable.java
+2
-2
ValueHashMap.java
h2/src/main/org/h2/util/ValueHashMap.java
+4
-4
TestBigResult.java
h2/src/test/org/h2/test/db/TestBigResult.java
+23
-27
TestScript.java
h2/src/test/org/h2/test/scripts/TestScript.java
+2
-2
dictionary.txt
h2/src/tools/org/h2/build/doc/dictionary.txt
+1
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
542100a4
...
...
@@ -21,12 +21,38 @@ Change Log
<h2>
Next Version (unreleased)
</h2>
<ul>
<li>
PR #1126: Fix an issue with code coverage and building of documentation
</li>
<li>
PR #1123: Fix TCP version check
</li>
<li>
PR #1122: Assorted changes
</li>
<li>
PR #1121: Add some protection to ValueHashMap against hashes with the same less significant bits
</li>
<li>
Issue #1097: H2 10x slower than HSQLDB and 6x than Apache Derby for specific query with GROUP BY and DISTINCT subquery
</li>
<li>
Issue #1093: Use temporary files for ResultSet buffer tables in MVStore
</li>
<li>
PR #1117: Fix sorting with distinct in ResultTempTable
</li>
<li>
Issue #1095: Add support for INSERT IGNORE INTO
<
table
>
(
<
columns
>
) SELECT in MySQL Mode
</li>
<li>
PR #1114: Minor cleanup and formatting fixes
</li>
<li>
PR #1112: Improve test scripts
</li>
<li>
PR #1111: Use a better fix for issue with SRID
</li>
<li>
Issue #1107: Restore support of DATETIME2 with specified fractional seconds precision
</li>
<li>
Issue #1106: Get rid of SwitchSource
</li>
<li>
PR #1105: Assorted minor changes
</li>
<li>
Issue #1102: CREATE SYNONYM rejects valid definition
</li>
<li>
PR #1103: Remove redundant synchronization
</li>
<li>
Issue #1048: 1.4.197 regression. org.h2.jdbc.JdbcSQLException: Timeout trying to lock table "SYS"
</li>
<li>
PR #1101: Move some tests in better place and add an additional test for 2PC
...
...
@@ -43,8 +69,16 @@ Change Log
</li>
<li>
PR #1087: improve performance of planning large queries
</li>
<li>
PR #1085: Add tests for simple one-column index sorting
</li>
<li>
PR #1084: re-enable some pagestore testing
</li>
<li>
PR #1083: Assorted changes
</li>
<li>
Issue #394: Recover tool places COLLATION and BINARY_COLLATION after temporary tables
</li>
<li>
PR #1081: Session.getTransactionId should return a more distinguishing value
</li>
<li>
Improve the script-based unit testing to check the error code of the exception thrown.
</li>
<li>
Issue #1041: Support OR syntax while creating trigger
...
...
h2/src/main/org/h2/command/dml/Insert.java
浏览文件 @
542100a4
...
...
@@ -394,7 +394,7 @@ public class Insert extends Prepared implements ResultTarget {
ArrayList
<
String
>
variableNames
=
new
ArrayList
<>(
duplicateKeyAssignmentMap
.
size
());
Expression
[]
row
=
(
currentRow
==
null
)
?
list
.
get
(
getCurrentRowNumber
()
-
1
)
Expression
[]
row
=
(
currentRow
==
null
)
?
list
.
get
(
getCurrentRowNumber
()
-
1
)
:
new
Expression
[
columns
.
length
];
for
(
int
i
=
0
;
i
<
columns
.
length
;
i
++)
{
String
key
=
table
.
getSchema
().
getName
()
+
"."
+
...
...
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
542100a4
...
...
@@ -106,7 +106,8 @@ public class Select extends Query {
*/
Object
[]
currentGroupByExprData
;
/**
* Maps an expression object to an index, to use in accessing the Object[] pointed to by groupByData.
* Maps an expression object to an index, to use in accessing the Object[]
* pointed to by groupByData.
*/
final
HashMap
<
Expression
,
Integer
>
exprToIndexInGroupByData
=
new
HashMap
<>();
/**
...
...
@@ -117,7 +118,7 @@ public class Select extends Query {
* Key into groupByData that produces currentGroupByExprData. Not used in lazy mode.
*/
ValueArray
currentGroupsKey
;
private
int
havingIndex
;
private
boolean
isGroupQuery
,
isGroupSortedQuery
;
private
boolean
isForUpdate
,
isForUpdateMvcc
;
...
...
@@ -1580,11 +1581,13 @@ public class Select extends Query {
Value
[]
row
=
null
;
if
(
previousKeyValues
==
null
)
{
previousKeyValues
=
keyValues
;
currentGroupByExprData
=
new
Object
[
Math
.
max
(
exprToIndexInGroupByData
.
size
(),
expressions
.
size
())];
currentGroupByExprData
=
new
Object
[
Math
.
max
(
exprToIndexInGroupByData
.
size
(),
expressions
.
size
())];
}
else
if
(!
Arrays
.
equals
(
previousKeyValues
,
keyValues
))
{
row
=
createGroupSortedRow
(
previousKeyValues
,
columnCount
);
previousKeyValues
=
keyValues
;
currentGroupByExprData
=
new
Object
[
Math
.
max
(
exprToIndexInGroupByData
.
size
(),
expressions
.
size
())];
currentGroupByExprData
=
new
Object
[
Math
.
max
(
exprToIndexInGroupByData
.
size
(),
expressions
.
size
())];
}
currentGroupRowId
++;
...
...
h2/src/main/org/h2/engine/Database.java
浏览文件 @
542100a4
...
...
@@ -934,7 +934,8 @@ public class Database implements DataHandler {
}
if
(
SysProperties
.
CHECK2
)
{
// If we are locking two different databases in the same stack, just ignore it.
// This only happens in TestLinkedTable where we connect to another h2 DB in the same process.
// This only happens in TestLinkedTable where we connect to another h2 DB in the
// same process.
if
(
META_LOCK_DEBUGGING_DB
.
get
()
!=
null
&&
META_LOCK_DEBUGGING_DB
.
get
()
!=
this
)
{
final
Session
prev
=
META_LOCK_DEBUGGING
.
get
();
...
...
h2/src/main/org/h2/expression/Aggregate.java
浏览文件 @
542100a4
...
...
@@ -371,8 +371,8 @@ public class Aggregate extends Expression {
DbException
.
throwInternalError
(
"type="
+
type
);
}
}
if
(!
select
.
isCurrentGroup
())
{
throw
DbException
.
get
(
ErrorCode
.
INVALID_USE_OF_AGGREGATE_FUNCTION_1
,
getSQL
());
if
(!
select
.
isCurrentGroup
())
{
throw
DbException
.
get
(
ErrorCode
.
INVALID_USE_OF_AGGREGATE_FUNCTION_1
,
getSQL
());
}
AggregateData
data
=
(
AggregateData
)
select
.
getCurrentGroupExprData
(
this
);
if
(
data
==
null
)
{
...
...
h2/src/main/org/h2/index/PageDataIndex.java
浏览文件 @
542100a4
...
...
@@ -312,9 +312,10 @@ public class PageDataIndex extends PageIndex {
public
double
getCost
(
Session
session
,
int
[]
masks
,
TableFilter
[]
filters
,
int
filter
,
SortOrder
sortOrder
,
AllColumnsForPlan
allColumnsSet
)
{
// The +200 is so that indexes that can return the same data, but have less columns, will take precedence.
// This all works out easier in the MVStore case, because MVStore uses the same cost calculation
// code for the ScanIndex (i.e. the MVPrimaryIndex) and all other indices.
// The +200 is so that indexes that can return the same data, but have less
// columns, will take precedence. This all works out easier in the MVStore case,
// because MVStore uses the same cost calculation code for the ScanIndex (i.e.
// the MVPrimaryIndex) and all other indices.
return
10
*
(
tableData
.
getRowCountApproximation
()
+
Constants
.
COST_ROW_OFFSET
)
+
200
;
}
...
...
h2/src/main/org/h2/table/RegularTable.java
浏览文件 @
542100a4
...
...
@@ -459,8 +459,8 @@ public class RegularTable extends TableBase {
return
true
;
}
if
(!
exclusive
&&
lockSharedSessions
.
containsKey
(
session
))
{
return
true
;
}
return
true
;
}
synchronized
(
database
)
{
if
(!
exclusive
&&
lockSharedSessions
.
contains
(
session
))
{
return
true
;
...
...
h2/src/main/org/h2/util/ValueHashMap.java
浏览文件 @
542100a4
...
...
@@ -192,11 +192,11 @@ public class ValueHashMap<V> extends HashBase {
}
return
list
;
}
public
Iterable
<
Map
.
Entry
<
Value
,
V
>>
entries
()
{
return
new
EntryIterable
();
}
private
final
class
EntryIterable
implements
Iterable
<
Map
.
Entry
<
Value
,
V
>>
{
EntryIterable
()
{
}
...
...
@@ -228,10 +228,10 @@ public class ValueHashMap<V> extends HashBase {
keysIndex
++;
Value
key
=
keys
[
keysIndex
];
if
(
key
!=
null
&&
key
!=
ValueNull
.
DELETED
)
return
new
AbstractMap
.
SimpleImmutableEntry
<
Value
,
V
>(
key
,
values
[
keysIndex
]);
return
new
AbstractMap
.
SimpleImmutableEntry
<>(
key
,
values
[
keysIndex
]);
}
}
@Override
public
void
remove
()
{
throw
new
UnsupportedOperationException
();
...
...
h2/src/test/org/h2/test/db/TestBigResult.java
浏览文件 @
542100a4
...
...
@@ -28,7 +28,8 @@ public class TestBigResult extends TestBase {
/**
* Run just this test.
*
* @param a ignored
* @param a
* ignored
*/
public
static
void
main
(
String
...
a
)
throws
Exception
{
TestBase
.
createCaller
().
init
().
test
();
...
...
@@ -56,13 +57,11 @@ public class TestBigResult extends TestBase {
int
len
=
getSize
(
1000
,
4000
);
stat
.
execute
(
"SET MAX_MEMORY_ROWS "
+
(
len
/
10
));
stat
.
execute
(
"CREATE TABLE RECOVERY(TRANSACTION_ID INT, SQL_STMT VARCHAR)"
);
stat
.
execute
(
"INSERT INTO RECOVERY "
+
"SELECT X, CASE MOD(X, 2) WHEN 0 THEN 'commit' ELSE 'begin' END "
+
"FROM SYSTEM_RANGE(1, "
+
len
+
")"
);
ResultSet
rs
=
stat
.
executeQuery
(
"SELECT * FROM RECOVERY "
+
"WHERE SQL_STMT LIKE 'begin%' AND "
+
"TRANSACTION_ID NOT IN(SELECT TRANSACTION_ID FROM RECOVERY "
+
"WHERE SQL_STMT='commit' OR SQL_STMT='rollback')"
);
stat
.
execute
(
"INSERT INTO RECOVERY "
+
"SELECT X, CASE MOD(X, 2) WHEN 0 THEN 'commit' ELSE 'begin' END "
+
"FROM SYSTEM_RANGE(1, "
+
len
+
")"
);
ResultSet
rs
=
stat
.
executeQuery
(
"SELECT * FROM RECOVERY "
+
"WHERE SQL_STMT LIKE 'begin%' AND "
+
"TRANSACTION_ID NOT IN(SELECT TRANSACTION_ID FROM RECOVERY "
+
"WHERE SQL_STMT='commit' OR SQL_STMT='rollback')"
);
int
count
=
0
,
last
=
1
;
while
(
rs
.
next
())
{
assertEquals
(
last
,
rs
.
getInt
(
1
));
...
...
@@ -86,9 +85,9 @@ public class TestBigResult extends TestBase {
ps
.
executeUpdate
();
}
// local result
testSortin
t
AndDistinct1
(
stat
,
count
,
count
);
testSortin
g
AndDistinct1
(
stat
,
count
,
count
);
// external result
testSortin
t
AndDistinct1
(
stat
,
10
,
count
);
testSortin
g
AndDistinct1
(
stat
,
10
,
count
);
stat
.
execute
(
"DROP TABLE TEST"
);
stat
.
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY, VALUE1 INT NOT NULL, VALUE2 INT NOT NULL)"
);
ps
=
conn
.
prepareStatement
(
"INSERT INTO TEST VALUES (?, ?, ?)"
);
...
...
@@ -182,7 +181,7 @@ public class TestBigResult extends TestBase {
conn
.
close
();
}
private
void
testSortin
t
AndDistinct1
(
Statement
stat
,
int
maxRows
,
int
count
)
throws
SQLException
{
private
void
testSortin
g
AndDistinct1
(
Statement
stat
,
int
maxRows
,
int
count
)
throws
SQLException
{
stat
.
execute
(
"SET MAX_MEMORY_ROWS "
+
maxRows
);
ResultSet
rs
=
stat
.
executeQuery
(
"SELECT VALUE FROM (SELECT DISTINCT ID, VALUE FROM TEST ORDER BY VALUE)"
);
for
(
int
i
=
1
;
i
<=
count
;
i
++)
{
...
...
@@ -209,7 +208,8 @@ public class TestBigResult extends TestBase {
assertFalse
(
rs
.
next
());
}
private
void
testSortingAndDistinct2DistinctOnly
(
Statement
stat
,
String
sql
,
int
maxRows
,
int
partCount
)
throws
SQLException
{
private
void
testSortingAndDistinct2DistinctOnly
(
Statement
stat
,
String
sql
,
int
maxRows
,
int
partCount
)
throws
SQLException
{
ResultSet
rs
;
stat
.
execute
(
"SET MAX_MEMORY_ROWS "
+
maxRows
);
rs
=
stat
.
executeQuery
(
sql
);
...
...
@@ -235,7 +235,8 @@ public class TestBigResult extends TestBase {
assertFalse
(
rs
.
next
());
}
private
void
testSortingAndDistinct3DistinctOnly
(
Statement
stat
,
String
sql
,
int
maxRows
,
int
partCount
)
throws
SQLException
{
private
void
testSortingAndDistinct3DistinctOnly
(
Statement
stat
,
String
sql
,
int
maxRows
,
int
partCount
)
throws
SQLException
{
ResultSet
rs
;
stat
.
execute
(
"SET MAX_MEMORY_ROWS "
+
maxRows
);
rs
=
stat
.
executeQuery
(
sql
);
...
...
@@ -261,7 +262,8 @@ public class TestBigResult extends TestBase {
assertFalse
(
rs
.
next
());
}
private
void
testSortingAndDistinct4DistinctOnly
(
Statement
stat
,
String
sql
,
int
maxRows
,
int
count
)
throws
SQLException
{
private
void
testSortingAndDistinct4DistinctOnly
(
Statement
stat
,
String
sql
,
int
maxRows
,
int
count
)
throws
SQLException
{
stat
.
execute
(
"SET MAX_MEMORY_ROWS "
+
maxRows
);
ResultSet
rs
=
stat
.
executeQuery
(
sql
);
BitSet
set
=
new
BitSet
();
...
...
@@ -278,7 +280,8 @@ public class TestBigResult extends TestBase {
assertEquals
(
count
,
set
.
nextClearBit
(
0
));
}
private
void
testSortingAndDistinct4SortingOnly
(
Statement
stat
,
String
sql
,
int
maxRows
,
int
count
)
throws
SQLException
{
private
void
testSortingAndDistinct4SortingOnly
(
Statement
stat
,
String
sql
,
int
maxRows
,
int
count
)
throws
SQLException
{
stat
.
execute
(
"SET MAX_MEMORY_ROWS "
+
maxRows
);
ResultSet
rs
=
stat
.
executeQuery
(
sql
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
...
...
@@ -377,8 +380,7 @@ public class TestBigResult extends TestBase {
// rs.close();
conn
.
close
();
deleteDb
(
"bigResult"
);
ArrayList
<
String
>
files
=
FileLister
.
getDatabaseFiles
(
getBaseDir
(),
"bigResult"
,
true
);
ArrayList
<
String
>
files
=
FileLister
.
getDatabaseFiles
(
getBaseDir
(),
"bigResult"
,
true
);
if
(
files
.
size
()
>
0
)
{
fail
(
"file not deleted: "
+
files
.
get
(
0
));
}
...
...
@@ -415,15 +417,10 @@ public class TestBigResult extends TestBase {
Connection
conn
=
getConnection
(
"bigResult"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"DROP TABLE IF EXISTS TEST"
);
stat
.
execute
(
"CREATE TABLE TEST("
+
"ID INT PRIMARY KEY, "
+
"Name VARCHAR(255), "
+
"FirstName VARCHAR(255), "
+
"Points INT,"
+
"LicenseID INT)"
);
stat
.
execute
(
"CREATE TABLE TEST("
+
"ID INT PRIMARY KEY, "
+
"Name VARCHAR(255), "
+
"FirstName VARCHAR(255), "
+
"Points INT,"
+
"LicenseID INT)"
);
int
len
=
getSize
(
10
,
5000
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST VALUES(?, ?, ?, ?, ?)"
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST VALUES(?, ?, ?, ?, ?)"
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
prep
.
setInt
(
1
,
i
);
prep
.
setString
(
2
,
"Name "
+
i
);
...
...
@@ -474,8 +471,7 @@ public class TestBigResult extends TestBase {
prep
.
setString
(
2
,
""
+
i
/
200
);
prep
.
execute
();
}
Statement
s2
=
conn
.
createStatement
(
ResultSet
.
TYPE_SCROLL_INSENSITIVE
,
ResultSet
.
CONCUR_UPDATABLE
);
Statement
s2
=
conn
.
createStatement
(
ResultSet
.
TYPE_SCROLL_INSENSITIVE
,
ResultSet
.
CONCUR_UPDATABLE
);
rs
=
s2
.
executeQuery
(
"SELECT NAME FROM DATA"
);
rs
.
last
();
conn
.
setAutoCommit
(
true
);
...
...
h2/src/test/org/h2/test/scripts/TestScript.java
浏览文件 @
542100a4
...
...
@@ -492,11 +492,11 @@ public class TestScript extends TestBase {
}
/** Convert the error code to a symbolic name from ErrorCode. */
private
static
final
Map
<
Integer
,
String
>
ERROR_CODE_TO_NAME
=
new
HashMap
<>();
private
static
final
Map
<
Integer
,
String
>
ERROR_CODE_TO_NAME
=
new
HashMap
<>(
256
);
static
{
try
{
for
(
Field
field
:
ErrorCode
.
class
.
getDeclaredFields
())
{
if
(
Modifier
.
isStatic
(
field
.
getModifiers
()
))
{
if
(
field
.
getModifiers
()
==
(
Modifier
.
PUBLIC
|
Modifier
.
STATIC
|
Modifier
.
FINAL
))
{
ERROR_CODE_TO_NAME
.
put
(
field
.
getInt
(
null
),
field
.
getName
());
}
}
...
...
h2/src/tools/org/h2/build/doc/dictionary.txt
浏览文件 @
542100a4
...
...
@@ -775,3 +775,4 @@ iterators tech enums incompatibilities loses reimplement readme reorganize milli
geometries sourceschema destschema generatedcolumn alphanumerically usages
sizable instantiates renders sdt txcommit unhelpful optimiser treats rejects referring untrusted computes vacate inverted
reordered colliding evgenij archaic invocations apostrophe hypothetically testref ryazanov useless completes highlighting tends degrade
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论