Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
8e520ee6
提交
8e520ee6
authored
4月 04, 2018
作者:
andrei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
put assertion in place first
filestore.clear() added, verifyLastChunk() moved to make assertions happy
上级
ea42b4a7
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
16 行增加
和
1 行删除
+16
-1
FreeSpaceBitSet.java
h2/src/main/org/h2/mvstore/FreeSpaceBitSet.java
+6
-0
MVStore.java
h2/src/main/org/h2/mvstore/MVStore.java
+10
-1
没有找到文件。
h2/src/main/org/h2/mvstore/FreeSpaceBitSet.java
浏览文件 @
8e520ee6
...
...
@@ -99,6 +99,8 @@ public class FreeSpaceBitSet {
int
start
=
set
.
nextClearBit
(
i
);
int
end
=
set
.
nextSetBit
(
start
+
1
);
if
(
end
<
0
||
end
-
start
>=
blocks
)
{
assert
set
.
nextSetBit
(
start
)
==
-
1
||
set
.
nextSetBit
(
start
)
>=
start
+
blocks
:
"Double alloc: "
+
Integer
.
toHexString
(
start
)
+
"/"
+
Integer
.
toHexString
(
blocks
)
+
" "
+
this
;
set
.
set
(
start
,
start
+
blocks
);
return
getPos
(
start
);
}
...
...
@@ -115,6 +117,8 @@ public class FreeSpaceBitSet {
public
void
markUsed
(
long
pos
,
int
length
)
{
int
start
=
getBlock
(
pos
);
int
blocks
=
getBlockCount
(
length
);
assert
set
.
nextSetBit
(
start
)
==
-
1
||
set
.
nextSetBit
(
start
)
>=
start
+
blocks
:
"Double mark: "
+
Integer
.
toHexString
(
start
)
+
"/"
+
Integer
.
toHexString
(
blocks
)
+
" "
+
this
;
set
.
set
(
start
,
start
+
blocks
);
}
...
...
@@ -127,6 +131,8 @@ public class FreeSpaceBitSet {
public
void
free
(
long
pos
,
int
length
)
{
int
start
=
getBlock
(
pos
);
int
blocks
=
getBlockCount
(
length
);
assert
set
.
nextClearBit
(
start
)
>=
start
+
blocks
:
"Double free: "
+
Integer
.
toHexString
(
start
)
+
"/"
+
Integer
.
toHexString
(
blocks
)
+
" "
+
this
;
set
.
clear
(
start
,
start
+
blocks
);
}
...
...
h2/src/main/org/h2/mvstore/MVStore.java
浏览文件 @
8e520ee6
...
...
@@ -664,8 +664,8 @@ public final class MVStore {
loadChunkMeta
();
// read all chunk headers and footers within the retention time,
// to detect unwritten data after a power failure
verifyLastChunks
();
// build the free space list
fileStore
.
clear
();
for
(
Chunk
c
:
chunks
.
values
())
{
if
(
c
.
pageCountLive
==
0
)
{
// remove this chunk in the next save operation
...
...
@@ -675,6 +675,9 @@ public final class MVStore {
int
length
=
c
.
len
*
BLOCK_SIZE
;
fileStore
.
markUsed
(
start
,
length
);
}
assert
fileStore
.
getFileLengthInUse
()
==
measureFileLengthInUse
()
:
fileStore
.
getFileLengthInUse
()
+
" != "
+
measureFileLengthInUse
();
verifyLastChunks
();
}
private
void
loadChunkMeta
()
{
...
...
@@ -1143,6 +1146,8 @@ public final class MVStore {
c
.
block
=
filePos
/
BLOCK_SIZE
;
c
.
len
=
length
/
BLOCK_SIZE
;
assert
fileStore
.
getFileLengthInUse
()
==
measureFileLengthInUse
()
:
fileStore
.
getFileLengthInUse
()
+
" != "
+
measureFileLengthInUse
()
+
" "
+
c
;
c
.
metaRootPos
=
metaRoot
.
getPos
();
// calculate and set the likely next position
if
(
reuseSpace
)
{
...
...
@@ -1257,6 +1262,8 @@ public final class MVStore {
long
start
=
c
.
block
*
BLOCK_SIZE
;
int
length
=
c
.
len
*
BLOCK_SIZE
;
fileStore
.
free
(
start
,
length
);
assert
fileStore
.
getFileLengthInUse
()
==
measureFileLengthInUse
()
:
fileStore
.
getFileLengthInUse
()
+
" != "
+
measureFileLengthInUse
();
}
else
{
if
(
c
.
unused
==
0
)
{
c
.
unused
=
time
;
...
...
@@ -2304,6 +2311,8 @@ public final class MVStore {
long
start
=
c
.
block
*
BLOCK_SIZE
;
int
length
=
c
.
len
*
BLOCK_SIZE
;
fileStore
.
free
(
start
,
length
);
assert
fileStore
.
getFileLengthInUse
()
==
measureFileLengthInUse
()
:
fileStore
.
getFileLengthInUse
()
+
" != "
+
measureFileLengthInUse
();
// overwrite the chunk,
// so it is not be used later on
WriteBuffer
buff
=
getWriteBuffer
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论