Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
8221deaa
提交
8221deaa
authored
5月 11, 2010
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
New system property h2.selectForUpdateMvcc, the default is false (the feature is disabled).
上级
08d3f1a5
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
38 行增加
和
8 行删除
+38
-8
changelog.html
h2/src/docsrc/html/changelog.html
+3
-1
roadmap.html
h2/src/docsrc/html/roadmap.html
+6
-4
Select.java
h2/src/main/org/h2/command/dml/Select.java
+9
-2
SysProperties.java
h2/src/main/org/h2/constant/SysProperties.java
+6
-0
RegularTable.java
h2/src/main/org/h2/table/RegularTable.java
+3
-1
TableFilter.java
h2/src/main/org/h2/table/TableFilter.java
+11
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
8221deaa
...
@@ -18,7 +18,9 @@ Change Log
...
@@ -18,7 +18,9 @@ Change Log
<h1>
Change Log
</h1>
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
Profiler: improved message if there was no stack trace.
<ul><li>
New system property h2.selectForUpdateMvcc, the default is false (the feature is disabled).
When enabled, SELECT ... FOR UPDATE only locks the selected rows in the MVCC mode.
</li><li>
Profiler: improved message if there was no stack trace.
</li><li>
The H2 Console can now be used within another application, in a frame or iframe. Issue 197.
</li><li>
The H2 Console can now be used within another application, in a frame or iframe. Issue 197.
</li><li>
Recover tool: the statistics section now includes page type counts again.
</li><li>
Recover tool: the statistics section now includes page type counts again.
</li><li>
Queries with multiple IN(...) conditions sometimes return the wrong results when there was a multi-column index for the column.
</li><li>
Queries with multiple IN(...) conditions sometimes return the wrong results when there was a multi-column index for the column.
...
...
h2/src/docsrc/html/roadmap.html
浏览文件 @
8221deaa
...
@@ -23,9 +23,10 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
...
@@ -23,9 +23,10 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</p>
</p>
<h2>
Version 1.3.x: Planned Changes
</h2>
<h2>
Version 1.3.x: Planned Changes
</h2>
<ul><li>
Lob storage: enable the system property h2.lobInDatabase by default.
<ul><li>
Enable h2.lobInDatabase (store CLOB and BLOB in the database file).
</li><li>
Automatic ANALYZE: set the system property h2.analyzeAuto to 2000.
</li><li>
Set h2.analyzeAuto to 2000 (automatic ANALYZE).
</li><li>
Enable h2.functionsInSchema.
</li><li>
Enable h2.functionsInSchema (allow to store functions in a schema).
</li><li>
Enable h2.selectForUpdateMvcc (MVCC and SELECT FOR UPDATE).
</li></ul>
</li></ul>
<h2>
Priority 1
</h2>
<h2>
Priority 1
</h2>
...
@@ -38,7 +39,6 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
...
@@ -38,7 +39,6 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
<h2>
Priority 2
</h2>
<h2>
Priority 2
</h2>
<ul><li>
Improve test code coverage.
<ul><li>
Improve test code coverage.
</li><li>
MVCC: select for update should only lock the selected rows.
</li><li>
Test multi-threaded in-memory db access
</li><li>
Test multi-threaded in-memory db access
</li><li>
Option to shutdown all the running servers (on the same VM).
</li><li>
Option to shutdown all the running servers (on the same VM).
</li><li>
Full outer joins.
</li><li>
Full outer joins.
...
@@ -468,6 +468,8 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
...
@@ -468,6 +468,8 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>
Database file name suffix: a way to use no or a different suffix (for example using a slash).
</li><li>
Database file name suffix: a way to use no or a different suffix (for example using a slash).
</li><li>
Database file name suffix: should only have one dot by default. Example: .h2db
</li><li>
Database file name suffix: should only have one dot by default. Example: .h2db
</li><li>
Issue 196: Function based indexes
</li><li>
Issue 196: Function based indexes
</li><li>
Fix the disk space leak (killing the process at the exact right moment will increase
the disk space usage; this space is not re-used). See TestDiskSpaceLeak.java
</li></ul>
</li></ul>
<h2>
Not Planned
</h2>
<h2>
Not Planned
</h2>
...
...
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
8221deaa
...
@@ -73,7 +73,7 @@ public class Select extends Query {
...
@@ -73,7 +73,7 @@ public class Select extends Query {
private
HashMap
<
Expression
,
Object
>
currentGroup
;
private
HashMap
<
Expression
,
Object
>
currentGroup
;
private
int
havingIndex
;
private
int
havingIndex
;
private
boolean
isGroupQuery
,
isGroupSortedQuery
;
private
boolean
isGroupQuery
,
isGroupSortedQuery
;
private
boolean
isForUpdate
;
private
boolean
isForUpdate
,
isForUpdateMvcc
;
private
double
cost
;
private
double
cost
;
private
boolean
isQuickAggregateQuery
,
isDistinctQuery
;
private
boolean
isQuickAggregateQuery
,
isDistinctQuery
;
private
boolean
isPrepared
,
checkInit
;
private
boolean
isPrepared
,
checkInit
;
...
@@ -492,6 +492,9 @@ public class Select extends Query {
...
@@ -492,6 +492,9 @@ public class Select extends Query {
Expression
expr
=
expressions
.
get
(
i
);
Expression
expr
=
expressions
.
get
(
i
);
row
[
i
]
=
expr
.
getValue
(
session
);
row
[
i
]
=
expr
.
getValue
(
session
);
}
}
if
(
isForUpdateMvcc
)
{
topTableFilter
.
lockRow
();
}
result
.
addRow
(
row
);
result
.
addRow
(
row
);
rowNumber
++;
rowNumber
++;
if
((
sort
==
null
||
sortUsingIndex
)
&&
limitRows
!=
0
&&
result
.
getRowCount
()
>=
limitRows
)
{
if
((
sort
==
null
||
sortUsingIndex
)
&&
limitRows
!=
0
&&
result
.
getRowCount
()
>=
limitRows
)
{
...
@@ -539,7 +542,8 @@ public class Select extends Query {
...
@@ -539,7 +542,8 @@ public class Select extends Query {
}
}
topTableFilter
.
startQuery
(
session
);
topTableFilter
.
startQuery
(
session
);
topTableFilter
.
reset
();
topTableFilter
.
reset
();
topTableFilter
.
lock
(
session
,
isForUpdate
,
isForUpdate
);
boolean
exclusive
=
isForUpdate
&&
!
isForUpdateMvcc
;
topTableFilter
.
lock
(
session
,
exclusive
,
exclusive
);
if
(
isQuickAggregateQuery
)
{
if
(
isQuickAggregateQuery
)
{
queryQuick
(
columnCount
,
result
);
queryQuick
(
columnCount
,
result
);
}
else
if
(
isGroupQuery
)
{
}
else
if
(
isGroupQuery
)
{
...
@@ -962,6 +966,9 @@ public class Select extends Query {
...
@@ -962,6 +966,9 @@ public class Select extends Query {
public
void
setForUpdate
(
boolean
b
)
{
public
void
setForUpdate
(
boolean
b
)
{
this
.
isForUpdate
=
b
;
this
.
isForUpdate
=
b
;
if
(
SysProperties
.
SELECT_FOR_UPDATE_MVCC
&&
session
.
getDatabase
().
isMultiVersion
())
{
isForUpdateMvcc
=
b
;
}
}
}
public
void
mapColumns
(
ColumnResolver
resolver
,
int
level
)
{
public
void
mapColumns
(
ColumnResolver
resolver
,
int
level
)
{
...
...
h2/src/main/org/h2/constant/SysProperties.java
浏览文件 @
8221deaa
...
@@ -526,6 +526,12 @@ public class SysProperties {
...
@@ -526,6 +526,12 @@ public class SysProperties {
*/
*/
public
static
boolean
runFinalize
=
getBooleanSetting
(
"h2.runFinalize"
,
true
);
public
static
boolean
runFinalize
=
getBooleanSetting
(
"h2.runFinalize"
,
true
);
/**
* System property <code>h2.selectForUpdateMvcc</code> (default: false).<br />
* If set, SELECT .. FOR UPDATE queries lock the rows when using MVCC.
*/
public
static
final
boolean
SELECT_FOR_UPDATE_MVCC
=
getBooleanSetting
(
"h2.selectForUpdateMvcc"
,
false
);
/**
/**
* System property <code>h2.serverCachedObjects</code> (default: 64).<br />
* System property <code>h2.serverCachedObjects</code> (default: 64).<br />
* TCP Server: number of cached objects per session.
* TCP Server: number of cached objects per session.
...
...
h2/src/main/org/h2/table/RegularTable.java
浏览文件 @
8221deaa
...
@@ -385,7 +385,9 @@ public class RegularTable extends TableBase {
...
@@ -385,7 +385,9 @@ public class RegularTable extends TableBase {
}
}
if
(!
force
&&
database
.
isMultiVersion
())
{
if
(!
force
&&
database
.
isMultiVersion
())
{
// MVCC: update, delete, and insert use a shared lock.
// MVCC: update, delete, and insert use a shared lock.
// Select doesn't lock
// Select doesn't lock except when using FOR UPDATE and
// the system property h2.selectForUpdateMvcc
// is not enabled
if
(
exclusive
)
{
if
(
exclusive
)
{
exclusive
=
false
;
exclusive
=
false
;
}
else
{
}
else
{
...
...
h2/src/main/org/h2/table/TableFilter.java
浏览文件 @
8221deaa
...
@@ -718,4 +718,15 @@ public class TableFilter implements ColumnResolver {
...
@@ -718,4 +718,15 @@ public class TableFilter implements ColumnResolver {
return
false
;
return
false
;
}
}
public
void
lockRow
()
{
if
(
state
==
FOUND
)
{
Row
row
=
get
();
table
.
removeRow
(
session
,
row
);
table
.
addRow
(
session
,
row
);
if
(
join
!=
null
)
{
join
.
lockRow
();
}
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论