Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
589f38be
提交
589f38be
authored
7月 04, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
New experimental page store.
上级
9c219404
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
33 行增加
和
29 行删除
+33
-29
PageBtreeIndex.java
h2/src/main/org/h2/index/PageBtreeIndex.java
+6
-0
PageScanIndex.java
h2/src/main/org/h2/index/PageScanIndex.java
+7
-6
PageInputStream.java
h2/src/main/org/h2/store/PageInputStream.java
+0
-3
PageStore.java
h2/src/main/org/h2/store/PageStore.java
+15
-20
PageStreamTrunk.java
h2/src/main/org/h2/store/PageStreamTrunk.java
+5
-0
没有找到文件。
h2/src/main/org/h2/index/PageBtreeIndex.java
浏览文件 @
589f38be
...
...
@@ -135,6 +135,12 @@ public class PageBtreeIndex extends BaseIndex {
PageBtree
getPage
(
int
id
)
throws
SQLException
{
Record
rec
=
store
.
getRecord
(
id
);
if
(
rec
!=
null
)
{
if
(
SysProperties
.
CHECK
)
{
PageBtree
result
=
(
PageBtree
)
rec
;
if
(
result
.
index
.
headPos
!=
this
.
headPos
)
{
throw
Message
.
throwInternalError
(
"Wrong index: "
+
result
.
index
+
" "
+
this
);
}
}
return
(
PageBtree
)
rec
;
}
DataPage
data
=
store
.
readPage
(
id
);
...
...
h2/src/main/org/h2/index/PageScanIndex.java
浏览文件 @
589f38be
...
...
@@ -14,6 +14,7 @@ import java.util.Iterator;
import
java.util.List
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.SysProperties
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Session
;
import
org.h2.log.UndoLogRecord
;
...
...
@@ -71,12 +72,6 @@ public class PageScanIndex extends BaseIndex implements RowIndex {
store
.
addMeta
(
this
,
session
,
headPos
);
PageDataLeaf
root
=
new
PageDataLeaf
(
this
,
headPos
,
Page
.
ROOT
,
store
.
createDataPage
());
store
.
updateRecord
(
root
,
true
,
root
.
data
);
// } else if (store.isNew()) {
// // the system table for a new database
// PageDataLeaf root = new PageDataLeaf(this, headPos,
// Page.ROOT, store.createDataPage());
// store.updateRecord(root, true, root.data);
}
else
{
this
.
headPos
=
headPos
;
PageData
root
=
getPage
(
headPos
,
0
);
...
...
@@ -168,6 +163,12 @@ public class PageScanIndex extends BaseIndex implements RowIndex {
PageData
getPage
(
int
id
,
int
parent
)
throws
SQLException
{
Record
rec
=
store
.
getRecord
(
id
);
if
(
rec
!=
null
)
{
if
(
SysProperties
.
CHECK
)
{
PageData
result
=
(
PageData
)
rec
;
if
(
result
.
index
.
headPos
!=
this
.
headPos
)
{
throw
Message
.
throwInternalError
(
"Wrong index: "
+
result
.
index
+
" "
+
this
);
}
}
return
(
PageData
)
rec
;
}
DataPage
data
=
store
.
readPage
(
id
);
...
...
h2/src/main/org/h2/store/PageInputStream.java
浏览文件 @
589f38be
...
...
@@ -124,9 +124,6 @@ public class PageInputStream extends InputStream {
store
.
allocatePage
(
n
);
}
trunkPage
=
t
.
getNextTrunk
();
if
(
trunkPage
!=
0
)
{
break
;
}
}
}
...
...
h2/src/main/org/h2/store/PageStore.java
浏览文件 @
589f38be
...
...
@@ -117,6 +117,7 @@ public class PageStore implements CacheWriter {
// remove CacheObject.blockCount
// remove Record.getMemorySize
// simplify InDoubtTransaction
// remove parameter in Record.write(DataPage buff)
/**
* The smallest possible page size.
...
...
@@ -135,7 +136,6 @@ public class PageStore implements CacheWriter {
private
static
final
int
PAGE_ID_FREE_LIST_ROOT
=
3
;
private
static
final
int
PAGE_ID_META_ROOT
=
4
;
private
static
final
int
PAGE_ID_LOG_TRUNK
=
5
;
private
static
final
int
MIN_PAGE_COUNT
=
6
;
...
...
@@ -200,7 +200,7 @@ public class PageStore implements CacheWriter {
this
.
database
=
database
;
trace
=
database
.
getTrace
(
Trace
.
PAGE_STORE
);
int
test
;
//trace.setLevel(TraceSystem.DEBUG);
//
trace.setLevel(TraceSystem.DEBUG);
this
.
cacheSize
=
cacheSizeDefault
;
String
cacheType
=
database
.
getCacheType
();
this
.
cache
=
CacheLRU
.
getCache
(
this
,
cacheType
,
cacheSize
);
...
...
@@ -490,7 +490,6 @@ public class PageStore implements CacheWriter {
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"writeBack "
+
record
);
}
int
todoRemoveParameter
;
record
.
write
(
null
);
record
.
setChanged
(
false
);
}
...
...
@@ -582,6 +581,9 @@ public class PageStore implements CacheWriter {
if
(
pos
>=
pageCount
)
{
increaseFileSize
(
INCREMENT_PAGES
);
}
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"allocatePage "
+
pos
);
}
return
pos
;
}
}
...
...
@@ -853,10 +855,8 @@ public class PageStore implements CacheWriter {
index
.
getTable
().
removeIndex
(
index
);
if
(
index
instanceof
PageBtreeIndex
)
{
index
.
getSchema
().
remove
(
index
);
}
else
if
(
index
instanceof
PageScanIndex
)
{
// TODO test why this doesn't work
// index.remove(null);
}
index
.
remove
(
systemSession
);
}
private
void
addMeta
(
Row
row
,
Session
session
,
boolean
redo
)
throws
SQLException
{
...
...
@@ -873,11 +873,8 @@ public class PageStore implements CacheWriter {
trace
.
debug
(
"addMeta id="
+
id
+
" type="
+
type
+
" parent="
+
parent
+
" columns="
+
columnList
);
}
if
(
redo
)
{
int
test
;
byte
[]
empty
=
new
byte
[
pageSize
];
file
.
seek
(
headPos
*
pageSize
);
file
.
write
(
empty
,
0
,
pageSize
);
removeRecord
(
headPos
);
writePage
(
headPos
,
createDataPage
());
allocatePage
(
headPos
);
}
if
(
type
==
META_TYPE_SCAN_INDEX
)
{
ObjectArray
<
Column
>
columnArray
=
ObjectArray
.
newInstance
();
...
...
@@ -941,18 +938,14 @@ public class PageStore implements CacheWriter {
Table
table
=
index
.
getTable
();
CompareMode
mode
=
table
.
getCompareMode
();
String
options
=
mode
.
getName
()+
","
+
mode
.
getStrength
();
addMeta
(
index
.
getId
(),
type
,
table
.
getId
(),
headPos
,
options
,
columnList
,
session
);
}
private
void
addMeta
(
int
id
,
int
type
,
int
parent
,
int
headPos
,
String
options
,
String
columnList
,
Session
session
)
throws
SQLException
{
Row
row
=
metaTable
.
getTemplateRow
();
row
.
setValue
(
0
,
ValueInt
.
get
(
i
d
));
row
.
setValue
(
0
,
ValueInt
.
get
(
i
ndex
.
getId
()
));
row
.
setValue
(
1
,
ValueInt
.
get
(
type
));
row
.
setValue
(
2
,
ValueInt
.
get
(
parent
));
row
.
setValue
(
2
,
ValueInt
.
get
(
table
.
getId
()
));
row
.
setValue
(
3
,
ValueInt
.
get
(
headPos
));
row
.
setValue
(
4
,
ValueString
.
get
(
options
));
row
.
setValue
(
5
,
ValueString
.
get
(
columnList
));
row
.
setPos
(
i
d
+
1
);
row
.
setPos
(
i
ndex
.
getId
()
+
1
);
metaIndex
.
add
(
session
,
row
);
}
...
...
@@ -963,9 +956,11 @@ public class PageStore implements CacheWriter {
* @param session the session
*/
public
void
removeMeta
(
Index
index
,
Session
session
)
throws
SQLException
{
if
(!
recoveryRunning
)
{
Row
row
=
metaIndex
.
getRow
(
session
,
index
.
getId
()
+
1
);
metaIndex
.
remove
(
session
,
row
);
}
}
private
void
updateChecksum
(
byte
[]
d
,
int
pos
)
{
int
ps
=
pageSize
;
...
...
h2/src/main/org/h2/store/PageStreamTrunk.java
浏览文件 @
589f38be
...
...
@@ -56,6 +56,11 @@ public class PageStreamTrunk extends Record {
store
.
readPage
(
getPos
(),
data
);
parent
=
data
.
readInt
();
int
t
=
data
.
readByte
();
if
(
t
==
Page
.
TYPE_EMPTY
)
{
// end of file
pageIds
=
new
int
[
0
];
return
;
}
if
(
t
!=
Page
.
TYPE_STREAM_TRUNK
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
FILE_CORRUPTED_1
,
"pos:"
+
getPos
()
+
" type:"
+
t
+
" parent:"
+
parent
+
" expected type:"
+
Page
.
TYPE_STREAM_TRUNK
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论