Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
14111f79
提交
14111f79
authored
8月 02, 2014
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Formatting and documentation
上级
12500cfb
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
906 行增加
和
876 行删除
+906
-876
changelog.html
h2/src/docsrc/html/changelog.html
+7
-4
_docs_en.utf8.txt
h2/src/docsrc/text/_docs_en.utf8.txt
+286
-274
_docs_ja.utf8.txt
h2/src/docsrc/text/_docs_ja.utf8.txt
+286
-274
_docs_en.properties
h2/src/docsrc/textbase/_docs_en.properties
+278
-274
JdbcConnection.java
h2/src/main/org/h2/jdbc/JdbcConnection.java
+7
-5
Chunk.java
h2/src/main/org/h2/mvstore/Chunk.java
+1
-1
MVMap.java
h2/src/main/org/h2/mvstore/MVMap.java
+1
-1
MVStore.java
h2/src/main/org/h2/mvstore/MVStore.java
+10
-18
Page.java
h2/src/main/org/h2/mvstore/Page.java
+1
-1
TransactionStore.java
h2/src/main/org/h2/mvstore/db/TransactionStore.java
+5
-3
TestCompatibility.java
h2/src/test/org/h2/test/db/TestCompatibility.java
+1
-1
TestConcurrent.java
h2/src/test/org/h2/test/store/TestConcurrent.java
+5
-5
TestMVTableEngine.java
h2/src/test/org/h2/test/store/TestMVTableEngine.java
+8
-5
dictionary.txt
h2/src/tools/org/h2/build/doc/dictionary.txt
+1
-1
ThreadDumpCleaner.java
h2/src/tools/org/h2/dev/util/ThreadDumpCleaner.java
+9
-9
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
14111f79
...
...
@@ -27,15 +27,18 @@ Change Log
</li><li>
File system abstraction: support replacing existing files using move
(currently not for Windows).
</li><li>
The statement "shutdown defrag" now compresses the database (with the MVStore).
</li><li>
The MVStore now automatically shrinks the file in the background if there is no read or write activity.
This might be a bit too aggressive; feedback is welcome!
This command can greatly reduce the file size, and is relatively fast,
but is not incremental.
</li><li>
The MVStore now automatically compacts the store in the background if there is no read or write activity,
which should (after some time; sometimes about one minute) reduce the file size.
This is still work in progress, feedback is welcome!
</li><li>
Change default value of PAGE_SIZE from 2048 to 4096 to more closely match most file systems block size
(PageStore only; the MVStore already used 4096).
</li><li>
Auto-scale MAX_MEMORY_ROWS and CACHE_SIZE settings by the amount of available RAM. Gives a better
out of box experience for people with more powerful machines.
</li><li>
Handle tabs like 4 spaces in web console, patch by Martin Grajcar
</li><li>
Handle tabs like 4 spaces in web console, patch by Martin Grajcar
.
</li><li>
Issue 573: Add implementation for Methods "isWrapperFor()" and "unwrap()" in JdbcConnection.java,
patch by BigMichi1
patch by BigMichi1
.
</li></ul>
<h2>
Version 1.4.180 Beta (2014-07-13)
</h2>
...
...
h2/src/docsrc/text/_docs_en.utf8.txt
浏览文件 @
14111f79
差异被折叠。
点击展开。
h2/src/docsrc/text/_docs_ja.utf8.txt
浏览文件 @
14111f79
差异被折叠。
点击展开。
h2/src/docsrc/textbase/_docs_en.properties
浏览文件 @
14111f79
差异被折叠。
点击展开。
h2/src/main/org/h2/jdbc/JdbcConnection.java
浏览文件 @
14111f79
...
...
@@ -1767,24 +1767,26 @@ public class JdbcConnection extends TraceObject implements Connection {
* Return an object of this class if possible.
*
* @param iface the class
* @return this
*/
@Override
@SuppressWarnings
(
"unchecked"
)
public
<
T
>
T
unwrap
(
Class
<
T
>
iface
)
throws
SQLException
{
if
(
isWrapperFor
(
iface
))
{
return
(
T
)
this
;
}
throw
DbException
.
getInvalidValueException
(
"iface"
,
iface
);
if
(
isWrapperFor
(
iface
))
{
return
(
T
)
this
;
}
throw
DbException
.
getInvalidValueException
(
"iface"
,
iface
);
}
/**
* Checks if unwrap can return an object of this class.
*
* @param iface the class
* @return whether or not the interface is assignable from this class
*/
@Override
public
boolean
isWrapperFor
(
Class
<?>
iface
)
throws
SQLException
{
return
(
iface
!=
null
&&
iface
.
isAssignableFrom
(
getClass
()
));
return
iface
!=
null
&&
iface
.
isAssignableFrom
(
getClass
(
));
}
/**
...
...
h2/src/main/org/h2/mvstore/Chunk.java
浏览文件 @
14111f79
...
...
@@ -89,7 +89,7 @@ public class Chunk {
* When this chunk was created, in milliseconds after the store was created.
*/
public
long
time
;
/**
* When this chunk was no longer needed, in milliseconds after the store was
* created. After this, the chunk is kept alive for at least half the
...
...
h2/src/main/org/h2/mvstore/MVMap.java
浏览文件 @
14111f79
...
...
@@ -969,7 +969,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
/**
* Get the map id. Please note the map id may be different after compacting
* a store.
*
*
* @return the map id
*/
public
int
getId
()
{
...
...
h2/src/main/org/h2/mvstore/MVStore.java
浏览文件 @
14111f79
...
...
@@ -105,12 +105,12 @@ MVStore:
- compact: copy whole pages (without having to open all maps)
- maybe change the length code to have lower gaps
- test with very low limits (such as: short chunks, small pages)
- maybe allow to read beyond the retention time:
- maybe allow to read beyond the retention time:
when compacting, move live pages in old chunks
to a map (possibly the metadata map) -
this requires a change in the compaction code, plus
a map lookup when reading old data; also, this
old data map needs to be cleaned up somehow;
old data map needs to be cleaned up somehow;
maybe using an additional timeout
*/
...
...
@@ -133,7 +133,7 @@ public class MVStore {
private
static
final
int
FORMAT_WRITE
=
1
;
private
static
final
int
FORMAT_READ
=
1
;
/**
* Used to mark a chunk as free, when it was detected that live bookkeeping
* is incorrect.
...
...
@@ -255,7 +255,7 @@ public class MVStore {
private
int
autoCompactFillRate
;
private
long
autoCompactLastFileOpCount
;
private
Object
compactSync
=
new
Object
();
/**
...
...
@@ -848,11 +848,6 @@ public class MVStore {
}
return
c
;
}
boolean
isChunkKnown
(
long
pos
)
{
int
chunkId
=
DataUtils
.
getPageChunkId
(
pos
);
return
chunks
.
containsKey
(
chunkId
);
}
private
Chunk
getChunkIfFound
(
long
pos
)
{
int
chunkId
=
DataUtils
.
getPageChunkId
(
pos
);
...
...
@@ -863,7 +858,7 @@ public class MVStore {
// access (if synchronization on this was forgotten)
throw
DataUtils
.
newIllegalStateException
(
DataUtils
.
ERROR_CHUNK_NOT_FOUND
,
"Chunk {0} no longer exists"
,
"Chunk {0} no longer exists"
,
chunkId
);
}
String
s
=
meta
.
get
(
Chunk
.
getMetaKey
(
chunkId
));
...
...
@@ -1594,7 +1589,7 @@ public class MVStore {
return
true
;
}
}
private
ArrayList
<
Chunk
>
compactGetOldChunks
(
int
targetFillRate
,
int
write
)
{
if
(
lastChunk
==
null
)
{
// nothing to do
...
...
@@ -1679,7 +1674,7 @@ public class MVStore {
}
return
old
;
}
private
void
compactRewrite
(
ArrayList
<
Chunk
>
old
)
{
HashSet
<
Integer
>
set
=
New
.
hashSet
();
for
(
Chunk
c
:
old
)
{
...
...
@@ -1708,7 +1703,7 @@ public class MVStore {
commitAndSave
();
}
}
private
synchronized
void
compactFixLive
(
Chunk
chunk
)
{
long
start
=
chunk
.
block
*
BLOCK_SIZE
;
int
length
=
chunk
.
len
*
BLOCK_SIZE
;
...
...
@@ -1761,13 +1756,10 @@ public class MVStore {
}
}
if
(!
pendingChanges
)
{
;
new
Exception
(
fileStore
.
getFileName
()
+
" chunk "
+
chunk
.
id
+
" fix live! "
+
chunk
).
printStackTrace
(
System
.
out
);
// bookkeeping is broken for this chunk:
// fix it
registerFreePage
(
currentVersion
,
chunk
.
id
,
chunk
.
maxLenLive
+
MARKED_FREE
,
chunk
.
maxLenLive
+
MARKED_FREE
,
chunk
.
pageCountLive
+
MARKED_FREE
);
}
}
...
...
@@ -1936,7 +1928,7 @@ new Exception(fileStore.getFileName() + " chunk " + chunk.id + " fix live! " + c
* while traversing over the entries of a map.
* <p>
* This setting is not persisted.
*
*
* @param ms how many milliseconds to retain old chunks (0 to overwrite them
* as early as possible)
*/
...
...
h2/src/main/org/h2/mvstore/Page.java
浏览文件 @
14111f79
...
...
@@ -102,7 +102,7 @@ public class Page {
* The array might be larger than needed, to avoid frequent re-sizing.
*/
private
Page
[]
childrenPages
;
/**
* Whether the page is an in-memory (not stored, or not yet stored) page,
* and it is removed. This is to keep track of pages that concurrently
...
...
h2/src/main/org/h2/mvstore/db/TransactionStore.java
浏览文件 @
14111f79
...
...
@@ -1399,7 +1399,8 @@ public class TransactionStore {
k
=
cursor
.
next
();
}
catch
(
IllegalStateException
e
)
{
// TODO this is a bit ugly
if
(
DataUtils
.
getErrorCode
(
e
.
getMessage
())
==
DataUtils
.
ERROR_CHUNK_NOT_FOUND
)
{
if
(
DataUtils
.
getErrorCode
(
e
.
getMessage
())
==
DataUtils
.
ERROR_CHUNK_NOT_FOUND
)
{
cursor
=
map
.
cursor
(
currentKey
);
// we (should) get the current key again,
// we need to ignore that one
...
...
@@ -1443,7 +1444,7 @@ public class TransactionStore {
throw
DataUtils
.
newUnsupportedOperationException
(
"Removing is not supported"
);
}
};
};
}
/**
...
...
@@ -1469,7 +1470,8 @@ public class TransactionStore {
k
=
cursor
.
next
();
}
catch
(
IllegalStateException
e
)
{
// TODO this is a bit ugly
if
(
DataUtils
.
getErrorCode
(
e
.
getMessage
())
==
DataUtils
.
ERROR_CHUNK_NOT_FOUND
)
{
if
(
DataUtils
.
getErrorCode
(
e
.
getMessage
())
==
DataUtils
.
ERROR_CHUNK_NOT_FOUND
)
{
cursor
=
map
.
cursor
(
currentKey
);
// we (should) get the current key again,
// we need to ignore that one
...
...
h2/src/test/org/h2/test/db/TestCompatibility.java
浏览文件 @
14111f79
...
...
@@ -237,7 +237,7 @@ public class TestCompatibility extends TestBase {
stat
.
execute
(
"use schema public"
);
assertResult
(
"PUBLIC"
,
stat
,
"select schema()"
);
stat
.
execute
(
"SELECT 1"
);
stat
.
execute
(
"DROP TABLE IF EXISTS TEST"
);
stat
.
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR)"
);
...
...
h2/src/test/org/h2/test/store/TestConcurrent.java
浏览文件 @
14111f79
...
...
@@ -60,7 +60,7 @@ public class TestConcurrent extends TestMVStore {
testConcurrentWrite
();
testConcurrentRead
();
}
private
void
testConcurrentAutoCommitAndChange
()
throws
InterruptedException
{
String
fileName
=
"memFS:testConcurrentChangeAndBackgroundCompact"
;
FileUtils
.
delete
(
fileName
);
...
...
@@ -102,10 +102,10 @@ public class TestConcurrent extends TestMVStore {
assertEquals
(
10
*
i
,
dataMap
.
get
(
i
).
intValue
());
}
}
finally
{
s
.
close
();
s
.
close
();
}
}
private
void
testConcurrentReplaceAndRead
()
throws
InterruptedException
{
final
MVStore
s
=
new
MVStore
.
Builder
().
open
();
final
MVMap
<
Integer
,
Integer
>
map
=
s
.
openMap
(
"data"
);
...
...
@@ -133,7 +133,7 @@ public class TestConcurrent extends TestMVStore {
task
.
get
();
s
.
close
();
}
private
void
testConcurrentChangeAndCompact
()
throws
InterruptedException
{
String
fileName
=
"memFS:testConcurrentChangeAndBackgroundCompact"
;
FileUtils
.
delete
(
fileName
);
...
...
@@ -163,7 +163,7 @@ public class TestConcurrent extends TestMVStore {
Thread
.
sleep
(
1
);
for
(
int
i
=
0
;
!
task
.
isFinished
()
&&
!
task2
.
isFinished
()
&&
i
<
1000
;
i
++)
{
MVMap
<
Integer
,
Integer
>
map
=
s
.
openMap
(
"d"
+
(
i
%
3
));
// MVMap<Integer, Integer> map = s.openMap("d" + (i % 3),
// MVMap<Integer, Integer> map = s.openMap("d" + (i % 3),
// new MVMapConcurrent.Builder<Integer, Integer>());
map
.
put
(
0
,
i
);
map
.
get
(
0
);
...
...
h2/src/test/org/h2/test/store/TestMVTableEngine.java
浏览文件 @
14111f79
...
...
@@ -79,19 +79,22 @@ public class TestMVTableEngine extends TestBase {
testLocking
();
testSimple
();
}
private
void
testLowRetentionTime
()
throws
SQLException
{
deleteDb
(
"testLowRetentionTime"
);
Connection
conn
=
getConnection
(
"testLowRetentionTime;RETENTION_TIME=10;WRITE_DELAY=10"
);
Connection
conn
=
getConnection
(
"testLowRetentionTime;RETENTION_TIME=10;WRITE_DELAY=10"
);
Statement
stat
=
conn
.
createStatement
();
Connection
conn2
=
getConnection
(
"testLowRetentionTime"
);
Statement
stat2
=
conn2
.
createStatement
();
stat
.
execute
(
"create alias sleep as $$void sleep(int ms) throws Exception { Thread.sleep(ms); }$$"
);
stat
.
execute
(
"create table test(id identity, name varchar) as select x, 'Init' from system_range(0, 1999)"
);
stat
.
execute
(
"create alias sleep as "
+
"$$void sleep(int ms) throws Exception { Thread.sleep(ms); }$$"
);
stat
.
execute
(
"create table test(id identity, name varchar) "
+
"as select x, 'Init' from system_range(0, 1999)"
);
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
stat
.
execute
(
"insert into test values(null, 'Hello')"
);
// create and delete a large table: this will force compaction
stat
.
execute
(
"create table temp(id identity, name varchar) as "
+
stat
.
execute
(
"create table temp(id identity, name varchar) as "
+
"select x, space(1000000) from system_range(0, 10)"
);
stat
.
execute
(
"drop table temp"
);
}
...
...
h2/src/tools/org/h2/build/doc/dictionary.txt
浏览文件 @
14111f79
...
...
@@ -761,4 +761,4 @@ 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 jni yjp ownable starvation reaper biased introduce epoll hangs
compaction aggressive powerful
compaction aggressive powerful
traversing pietrzak michi karl
h2/src/tools/org/h2/dev/util/ThreadDumpCleaner.java
浏览文件 @
14111f79
...
...
@@ -24,32 +24,32 @@ public class ThreadDumpCleaner {
private
static
final
String
[]
PATTERN
=
{
"\\$\\$YJP\\$\\$"
,
"\"(Attach|Service|VM|GC|DestroyJavaVM|Signal|AWT|AppKit|C2 |Low Mem|"
+
"process reaper|YJPAgent-).*?\"(?s).*?\n\n"
,
" Locked ownable synchronizers:(?s).*?\n\n"
,
"\".*?\".*?\n java.lang.Thread.State: (TIMED_)?WAITING(?s).*?\n\n"
,
"\".*?\".*?\n java.lang.Thread.State:.*\n\t"
+
"at sun.nio.ch.KQueueArrayWrapper.kevent0(?s).*?\n\n"
,
"\".*?\".*?\n java.lang.Thread.State:.*\n\t"
+
"at java.io.FileInputStream.readBytes(?s).*?\n\n"
,
"\".*?\".*?\n java.lang.Thread.State:.*\n\t"
+
"at sun.nio.ch.ServerSocketChannelImpl.accept(?s).*?\n\n"
,
"\".*?\".*?\n java.lang.Thread.State:.*\n\t"
+
"at sun.nio.ch.EPollArrayWrapper.epollWait(?s).*?\n\n"
,
"\".*?\".*?\n java.lang.Thread.State:.*\n\t"
+
"at java.lang.Object.wait(?s).*?\n\n"
,
"\".*?\".*?\n java.lang.Thread.State:.*\n\t"
+
"at java.net.PlainSocketImpl.socketAccept(?s).*?\n\n"
,
"JNI global references:.*\n\n"
,
};
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论