Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
20632297
提交
20632297
authored
5月 19, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reuse space after deleting or updating many rows in a b-tree index.
上级
046a5037
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
48 行增加
和
16 行删除
+48
-16
changelog.html
h2/src/docsrc/html/changelog.html
+6
-3
SysProperties.java
h2/src/main/org/h2/constant/SysProperties.java
+6
-0
BtreeIndex.java
h2/src/main/org/h2/index/BtreeIndex.java
+2
-2
Storage.java
h2/src/main/org/h2/store/Storage.java
+7
-4
Recover.java
h2/src/main/org/h2/tools/Recover.java
+25
-1
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+2
-6
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
20632297
...
...
@@ -18,9 +18,12 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
When using Turkish as the default locale, sometimes columns could not be accessed
using the lowercase column alias or name. This affects locales where String.toUpper("a...z") does not
result in "A...Z", which is so far only Turkish, where "i".toUpperCase() is "I" with dot above.
<ul><li>
When deleting or updating many rows in a table, the space in the index
file was not re-used in the default mode (persistent database, b-tree index,
LOG=1). This caused the index file to grow over time. Workarounds were to
delete and re-created the index file, alter the table (add a remove a column),
or use LOG=2. To disable the change, set the system property
h2.reuseSpaceBtreeIndex to false.
</li><li>
Identifiers with a digit and then a dollar sign didn't work. Example: A1$B.
</li><li>
MS SQL Server compatibility: support for linked tables with
NVARCHAR, NCHAR, NCLOB, and LONGNVARCHAR.
...
...
h2/src/main/org/h2/constant/SysProperties.java
浏览文件 @
20632297
...
...
@@ -513,6 +513,12 @@ public class SysProperties {
*/
public
static
final
int
REUSE_SPACE_AFTER
=
getIntSetting
(
"h2.reuseSpaceAfter"
,
32
);
/**
* System property <code>h2.reuseSpaceBtreeIndex</code> (default: true).<br />
* Reuse space after deleting or updating many rows in a b-tree index.
*/
public
static
final
boolean
REUSE_SPACE_BTREE_INDEX
=
getBooleanSetting
(
"h2.reuseSpaceBtreeIndex"
,
true
);
/**
* System property <code>h2.reuseSpaceQuickly</code> (default: true).<br />
* Reuse space in database files quickly.
...
...
h2/src/main/org/h2/index/BtreeIndex.java
浏览文件 @
20632297
...
...
@@ -142,7 +142,7 @@ public class BtreeIndex extends BaseIndex implements RecordReader {
* @param p the page to update
*/
void
updatePage
(
Session
session
,
Record
p
)
throws
SQLException
{
if
(
database
.
getLogIndexChanges
())
{
if
(
SysProperties
.
REUSE_SPACE_BTREE_INDEX
||
database
.
getLogIndexChanges
())
{
storage
.
addRecord
(
session
,
p
,
p
.
getPos
());
}
else
{
storage
.
updateRecord
(
session
,
p
);
...
...
@@ -156,7 +156,7 @@ public class BtreeIndex extends BaseIndex implements RecordReader {
* @param p the page to remove
*/
void
deletePage
(
Session
session
,
Record
p
)
throws
SQLException
{
if
(
database
.
getLogIndexChanges
())
{
if
(
SysProperties
.
REUSE_SPACE_BTREE_INDEX
||
database
.
getLogIndexChanges
())
{
storage
.
removeRecord
(
session
,
p
.
getPos
());
}
}
...
...
h2/src/main/org/h2/store/Storage.java
浏览文件 @
20632297
...
...
@@ -424,10 +424,13 @@ public class Storage {
}
private
void
checkOnePage
()
throws
SQLException
{
pageCheckIndex
=
(
pageCheckIndex
+
1
)
%
pages
.
size
();
int
page
=
pages
.
get
(
pageCheckIndex
);
if
(
file
.
isPageFree
(
page
)
&&
file
.
getPageOwner
(
page
)
==
id
)
{
file
.
freePage
(
page
);
int
size
=
pages
.
size
();
if
(
size
>
0
)
{
pageCheckIndex
=
(
pageCheckIndex
+
1
)
%
size
;
int
page
=
pages
.
get
(
pageCheckIndex
);
if
(
file
.
isPageFree
(
page
)
&&
file
.
getPageOwner
(
page
)
==
id
)
{
file
.
freePage
(
page
);
}
}
}
...
...
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
20632297
...
...
@@ -679,7 +679,31 @@ public class Recover extends Tool implements DataHandler {
}
else
{
pageOwners
[
page
]
=
storageId
;
}
writer
.
println
(
"// ["
+
block
+
"] page:"
+
page
+
" blocks:"
+
blockCount
+
" storage:"
+
storageId
);
String
data
=
""
;
int
type
=
s
.
readByte
();
int
len
;
switch
(
type
)
{
case
'L'
:
boolean
pos
=
s
.
readByte
()
==
'P'
;
len
=
s
.
readInt
();
data
=
"leaf("
+
len
+
")"
;
if
(
pos
)
{
data
+=
" pos"
;
}
break
;
case
'N'
:
len
=
s
.
readInt
();
data
=
"node "
;
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
data
+=
"["
+
s
.
readInt
()
+
"]"
;
}
break
;
case
'H'
:
int
rootPos
=
s
.
readInt
();
data
=
"root ["
+
rootPos
+
"]"
;
break
;
}
writer
.
println
(
"// ["
+
block
+
"] page:"
+
page
+
" blocks:"
+
blockCount
+
" storage:"
+
storageId
+
" "
+
data
);
}
writer
.
close
();
}
catch
(
Throwable
e
)
{
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
20632297
...
...
@@ -286,16 +286,12 @@ java org.h2.test.TestAll timer
System
.
setProperty
(
"h2.maxMemoryRowsDistinct"
,
"128"
);
System
.
setProperty
(
"h2.check2"
,
"true"
);
// 2009-05-15: 25 test fail with page store (first loop)
// 2009-05-15: 25 tests fail with page store (first loop)
// 2009-05-18: 18 tests fail with page store (first loop)
// System.setProperty("h2.pageStore", "true");
/*
index grows:
runscript from '~/Desktop/merge.sql';
create table test(id int, name varchar, primary key(id, name));
@LOOP 10000 merge into test(id, name) values(?, 'test' || ?);
BaseIndex or TableData should have its own compareMode
(default is: Database.compareMode when created).
standard: COLLATE for each column (MySQL, SQL Server)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论