Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
aa55aed2
提交
aa55aed2
authored
8 年前
作者:
Noel Grandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
implement support for partial writes when testing MVStore
上级
fdc5aa12
master
noel-pr1
stumc-Issue#576
version-1.4.198
version-1.4.197
version-1.4.196
version-1.4.195
version-1.4.194
version-1.4.193
无相关合并请求
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
18 行增加
和
5 行删除
+18
-5
TestReorderWrites.java
h2/src/test/org/h2/test/poweroff/TestReorderWrites.java
+1
-1
FilePathReorderWrites.java
h2/src/test/org/h2/test/utils/FilePathReorderWrites.java
+17
-4
没有找到文件。
h2/src/test/org/h2/test/poweroff/TestReorderWrites.java
浏览文件 @
aa55aed2
...
@@ -11,7 +11,6 @@ import java.nio.channels.FileChannel;
...
@@ -11,7 +11,6 @@ import java.nio.channels.FileChannel;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Random
;
import
java.util.Random
;
import
org.h2.mvstore.MVStore
;
import
org.h2.mvstore.MVStore
;
import
org.h2.mvstore.MVStoreTool
;
import
org.h2.mvstore.MVStoreTool
;
import
org.h2.store.fs.FilePath
;
import
org.h2.store.fs.FilePath
;
...
@@ -129,6 +128,7 @@ public class TestReorderWrites extends TestBase {
...
@@ -129,6 +128,7 @@ public class TestReorderWrites extends TestBase {
private
void
testFileSystem
()
throws
IOException
{
private
void
testFileSystem
()
throws
IOException
{
FilePathReorderWrites
fs
=
FilePathReorderWrites
.
register
();
FilePathReorderWrites
fs
=
FilePathReorderWrites
.
register
();
FilePathReorderWrites
.
setPartialWrites
(
true
);
String
fileName
=
"reorder:memFS:test"
;
String
fileName
=
"reorder:memFS:test"
;
ByteBuffer
empty
=
ByteBuffer
.
allocate
(
1024
);
ByteBuffer
empty
=
ByteBuffer
.
allocate
(
1024
);
Random
r
=
new
Random
(
1
);
Random
r
=
new
Random
(
1
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/utils/FilePathReorderWrites.java
浏览文件 @
aa55aed2
...
@@ -71,11 +71,11 @@ public class FilePathReorderWrites extends FilePathWrapper {
...
@@ -71,11 +71,11 @@ public class FilePathReorderWrites extends FilePathWrapper {
*
*
* @param partialWrites true to enable
* @param partialWrites true to enable
*/
*/
public
void
setPartialWrites
(
boolean
partialWrites
)
{
public
static
void
setPartialWrites
(
boolean
partialWrites
)
{
FilePathReorderWrites
.
partialWrites
=
partialWrites
;
FilePathReorderWrites
.
partialWrites
=
partialWrites
;
}
}
boolean
getPartialWrites
()
{
static
boolean
getPartialWrites
()
{
return
partialWrites
;
return
partialWrites
;
}
}
...
@@ -261,13 +261,26 @@ class FileReorderWrites extends FileBase {
...
@@ -261,13 +261,26 @@ class FileReorderWrites extends FileBase {
@Override
@Override
public
int
write
(
ByteBuffer
src
)
throws
IOException
{
public
int
write
(
ByteBuffer
src
)
throws
IOException
{
return
addOperation
(
new
FileWriteOperation
(
id
++,
readBase
.
position
(),
src
));
return
write
(
src
,
readBase
.
position
(
));
}
}
@Override
@Override
public
int
write
(
ByteBuffer
src
,
long
position
)
throws
IOException
{
public
int
write
(
ByteBuffer
src
,
long
position
)
throws
IOException
{
if
(
FilePathReorderWrites
.
getPartialWrites
()
&&
src
.
remaining
()
>
2
)
{
ByteBuffer
buf1
=
src
.
slice
();
ByteBuffer
buf2
=
src
.
slice
();
int
len1
=
src
.
remaining
()
/
2
;
int
len2
=
src
.
remaining
()
-
len1
;
buf1
.
limit
(
buf1
.
limit
()
-
len2
);
buf2
.
position
(
buf2
.
position
()
+
len1
);
int
x
=
addOperation
(
new
FileWriteOperation
(
id
++,
position
,
buf1
));
x
+=
addOperation
(
new
FileWriteOperation
(
id
++,
position
+
len1
,
buf2
));
return
x
;
}
else
{
return
addOperation
(
new
FileWriteOperation
(
id
++,
position
,
src
));
return
addOperation
(
new
FileWriteOperation
(
id
++,
position
,
src
));
}
}
}
private
void
checkError
()
throws
IOException
{
private
void
checkError
()
throws
IOException
{
if
(
closed
)
{
if
(
closed
)
{
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论