Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
6b846676
提交
6b846676
authored
6 年前
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement MVPrimaryIndex.getDiskSpaceUsed()
上级
1393df91
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
32 行增加
和
3 行删除
+32
-3
Page.java
h2/src/main/org/h2/mvstore/Page.java
+29
-1
MVPrimaryIndex.java
h2/src/main/org/h2/mvstore/db/MVPrimaryIndex.java
+3
-2
没有找到文件。
h2/src/main/org/h2/mvstore/Page.java
浏览文件 @
6b846676
...
...
@@ -54,6 +54,11 @@ public abstract class Page implements Cloneable
*/
private
int
memory
;
/**
* Amount of used disk space by this page only in persistent case.
*/
private
int
diskSpaceUsed
;
/**
* The keys.
*/
...
...
@@ -672,6 +677,7 @@ public abstract class Page implements Cloneable
if
(
isLeaf
())
{
readPayLoad
(
buff
);
}
diskSpaceUsed
=
maxLength
;
recalculateMemory
();
}
...
...
@@ -748,7 +754,7 @@ public abstract class Page implements Cloneable
// for a longer time
store
.
cachePage
(
this
);
}
long
max
=
DataUtils
.
getPageMaxLength
(
pos
);
int
max
=
DataUtils
.
getPageMaxLength
(
pos
);
chunk
.
maxLen
+=
max
;
chunk
.
maxLenLive
+=
max
;
chunk
.
pageCount
++;
...
...
@@ -759,6 +765,7 @@ public abstract class Page implements Cloneable
// when the next chunk is stored
map
.
removePage
(
pos
,
memory
);
}
diskSpaceUsed
=
max
!=
DataUtils
.
PAGE_LARGE
?
max
:
pageLength
;
return
typePos
+
1
;
}
...
...
@@ -805,6 +812,27 @@ public abstract class Page implements Cloneable
return
0
;
}
/**
* Amount of used disk space in persistent case including child pages.
*
* @return amount of used disk space in persistent case
*/
public
long
getDiskSpaceUsed
()
{
long
r
=
0
;
if
(
isPersistent
())
{
r
+=
diskSpaceUsed
;
}
if
(!
isLeaf
())
{
for
(
int
i
=
0
;
i
<
getRawChildPageCount
();
i
++)
{
long
pos
=
getChildPagePos
(
i
);
if
(
pos
!=
0
)
{
r
+=
getChildPage
(
i
).
getDiskSpaceUsed
();
}
}
}
return
r
;
}
final
void
addMemory
(
int
mem
)
{
memory
+=
mem
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/db/MVPrimaryIndex.java
浏览文件 @
6b846676
...
...
@@ -19,8 +19,10 @@ import org.h2.index.BaseIndex;
import
org.h2.index.Cursor
;
import
org.h2.index.IndexType
;
import
org.h2.message.DbException
;
import
org.h2.mvstore.MVMap
;
import
org.h2.mvstore.tx.Transaction
;
import
org.h2.mvstore.tx.TransactionMap
;
import
org.h2.mvstore.tx.VersionedValue
;
import
org.h2.result.Row
;
import
org.h2.result.SearchRow
;
import
org.h2.result.SortOrder
;
...
...
@@ -358,8 +360,7 @@ public class MVPrimaryIndex extends BaseIndex {
@Override
public
long
getDiskSpaceUsed
()
{
// TODO estimate disk space usage
return
0
;
return
dataMap
.
map
.
getRootPage
().
getDiskSpaceUsed
();
}
public
String
getMapName
()
{
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论