Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
5d9a00a9
提交
5d9a00a9
authored
8月 12, 2013
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MVStore: rename pageSize to pageSplitSize
上级
54c3fc72
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
47 行增加
和
43 行删除
+47
-43
MVMap.java
h2/src/main/org/h2/mvstore/MVMap.java
+4
-4
MVStore.java
h2/src/main/org/h2/mvstore/MVStore.java
+36
-32
TransactionStore.java
h2/src/main/org/h2/mvstore/db/TransactionStore.java
+4
-4
MVRTreeMap.java
h2/src/main/org/h2/mvstore/rtree/MVRTreeMap.java
+3
-3
没有找到文件。
h2/src/main/org/h2/mvstore/MVMap.java
浏览文件 @
5d9a00a9
...
...
@@ -125,7 +125,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
* @return the new sibling
*/
protected
Page
splitRootIfNeeded
(
Page
p
,
long
writeVersion
)
{
if
(
p
.
getMemory
()
<=
store
.
getPageSize
()
||
p
.
getKeyCount
()
<=
1
)
{
if
(
p
.
getMemory
()
<=
store
.
getPageS
plitS
ize
()
||
p
.
getKeyCount
()
<=
1
)
{
return
p
;
}
int
at
=
p
.
getKeyCount
()
/
2
;
...
...
@@ -167,7 +167,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
index
++;
}
Page
c
=
copyOnWrite
(
p
.
getChildPage
(
index
),
writeVersion
);
if
(
c
.
getMemory
()
>
store
.
getPageSize
()
&&
c
.
getKeyCount
()
>
1
)
{
if
(
c
.
getMemory
()
>
store
.
getPageS
plitS
ize
()
&&
c
.
getKeyCount
()
>
1
)
{
// split on the way down
int
at
=
c
.
getKeyCount
()
/
2
;
Object
k
=
c
.
getKey
(
at
);
...
...
h2/src/main/org/h2/mvstore/MVStore.java
浏览文件 @
5d9a00a9
...
...
@@ -51,7 +51,7 @@ TestMVStoreDataLoss
TransactionStore:
MVStore:
- rolling docs review: at "
Feature
s"
- rolling docs review: at "
Transaction
s"
- move setters to the builder, except for setRetainVersion, setReuseSpace,
and settings that are persistent (setStoreVersion)
- automated 'kill process' and 'power failure' test
...
...
@@ -107,8 +107,10 @@ MVStore:
- autocommit (to avoid having to call commit,
as it could be called too often or it is easily forgotten)
- remove features that are not really needed; simplify the code
possibly using a layering / tool mechanism
- rename "store" to "save", as store collides with storeVersion
possibly using a separate layer or tools
- rename "store" to "save", as "store" is used in "storeVersion"
- MVStoreTool.dump should dump the data if possible;
possibly using a callback for serialization
*/
...
...
@@ -141,7 +143,7 @@ public class MVStore {
private
final
String
fileName
;
private
final
char
[]
filePassword
;
private
final
int
pageSize
;
private
final
int
pageS
plitS
ize
;
private
FileChannel
file
;
private
FileLock
fileLock
;
...
...
@@ -250,15 +252,15 @@ public class MVStore {
this
.
fileName
=
f
;
this
.
readOnly
=
config
.
containsKey
(
"readOnly"
);
this
.
compress
=
config
.
containsKey
(
"compress"
);
Object
o
=
config
.
get
(
"pageSize"
);
pageSize
=
o
==
null
?
6
*
1024
:
(
Integer
)
o
;
Object
o
=
config
.
get
(
"pageS
plitS
ize"
);
pageS
plitS
ize
=
o
==
null
?
6
*
1024
:
(
Integer
)
o
;
o
=
config
.
get
(
"backgroundExceptionListener"
);
this
.
backgroundExceptionListener
=
(
ExceptionListener
)
o
;
if
(
fileName
!=
null
)
{
o
=
config
.
get
(
"cacheSize"
);
int
mb
=
o
==
null
?
16
:
(
Integer
)
o
;
int
maxMemoryBytes
=
mb
*
1024
*
1024
;
int
averageMemory
=
pageSize
/
2
;
int
averageMemory
=
pageS
plitS
ize
/
2
;
int
segmentCount
=
16
;
int
stackMoveDistance
=
maxMemoryBytes
/
averageMemory
*
2
/
100
;
cache
=
new
CacheLongKeyLIRS
<
Page
>(
...
...
@@ -267,7 +269,7 @@ public class MVStore {
o
=
config
.
get
(
"writeBufferSize"
);
mb
=
o
==
null
?
4
:
(
Integer
)
o
;
int
writeBufferSize
=
mb
*
1024
*
1024
;
maxUnsavedPages
=
writeBufferSize
/
pageSize
;
maxUnsavedPages
=
writeBufferSize
/
pageS
plitS
ize
;
o
=
config
.
get
(
"writeDelay"
);
writeDelay
=
o
==
null
?
1000
:
(
Integer
)
o
;
}
else
{
...
...
@@ -742,14 +744,14 @@ public class MVStore {
if
(
closed
)
{
return
;
}
closed
=
true
;
if
(
file
==
null
)
{
return
;
}
// can not synchronize on this yet, because
// the thread also synchronized on this, which
// could result in a deadlock
stopBackgroundThread
();
closed
=
true
;
if
(
file
==
null
)
{
return
;
}
synchronized
(
this
)
{
try
{
if
(
shrinkIfPossible
)
{
...
...
@@ -1408,8 +1410,8 @@ public class MVStore {
return
compress
;
}
public
int
getPageSize
()
{
return
pageSize
;
public
int
getPageS
plitS
ize
()
{
return
pageS
plitS
ize
;
}
public
boolean
getReuseSpace
()
{
...
...
@@ -2027,15 +2029,16 @@ public class MVStore {
}
/**
* Set the amount of memory a page should contain at most, in bytes
. Larger
*
pages are split. The default is 6 KB. This is not a limit in the pag
e
*
size (pages with one entry can get larger), it is just the point wher
e
* p
ages
are split.
* Set the amount of memory a page should contain at most, in bytes
,
*
before it is split. The default is 6 KB. This is not a limit in th
e
*
page size, as pages with one entry can get larger. It is just th
e
* p
oint where pages that contain more than one entry
are split.
*
* @param pageSize the page size
* @param pageSplitSize the page size
* @return this
*/
public
Builder
pageS
ize
(
int
page
Size
)
{
return
set
(
"pageS
ize"
,
page
Size
);
public
Builder
pageS
plitSize
(
int
pageSplit
Size
)
{
return
set
(
"pageS
plitSize"
,
pageSplit
Size
);
}
/**
...
...
@@ -2043,6 +2046,7 @@ public class MVStore {
* thread.
*
* @param backgroundExceptionListener the listener
* @return this
*/
public
Builder
backgroundExceptionListener
(
ExceptionListener
backgroundExceptionListener
)
{
...
...
h2/src/main/org/h2/mvstore/db/TransactionStore.java
浏览文件 @
5d9a00a9
h2/src/main/org/h2/mvstore/rtree/MVRTreeMap.java
浏览文件 @
5d9a00a9
...
...
@@ -227,9 +227,9 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
Page
p
=
copyOnWrite
(
root
,
v
);
Object
result
;
if
(
alwaysAdd
||
get
(
key
)
==
null
)
{
if
(
p
.
getMemory
()
>
store
.
getPageSize
()
&&
p
.
getKeyCount
()
>
1
)
{
if
(
p
.
getMemory
()
>
store
.
getPageS
plitS
ize
()
&&
p
.
getKeyCount
()
>
1
)
{
// only possible if this is the root, else we would have split earlier
// (this requires
maxPage
Size is fixed)
// (this requires
pageSplit
Size is fixed)
long
totalCount
=
p
.
getTotalCount
();
Page
split
=
split
(
p
,
v
);
Object
k1
=
getBounds
(
p
);
...
...
@@ -313,7 +313,7 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
}
}
Page
c
=
copyOnWrite
(
p
.
getChildPage
(
index
),
writeVersion
);
if
(
c
.
getMemory
()
>
store
.
getPageSize
()
&&
c
.
getKeyCount
()
>
1
)
{
if
(
c
.
getMemory
()
>
store
.
getPageS
plitS
ize
()
&&
c
.
getKeyCount
()
>
1
)
{
// split on the way down
Page
split
=
split
(
c
,
writeVersion
);
p
=
copyOnWrite
(
p
,
writeVersion
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论