Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
13f10ade
提交
13f10ade
authored
11月 25, 2012
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
A persistent multi-version map: r-tree queries (intersect and contain)
上级
e2f96581
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
35 行增加
和
24 行删除
+35
-24
FilePathCache.java
h2/src/tools/org/h2/dev/store/FilePathCache.java
+5
-8
Cursor.java
h2/src/tools/org/h2/dev/store/btree/Cursor.java
+7
-7
MVStore.java
h2/src/tools/org/h2/dev/store/btree/MVStore.java
+23
-9
没有找到文件。
h2/src/tools/org/h2/dev/store/FilePathCache.java
浏览文件 @
13f10ade
...
...
@@ -51,22 +51,19 @@ public class FilePathCache extends FilePathWrapper {
}
public
FileChannel
position
(
long
newPosition
)
throws
IOException
{
throw
new
UnsupportedOperationException
();
// base.position(newPosition);
// return this;
base
.
position
(
newPosition
);
return
this
;
}
public
long
position
()
throws
IOException
{
throw
new
UnsupportedOperationException
();
// return base.position();
return
base
.
position
();
}
public
int
read
(
ByteBuffer
dst
)
throws
IOException
{
throw
new
UnsupportedOperationException
();
// return base.read(dst);
return
base
.
read
(
dst
);
}
public
synchronized
int
read
(
ByteBuffer
dst
,
long
position
)
throws
IOException
{
public
int
read
(
ByteBuffer
dst
,
long
position
)
throws
IOException
{
long
cachePos
=
getCachePos
(
position
);
int
off
=
(
int
)
(
position
-
cachePos
);
int
len
=
CACHE_BLOCK_SIZE
-
off
;
...
...
h2/src/tools/org/h2/dev/store/btree/Cursor.java
浏览文件 @
13f10ade
...
...
@@ -15,14 +15,14 @@ import java.util.Iterator;
*/
public
class
Cursor
<
K
>
implements
Iterator
<
K
>
{
private
final
MVMap
<
K
,
?>
map
;
private
final
K
from
;
protected
final
MVMap
<
K
,
?>
map
;
protected
final
K
from
;
protected
CursorPos
pos
;
protected
K
current
;
private
final
Page
root
;
private
boolean
initialized
;
private
CursorPos
pos
;
private
K
current
;
Cursor
(
MVMap
<
K
,
?>
map
,
Page
root
,
K
from
)
{
protected
Cursor
(
MVMap
<
K
,
?>
map
,
Page
root
,
K
from
)
{
this
.
map
=
map
;
this
.
root
=
root
;
this
.
from
=
from
;
...
...
@@ -64,7 +64,7 @@ public class Cursor<K> implements Iterator<K> {
throw
new
UnsupportedOperationException
();
}
pr
ivate
void
min
(
Page
p
,
K
from
)
{
pr
otected
void
min
(
Page
p
,
K
from
)
{
while
(
true
)
{
if
(
p
.
isLeaf
())
{
int
x
=
from
==
null
?
0
:
p
.
binarySearch
(
from
);
...
...
@@ -86,7 +86,7 @@ public class Cursor<K> implements Iterator<K> {
}
@SuppressWarnings
(
"unchecked"
)
pr
ivate
void
fetchNext
()
{
pr
otected
void
fetchNext
()
{
while
(
pos
!=
null
)
{
if
(
pos
.
index
<
pos
.
page
.
getKeyCount
())
{
current
=
(
K
)
pos
.
page
.
getKey
(
pos
.
index
++);
...
...
h2/src/tools/org/h2/dev/store/btree/MVStore.java
浏览文件 @
13f10ade
...
...
@@ -37,18 +37,15 @@ header:
H:3,...
TODO:
- support custom fields in the file header (auto-server ip address,...)
- support stores that span multiple files (chunks stored in other files)
- triggers
- r-tree: add missing features (NN search for example)
- pluggable cache (specially for in-memory file systems)
- maybe store the factory class in the file header
- use comma separated format for map metadata
- auto-server: store port in the header
-
recovery: keep some old chunks; don't overwritten for 1 minute
-
pluggable caching (specially for in-memory file systems
)
-
store store creation in file header, and seconds since creation in chunk header (plus a counter)
-
recovery: keep some old chunks; don't overwritten for 5 minutes (configurable
)
- allocate memory with Utils.newBytes and so on
- unified exception handling
- check if locale specific string comparison can make data disappear
- concurrent map; avoid locking during IO (pre-load pages)
- maybe split database into multiple files, to speed up compact operation
- automated 'kill process' and 'power failure' test
...
...
@@ -58,19 +55,25 @@ TODO:
- support background writes (concurrent modification & store)
- limited support for writing to old versions (branches)
- support concurrent operations (including file I/O)
- on insert, if the child page is already full, don't load and modify it - split directly
- on insert, if the child page is already full, don't load and modify it - split directly
(for leaves with 1 entry)
- performance test with encrypting file system
- possibly split chunk data into immutable and mutable
- compact: avoid processing pages using a counting bloom filter
- defragment (re-creating maps, specially those with small pages)
- write using ByteArrayOutputStream; remove DataType.getMaxLength
- file header: check
versionRead and versionWrite (and possibly rename; or rename version
)
- file header: check
formatRead and format (is formatRead needed if equal to format?
)
- chunk header: store changed chunk data as row; maybe after the root
- chunk checksum (header, last page, 2 bytes per page?)
- allow renaming maps
- file locking: solve problem that locks are shared for a VM
- online backup
- MapFactory is the wrong name (StorePlugin?) or is too flexible
- MapFactory is the wrong name (StorePlugin?) or is too flexible: remove?
- store file "header" at the end of each chunk; at the end of the file
- is there a better name for the file header, if it's no longer always at the beginning of a file?
- maybe let a chunk point to possible next chunks (so no fixed location header is needed)
- support stores that span multiple files (chunks stored in other files)
- triggers (can be implemented with a custom map)
- store write operations per page (maybe defragment if much different than count)
*/
...
...
@@ -1227,6 +1230,17 @@ public class MVStore {
return
fileHeader
;
}
/**
* Get the file instance in use, if a file is used. The application may read
* from the file (for example for online backup), but not write to it or
* truncate it.
*
* @return the file, or null
*/
public
FileChannel
getFile
()
{
return
file
;
}
public
String
toString
()
{
return
DataUtils
.
appendMap
(
new
StringBuilder
(),
config
).
toString
();
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论