Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
c937b4b4
提交
c937b4b4
authored
10 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prepare release
上级
e8c85730
master
noel-pr1
plus33-master
pr/267
stumc-Issue#576
version-1.4.198
version-1.4.197
version-1.4.196
version-1.4.195
version-1.4.194
version-1.4.193
version-1.4.192
version-1.4.191
version-1.4.190
version-1.4.188
version-1.4.187
version-1.4.186
version-1.4.185
version-1.4.184
version-1.4.183
version-1.4.182
version-1.4.181
无相关合并请求
全部展开
显示空白字符变更
内嵌
并排
正在显示
19 个修改的文件
包含
1041 行增加
和
868 行删除
+1041
-868
changelog.html
h2/src/docsrc/html/changelog.html
+8
-4
_docs_en.utf8.txt
h2/src/docsrc/text/_docs_en.utf8.txt
+278
-269
_docs_ja.utf8.txt
h2/src/docsrc/text/_docs_ja.utf8.txt
+294
-285
_docs_en.properties
h2/src/docsrc/textbase/_docs_en.properties
+272
-269
Constants.java
h2/src/main/org/h2/engine/Constants.java
+2
-2
Chunk.java
h2/src/main/org/h2/mvstore/Chunk.java
+1
-1
ConcurrentLinkedList.java
h2/src/main/org/h2/mvstore/ConcurrentLinkedList.java
+46
-8
MVMap.java
h2/src/main/org/h2/mvstore/MVMap.java
+8
-3
MVStore.java
h2/src/main/org/h2/mvstore/MVStore.java
+1
-1
Page.java
h2/src/main/org/h2/mvstore/Page.java
+8
-0
MVTable.java
h2/src/main/org/h2/mvstore/db/MVTable.java
+8
-4
RegularTable.java
h2/src/main/org/h2/table/RegularTable.java
+7
-3
newsfeed.sql
h2/src/test/org/h2/samples/newsfeed.sql
+1
-0
TestCluster.java
h2/src/test/org/h2/test/db/TestCluster.java
+3
-3
TestConcurrentLinkedList.java
h2/src/test/org/h2/test/store/TestConcurrentLinkedList.java
+4
-4
TestMVStoreTool.java
h2/src/test/org/h2/test/store/TestMVStoreTool.java
+2
-2
dictionary.txt
h2/src/tools/org/h2/build/doc/dictionary.txt
+1
-1
ConcurrentLinkedListWithTail.java
...c/tools/org/h2/dev/util/ConcurrentLinkedListWithTail.java
+43
-4
ConcurrentRing.java
h2/src/tools/org/h2/dev/util/ConcurrentRing.java
+54
-5
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
c937b4b4
...
...
@@ -17,6 +17,10 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
-
</li></ul>
<h2>
Version 1.4.180 Beta (2014-07-13)
</h2>
<ul><li>
MVStore: the store is now auto-compacted automatically up to some point,
to avoid very large file sizes. This area is still work in progress.
</li><li>
Sequences of temporary tables (auto-increment or identity columns)
...
...
@@ -27,11 +31,11 @@ Change Log
</li><li>
The LIRS cache now re-sizes the internal hash map if needed.
</li><li>
Optionally persist session history in the H2 console. (patch from Martin Grajcar)
</li><li>
Add client-info property to get the number of servers currently in the cluster
and which servers that are available. (patch from Nikolaj Fogh)
and which servers that are available. (patch from Nikolaj Fogh)
</li><li>
Fix bug in changing encrypted DB password that kept the file handle
open when the wrong password was supplied. (test case from Jens Hohmuth).
</li><li>
Issue 567:
h
2 hangs for a long time then (sometimes) recovers.
Introduce a queue when doing table locking to prevent session starvation.
open when the wrong password was supplied. (test case from Jens Hohmuth).
</li><li>
Issue 567:
H
2 hangs for a long time then (sometimes) recovers.
Introduce a queue when doing table locking to prevent session starvation.
</li></ul>
<h2>
Version 1.4.179 Beta (2014-06-23)
</h2>
...
...
This diff is collapsed.
Click to expand it.
h2/src/docsrc/text/_docs_en.utf8.txt
浏览文件 @
c937b4b4
差异被折叠。
点击展开。
h2/src/docsrc/text/_docs_ja.utf8.txt
浏览文件 @
c937b4b4
差异被折叠。
点击展开。
h2/src/docsrc/textbase/_docs_en.properties
浏览文件 @
c937b4b4
差异被折叠。
点击展开。
h2/src/main/org/h2/engine/Constants.java
浏览文件 @
c937b4b4
...
...
@@ -16,7 +16,7 @@ public class Constants {
/**
* The build date is updated for each public release.
*/
public
static
final
String
BUILD_DATE
=
"2014-0
6-2
3"
;
public
static
final
String
BUILD_DATE
=
"2014-0
7-1
3"
;
/**
* The build date of the last stable release.
...
...
@@ -26,7 +26,7 @@ public class Constants {
/**
* The build id is incremented for each public release.
*/
public
static
final
int
BUILD_ID
=
1
79
;
public
static
final
int
BUILD_ID
=
1
80
;
/**
* The build id of the last stable release.
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/Chunk.java
浏览文件 @
c937b4b4
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/ConcurrentLinkedList.java
浏览文件 @
c937b4b4
...
...
@@ -17,16 +17,32 @@ import java.util.Iterator;
*/
public
class
ConcurrentLinkedList
<
K
>
{
/**
* The sentinel entry.
*/
static
final
Entry
<?>
NULL
=
new
Entry
<
Object
>(
null
,
null
);
/**
* The head entry.
*/
@SuppressWarnings
(
"unchecked"
)
volatile
Entry
<
K
>
head
=
(
Entry
<
K
>)
NULL
;
/**
* Get the first element, or null if none.
*
* @return the first element
*/
public
K
peekFirst
()
{
Entry
<
K
>
x
=
head
;
return
x
.
obj
;
}
/**
* Get the last element, or null if none.
*
* @return the last element
*/
public
K
peekLast
()
{
Entry
<
K
>
x
=
head
;
while
(
x
!=
NULL
&&
x
.
next
!=
NULL
)
{
...
...
@@ -35,10 +51,21 @@ public class ConcurrentLinkedList<K> {
return
x
.
obj
;
}
/**
* Add an element at the end.
*
* @param obj the element
*/
public
synchronized
void
add
(
K
obj
)
{
head
=
Entry
.
append
(
head
,
obj
);
}
/**
* Remove the first element, if it matches.
*
* @param obj the element to remove
* @return true if the element matched and was removed
*/
public
synchronized
boolean
removeFirst
(
K
obj
)
{
if
(
head
.
obj
!=
obj
)
{
return
false
;
...
...
@@ -47,6 +74,12 @@ public class ConcurrentLinkedList<K> {
return
true
;
}
/**
* Remove the last element, if it matches.
*
* @param obj the element to remove
* @return true if the element matched and was removed
*/
public
synchronized
boolean
removeLast
(
K
obj
)
{
if
(
peekLast
()
!=
obj
)
{
return
false
;
...
...
@@ -55,6 +88,11 @@ public class ConcurrentLinkedList<K> {
return
true
;
}
/**
* Get an iterator over all entries.
*
* @return the iterator
*/
public
Iterator
<
K
>
iterator
()
{
return
new
Iterator
<
K
>()
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/MVMap.java
浏览文件 @
c937b4b4
...
...
@@ -1251,6 +1251,11 @@ public class MVMap<K, V> extends AbstractMap<K, V>
this
.
writeVersion
=
writeVersion
;
}
/**
* Copy a map. All pages are copied.
*
* @param sourceMap the source map
*/
void
copyFrom
(
MVMap
<
K
,
V
>
sourceMap
)
{
;
// TODO work in progress
root
=
copy
(
sourceMap
.
root
,
null
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/MVStore.java
浏览文件 @
c937b4b4
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/Page.java
浏览文件 @
c937b4b4
...
...
@@ -164,6 +164,14 @@ public class Page {
return
p
;
}
/**
* Create a copy of a page.
*
* @param map the map
* @param version the version
* @param source the source page
* @return the page
*/
public
static
Page
create
(
MVMap
<?,
?>
map
,
long
version
,
Page
source
)
{
Page
p
=
new
Page
(
map
,
version
);
// the position is 0
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/db/MVTable.java
浏览文件 @
c937b4b4
...
...
@@ -52,8 +52,10 @@ public class MVTable extends TableBase {
private
long
lastModificationId
;
private
volatile
Session
lockExclusiveSession
;
private
final
HashSet
<
Session
>
lockSharedSessions
=
New
.
hashSet
();
/**
* FIFO queue to prevent starvation, since Java's synchronized locking is biased.
* The queue of sessions waiting to lock the table. It is a FIFO queue to
* prevent starvation, since Java's synchronized locking is biased.
*/
private
final
ArrayDeque
<
Session
>
waitingSessions
=
new
ArrayDeque
<
Session
>();
private
final
Trace
traceLock
;
...
...
@@ -96,7 +98,8 @@ public class MVTable extends TableBase {
}
@Override
public
void
lock
(
Session
session
,
boolean
exclusive
,
boolean
forceLockEvenInMvcc
)
{
public
void
lock
(
Session
session
,
boolean
exclusive
,
boolean
forceLockEvenInMvcc
)
{
int
lockMode
=
database
.
getLockMode
();
if
(
lockMode
==
Constants
.
LOCK_MODE_OFF
)
{
return
;
...
...
@@ -196,7 +199,8 @@ public class MVTable extends TableBase {
session
.
addLock
(
this
);
lockExclusiveSession
=
session
;
return
true
;
}
else
if
(
lockSharedSessions
.
size
()
==
1
&&
lockSharedSessions
.
contains
(
session
))
{
}
else
if
(
lockSharedSessions
.
size
()
==
1
&&
lockSharedSessions
.
contains
(
session
))
{
traceLock
(
session
,
exclusive
,
"add (upgraded) for "
);
lockExclusiveSession
=
session
;
return
true
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/RegularTable.java
浏览文件 @
c937b4b4
...
...
@@ -55,8 +55,10 @@ public class RegularTable extends TableBase {
private
long
rowCount
;
private
volatile
Session
lockExclusiveSession
;
private
HashSet
<
Session
>
lockSharedSessions
=
New
.
hashSet
();
/**
* FIFO queue to prevent starvation, since Java's synchronized locking is biased.
* The queue of sessions waiting to lock the table. It is a FIFO queue to
* prevent starvation, since Java's synchronized locking is biased.
*/
private
final
ArrayDeque
<
Session
>
waitingSessions
=
new
ArrayDeque
<
Session
>();
private
final
Trace
traceLock
;
...
...
@@ -437,7 +439,8 @@ public class RegularTable extends TableBase {
}
@Override
public
void
lock
(
Session
session
,
boolean
exclusive
,
boolean
forceLockEvenInMvcc
)
{
public
void
lock
(
Session
session
,
boolean
exclusive
,
boolean
forceLockEvenInMvcc
)
{
int
lockMode
=
database
.
getLockMode
();
if
(
lockMode
==
Constants
.
LOCK_MODE_OFF
)
{
return
;
...
...
@@ -532,7 +535,8 @@ public class RegularTable extends TableBase {
session
.
addLock
(
this
);
lockExclusiveSession
=
session
;
return
true
;
}
else
if
(
lockSharedSessions
.
size
()
==
1
&&
lockSharedSessions
.
contains
(
session
))
{
}
else
if
(
lockSharedSessions
.
size
()
==
1
&&
lockSharedSessions
.
contains
(
session
))
{
traceLock
(
session
,
exclusive
,
"add (upgraded) for "
);
lockExclusiveSession
=
session
;
return
true
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/samples/newsfeed.sql
浏览文件 @
c937b4b4
...
...
@@ -6,6 +6,7 @@
CREATE
TABLE
VERSION
(
ID
INT
PRIMARY
KEY
,
VERSION
VARCHAR
,
CREATED
VARCHAR
);
INSERT
INTO
VERSION
VALUES
(
130
,
'1.4.180'
,
'2014-07-13'
),
(
129
,
'1.4.179'
,
'2014-06-23'
),
(
128
,
'1.4.178'
,
'2014-05-02'
),
(
127
,
'1.4.177'
,
'2014-04-12'
),
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestCluster.java
浏览文件 @
c937b4b4
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/store/TestConcurrentLinkedList.java
浏览文件 @
c937b4b4
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/store/TestMVStoreTool.java
浏览文件 @
c937b4b4
...
...
@@ -32,7 +32,8 @@ public class TestMVStoreTool extends TestBase {
@Override
public
void
test
()
throws
Exception
{
testCompress
();
;
// TODO work in progress
// testCompress();
}
private
void
testCompress
()
{
...
...
@@ -51,7 +52,6 @@ public class TestMVStoreTool extends TestBase {
}
}
s
.
close
();
;
// TODO testing
// MVStoreTool.dump(fileName);
// MVStoreTool.dump(fileName + ".new");
MVStoreTool
.
compress
(
fileName
,
fileName
+
".new"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/build/doc/dictionary.txt
浏览文件 @
c937b4b4
...
...
@@ -760,4 +760,4 @@ inaccuracies detector logos launcher rewrite monitors equivalents trademarks
reinstated uninteresting dead defendant doctrines beat factual fair suspended
exploit noise ongoing disclaimers shrinks remedy party desirable timely construe
deque synchronizers affero kevent nikolaj hohmuth grajcar jens fogh hostnames
operate resized
operate resized
jni yjp ownable starvation reaper biased introduce epoll hangs
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/dev/util/ConcurrentLinkedListWithTail.java
浏览文件 @
c937b4b4
...
...
@@ -16,19 +16,41 @@ import org.h2.mvstore.DataUtils;
*/
public
class
ConcurrentLinkedListWithTail
<
K
>
{
/**
* The first entry (if any).
*/
volatile
Entry
<
K
>
head
;
/**
* The last entry (if any).
*/
private
volatile
Entry
<
K
>
tail
;
/**
* Get the first element, or null if none.
*
* @return the first element
*/
public
K
peekFirst
()
{
Entry
<
K
>
x
=
head
;
return
x
==
null
?
null
:
x
.
obj
;
}
/**
* Get the last element, or null if none.
*
* @return the last element
*/
public
K
peekLast
()
{
Entry
<
K
>
x
=
tail
;
return
x
==
null
?
null
:
x
.
obj
;
}
/**
* Add an element at the end.
*
* @param obj the element
*/
public
void
add
(
K
obj
)
{
Entry
<
K
>
x
=
new
Entry
<
K
>(
obj
);
Entry
<
K
>
t
=
tail
;
...
...
@@ -41,6 +63,12 @@ public class ConcurrentLinkedListWithTail<K> {
}
}
/**
* Remove the first element, if it matches.
*
* @param obj the element to remove
* @return true if the element matched and was removed
*/
public
boolean
removeFirst
(
K
obj
)
{
Entry
<
K
>
x
=
head
;
if
(
x
==
null
||
x
.
obj
!=
obj
)
{
...
...
@@ -53,6 +81,12 @@ public class ConcurrentLinkedListWithTail<K> {
return
true
;
}
/**
* Remove the last element, if it matches.
*
* @param obj the element to remove
* @return true if the element matched and was removed
*/
public
boolean
removeLast
(
K
obj
)
{
Entry
<
K
>
x
=
head
;
if
(
x
==
null
)
{
...
...
@@ -76,6 +110,11 @@ public class ConcurrentLinkedListWithTail<K> {
return
true
;
}
/**
* Get an iterator over all entries.
*
* @return the iterator
*/
public
Iterator
<
K
>
iterator
()
{
return
new
Iterator
<
K
>()
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/dev/util/ConcurrentRing.java
浏览文件 @
c937b4b4
...
...
@@ -16,8 +16,19 @@ import org.h2.mvstore.DataUtils;
*/
public
class
ConcurrentRing
<
K
>
{
/**
* The ring buffer.
*/
K
[]
buffer
;
/**
* The read position.
*/
volatile
int
readPos
;
/**
* The write position.
*/
volatile
int
writePos
;
@SuppressWarnings
(
"unchecked"
)
...
...
@@ -25,14 +36,29 @@ public class ConcurrentRing<K> {
buffer
=
(
K
[])
new
Object
[
4
];
}
/**
* Get the first element, or null if none.
*
* @return the first element
*/
public
K
peekFirst
()
{
return
buffer
[
getIndex
(
readPos
)];
}
/**
* Get the last element, or null if none.
*
* @return the last element
*/
public
K
peekLast
()
{
return
buffer
[
getIndex
(
writePos
-
1
)];
}
/**
* Add an element at the end.
*
* @param obj the element
*/
public
void
add
(
K
obj
)
{
buffer
[
getIndex
(
writePos
)]
=
obj
;
writePos
++;
...
...
@@ -49,6 +75,12 @@ public class ConcurrentRing<K> {
}
}
/**
* Remove the first element, if it matches.
*
* @param obj the element to remove
* @return true if the element matched and was removed
*/
public
boolean
removeFirst
(
K
obj
)
{
int
p
=
readPos
;
int
idx
=
getIndex
(
p
);
...
...
@@ -60,6 +92,12 @@ public class ConcurrentRing<K> {
return
true
;
}
/**
* Remove the last element, if it matches.
*
* @param obj the element to remove
* @return true if the element matched and was removed
*/
public
boolean
removeLast
(
K
obj
)
{
int
p
=
writePos
;
int
idx
=
getIndex
(
p
-
1
);
...
...
@@ -71,10 +109,21 @@ public class ConcurrentRing<K> {
return
true
;
}
/**
* Get the index in the array of the given position.
*
* @param pos the position
* @return the index
*/
int
getIndex
(
int
pos
)
{
return
pos
&
(
buffer
.
length
-
1
);
}
/**
* Get an iterator over all entries.
*
* @return the iterator
*/
public
Iterator
<
K
>
iterator
()
{
return
new
Iterator
<
K
>()
{
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论