Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
9dc12e68
提交
9dc12e68
authored
1月 10, 2019
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Pass storeLocalTime parameter to Data.create()
上级
bb5d04c7
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
41 行增加
和
25 行删除
+41
-25
UndoLog.java
h2/src/main/org/h2/engine/UndoLog.java
+2
-2
RowList.java
h2/src/main/org/h2/result/RowList.java
+1
-1
Data.java
h2/src/main/org/h2/store/Data.java
+10
-4
FileStoreInputStream.java
h2/src/main/org/h2/store/FileStoreInputStream.java
+1
-1
FileStoreOutputStream.java
h2/src/main/org/h2/store/FileStoreOutputStream.java
+1
-1
PageStore.java
h2/src/main/org/h2/store/PageStore.java
+3
-3
Recover.java
h2/src/main/org/h2/tools/Recover.java
+9
-9
TestDataPage.java
h2/src/test/org/h2/test/unit/TestDataPage.java
+13
-3
MemoryFootprint.java
h2/src/test/org/h2/test/utils/MemoryFootprint.java
+1
-1
没有找到文件。
h2/src/main/org/h2/engine/UndoLog.java
浏览文件 @
9dc12e68
...
...
@@ -73,7 +73,7 @@ public class UndoLog {
long
pos
=
storedEntriesPos
.
remove
(
last
);
long
end
=
file
.
length
();
int
bufferLength
=
(
int
)
(
end
-
pos
);
Data
buff
=
Data
.
create
(
database
,
bufferLength
);
Data
buff
=
Data
.
create
(
database
,
bufferLength
,
true
);
file
.
seek
(
pos
);
file
.
readFully
(
buff
.
getBytes
(),
0
,
bufferLength
);
while
(
buff
.
length
()
<
bufferLength
)
{
...
...
@@ -146,7 +146,7 @@ public class UndoLog {
file
.
setCheckedWriting
(
false
);
file
.
setLength
(
FileStore
.
HEADER_LENGTH
);
}
Data
buff
=
Data
.
create
(
database
,
Constants
.
DEFAULT_PAGE_SIZE
);
Data
buff
=
Data
.
create
(
database
,
Constants
.
DEFAULT_PAGE_SIZE
,
true
);
for
(
int
i
=
0
;
i
<
records
.
size
();
i
++)
{
UndoLogRecord
r
=
records
.
get
(
i
);
buff
.
checkCapacity
(
Constants
.
DEFAULT_PAGE_SIZE
);
...
...
h2/src/main/org/h2/result/RowList.java
浏览文件 @
9dc12e68
...
...
@@ -90,7 +90,7 @@ public class RowList {
file
=
db
.
openFile
(
fileName
,
"rw"
,
false
);
file
.
setCheckedWriting
(
false
);
file
.
seek
(
FileStore
.
HEADER_LENGTH
);
rowBuff
=
Data
.
create
(
db
,
Constants
.
DEFAULT_PAGE_SIZE
);
rowBuff
=
Data
.
create
(
db
,
Constants
.
DEFAULT_PAGE_SIZE
,
true
);
file
.
seek
(
FileStore
.
HEADER_LENGTH
);
}
Data
buff
=
rowBuff
;
...
...
h2/src/main/org/h2/store/Data.java
浏览文件 @
9dc12e68
...
...
@@ -298,10 +298,13 @@ public class Data {
*
* @param handler the data handler
* @param capacity the initial capacity of the buffer
* @param storeLocalTime
* store DATE, TIME, and TIMESTAMP values with local time storage
* format
* @return the buffer
*/
public
static
Data
create
(
DataHandler
handler
,
int
capacity
)
{
return
new
Data
(
handler
,
new
byte
[
capacity
],
fals
e
);
public
static
Data
create
(
DataHandler
handler
,
int
capacity
,
boolean
storeLocalTime
)
{
return
new
Data
(
handler
,
new
byte
[
capacity
],
storeLocalTim
e
);
}
/**
...
...
@@ -310,10 +313,13 @@ public class Data {
*
* @param handler the data handler
* @param buff the data
* @param storeLocalTime
* store DATE, TIME, and TIMESTAMP values with local time storage
* format
* @return the buffer
*/
public
static
Data
create
(
DataHandler
handler
,
byte
[]
buff
)
{
return
new
Data
(
handler
,
buff
,
fals
e
);
public
static
Data
create
(
DataHandler
handler
,
byte
[]
buff
,
boolean
storeLocalTime
)
{
return
new
Data
(
handler
,
buff
,
storeLocalTim
e
);
}
/**
...
...
h2/src/main/org/h2/store/FileStoreInputStream.java
浏览文件 @
9dc12e68
...
...
@@ -33,7 +33,7 @@ public class FileStoreInputStream extends InputStream {
}
else
{
compress
=
null
;
}
page
=
Data
.
create
(
handler
,
Constants
.
FILE_BLOCK_SIZE
);
page
=
Data
.
create
(
handler
,
Constants
.
FILE_BLOCK_SIZE
,
true
);
try
{
if
(
store
.
length
()
<=
FileStore
.
HEADER_LENGTH
)
{
close
();
...
...
h2/src/main/org/h2/store/FileStoreOutputStream.java
浏览文件 @
9dc12e68
...
...
@@ -31,7 +31,7 @@ public class FileStoreOutputStream extends OutputStream {
this
.
compress
=
null
;
this
.
compressionAlgorithm
=
null
;
}
page
=
Data
.
create
(
handler
,
Constants
.
FILE_BLOCK_SIZE
);
page
=
Data
.
create
(
handler
,
Constants
.
FILE_BLOCK_SIZE
,
true
);
}
@Override
...
...
h2/src/main/org/h2/store/PageStore.java
浏览文件 @
9dc12e68
...
...
@@ -869,7 +869,7 @@ public class PageStore implements CacheWriter {
private
void
readStaticHeader
()
{
file
.
seek
(
FileStore
.
HEADER_LENGTH
);
Data
page
=
Data
.
create
(
database
,
new
byte
[
PAGE_SIZE_MIN
-
FileStore
.
HEADER_LENGTH
]);
new
byte
[
PAGE_SIZE_MIN
-
FileStore
.
HEADER_LENGTH
]
,
false
);
file
.
readFully
(
page
.
getBytes
(),
0
,
PAGE_SIZE_MIN
-
FileStore
.
HEADER_LENGTH
);
readCount
++;
...
...
@@ -941,7 +941,7 @@ public class PageStore implements CacheWriter {
}
private
void
writeStaticHeader
()
{
Data
page
=
Data
.
create
(
database
,
new
byte
[
pageSize
-
FileStore
.
HEADER_LENGTH
]);
Data
page
=
Data
.
create
(
database
,
new
byte
[
pageSize
-
FileStore
.
HEADER_LENGTH
]
,
false
);
page
.
writeInt
(
pageSize
);
page
.
writeByte
((
byte
)
WRITE_VERSION
);
page
.
writeByte
((
byte
)
READ_VERSION
);
...
...
@@ -1281,7 +1281,7 @@ public class PageStore implements CacheWriter {
* @return the data page.
*/
public
Data
createData
()
{
return
Data
.
create
(
database
,
new
byte
[
pageSize
]);
return
Data
.
create
(
database
,
new
byte
[
pageSize
]
,
false
);
}
/**
...
...
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
9dc12e68
...
...
@@ -486,7 +486,7 @@ public class Recover extends Tool implements DataHandler {
}
catch
(
Exception
e
)
{
writeError
(
writer
,
e
);
}
Data
s
=
Data
.
create
(
this
,
128
);
Data
s
=
Data
.
create
(
this
,
128
,
false
);
seek
(
0
);
store
.
readFully
(
s
.
getBytes
(),
0
,
128
);
s
.
setPos
(
48
);
...
...
@@ -503,7 +503,7 @@ public class Recover extends Tool implements DataHandler {
}
long
pageCount
=
length
/
pageSize
;
parents
=
new
int
[(
int
)
pageCount
];
s
=
Data
.
create
(
this
,
pageSize
);
s
=
Data
.
create
(
this
,
pageSize
,
false
);
for
(
long
i
=
3
;
i
<
pageCount
;
i
++)
{
s
.
reset
();
seek
(
i
);
...
...
@@ -513,7 +513,7 @@ public class Recover extends Tool implements DataHandler {
parents
[(
int
)
i
]
=
s
.
readInt
();
}
int
logKey
=
0
,
logFirstTrunkPage
=
0
,
logFirstDataPage
=
0
;
s
=
Data
.
create
(
this
,
pageSize
);
s
=
Data
.
create
(
this
,
pageSize
,
false
);
for
(
long
i
=
1
;;
i
++)
{
if
(
i
==
3
)
{
break
;
...
...
@@ -789,9 +789,9 @@ public class Recover extends Tool implements DataHandler {
}
private
void
dumpPageStore
(
PrintWriter
writer
,
long
pageCount
)
{
Data
s
=
Data
.
create
(
this
,
pageSize
);
Data
s
=
Data
.
create
(
this
,
pageSize
,
false
);
for
(
long
page
=
3
;
page
<
pageCount
;
page
++)
{
s
=
Data
.
create
(
this
,
pageSize
);
s
=
Data
.
create
(
this
,
pageSize
,
false
);
seek
(
page
);
store
.
readFully
(
s
.
getBytes
(),
0
,
pageSize
);
dumpPage
(
writer
,
s
,
page
,
pageCount
);
...
...
@@ -899,7 +899,7 @@ public class Recover extends Tool implements DataHandler {
private
void
dumpPageLogStream
(
PrintWriter
writer
,
int
logKey
,
int
logFirstTrunkPage
,
int
logFirstDataPage
,
long
pageCount
)
throws
IOException
{
Data
s
=
Data
.
create
(
this
,
pageSize
);
Data
s
=
Data
.
create
(
this
,
pageSize
,
false
);
DataReader
in
=
new
DataReader
(
new
PageInputStream
(
writer
,
this
,
store
,
logKey
,
logFirstTrunkPage
,
logFirstDataPage
,
pageSize
)
...
...
@@ -968,7 +968,7 @@ public class Recover extends Tool implements DataHandler {
}
writer
.
println
(
"-- undo page "
+
pageId
+
" "
+
typeName
);
if
(
trace
)
{
Data
d
=
Data
.
create
(
null
,
data
);
Data
d
=
Data
.
create
(
null
,
data
,
false
);
dumpPage
(
writer
,
d
,
pageId
,
pageCount
);
}
}
else
if
(
x
==
PageLog
.
ADD
)
{
...
...
@@ -1094,7 +1094,7 @@ public class Recover extends Tool implements DataHandler {
this
.
logKey
=
logKey
-
1
;
this
.
nextTrunkPage
=
firstTrunkPage
;
this
.
dataPage
=
firstDataPage
;
page
=
Data
.
create
(
handler
,
pageSize
);
page
=
Data
.
create
(
handler
,
pageSize
,
false
);
}
@Override
...
...
@@ -1379,7 +1379,7 @@ public class Recover extends Tool implements DataHandler {
writer
.
println
(
"-- empty: "
+
empty
);
}
if
(!
last
)
{
Data
s2
=
Data
.
create
(
this
,
pageSize
);
Data
s2
=
Data
.
create
(
this
,
pageSize
,
false
);
s
.
setPos
(
pageSize
);
long
parent
=
pageId
;
while
(
true
)
{
...
...
h2/src/test/org/h2/test/unit/TestDataPage.java
浏览文件 @
9dc12e68
...
...
@@ -72,7 +72,7 @@ public class TestDataPage extends TestBase implements DataHandler {
}
private
static
void
testPerformance
()
{
Data
data
=
Data
.
create
(
null
,
1024
);
Data
data
=
Data
.
create
(
null
,
1024
,
false
);
for
(
int
j
=
0
;
j
<
4
;
j
++)
{
long
time
=
System
.
nanoTime
();
for
(
int
i
=
0
;
i
<
100000
;
i
++)
{
...
...
@@ -217,7 +217,17 @@ public class TestDataPage extends TestBase implements DataHandler {
}
private
void
testValue
(
Value
v
)
{
Data
data
=
Data
.
create
(
null
,
1024
);
testValue
(
v
,
false
);
switch
(
v
.
getType
())
{
case
Value
.
DATE
:
case
Value
.
TIME
:
case
Value
.
TIMESTAMP
:
testValue
(
v
,
true
);
}
}
private
void
testValue
(
Value
v
,
boolean
storeLocalTime
)
{
Data
data
=
Data
.
create
(
null
,
1024
,
storeLocalTime
);
data
.
checkCapacity
((
int
)
v
.
getPrecision
());
data
.
writeValue
(
v
);
data
.
writeInt
(
123
);
...
...
@@ -229,7 +239,7 @@ public class TestDataPage extends TestBase implements DataHandler {
}
private
void
testAll
()
{
Data
page
=
Data
.
create
(
this
,
128
);
Data
page
=
Data
.
create
(
this
,
128
,
false
);
char
[]
data
=
new
char
[
0x10000
];
for
(
int
i
=
0
;
i
<
data
.
length
;
i
++)
{
...
...
h2/src/test/org/h2/test/utils/MemoryFootprint.java
浏览文件 @
9dc12e68
...
...
@@ -33,7 +33,7 @@ public class MemoryFootprint {
print
(
"BigDecimal"
,
new
BigDecimal
(
"0"
));
print
(
"BigInteger"
,
new
BigInteger
(
"0"
));
print
(
"String"
,
new
String
(
"Hello"
));
print
(
"Data"
,
Data
.
create
(
null
,
10
));
print
(
"Data"
,
Data
.
create
(
null
,
10
,
false
));
print
(
"Row"
,
new
RowImpl
(
new
Value
[
0
],
0
));
System
.
out
.
println
();
for
(
int
i
=
1
;
i
<
128
;
i
+=
i
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论