Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
1d514d5b
提交
1d514d5b
authored
6月 19, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
speed up opening large databases if data was deleted
上级
580ede19
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
123 行增加
和
18 行删除
+123
-18
changelog.html
h2/src/docsrc/html/changelog.html
+2
-1
ErrorCode.java
h2/src/main/org/h2/constant/ErrorCode.java
+7
-1
_messages_de.properties
h2/src/main/org/h2/res/_messages_de.properties
+1
-0
_messages_en.properties
h2/src/main/org/h2/res/_messages_en.properties
+1
-0
_messages_ja.properties
h2/src/main/org/h2/res/_messages_ja.properties
+1
-0
_messages_pl.properties
h2/src/main/org/h2/res/_messages_pl.properties
+1
-0
_messages_pt_br.properties
h2/src/main/org/h2/res/_messages_pt_br.properties
+1
-0
DataPage.java
h2/src/main/org/h2/store/DataPage.java
+13
-3
DiskFile.java
h2/src/main/org/h2/store/DiskFile.java
+19
-2
Storage.java
h2/src/main/org/h2/store/Storage.java
+14
-2
IntArray.java
h2/src/main/org/h2/util/IntArray.java
+57
-8
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+6
-1
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
1d514d5b
...
...
@@ -17,7 +17,8 @@ Change Log
<h2>
Next Version (unreleased)
</h2>
<ul>
<li>
RUNSCRIPT could throw a NullPointerException if the script name was an expression.
<li>
Databases larger than 1 GB was sometimes very slow if a lot of data was deleted previously. Fixed.
</li><li>
RUNSCRIPT could throw a NullPointerException if the script name was an expression.
</li><li>
Improved compatibility. New compatibility modes for Oracle and Derby.
New compatibility flag uniqueIndexNullDistinct to only allow one row with 'NULL' in a unique
index. This flag is enabled for Derby, Oracle, MSSQLServer, and HSQLDB.
...
...
h2/src/main/org/h2/constant/ErrorCode.java
浏览文件 @
1d514d5b
...
...
@@ -1490,6 +1490,12 @@ public class ErrorCode {
*/
public
static
final
int
CANNOT_DROP_2
=
90107
;
/**
* The error with code <code>90108</code> is thrown when
* not enough memory was available to read a value from the disk.
*/
public
static
final
int
OUT_OF_MEMORY_1
=
90108
;
/**
* The error with code <code>90109</code> is thrown when
* trying to run a query against an invalid view.
...
...
@@ -1806,7 +1812,7 @@ public class ErrorCode {
*/
public
static
final
int
CAN_ONLY_ASSIGN_TO_VARIABLE_1
=
90137
;
// next is 901
08, 901
38
// next is 90138
private
ErrorCode
()
{
// utility class
...
...
h2/src/main/org/h2/res/_messages_de.properties
浏览文件 @
1d514d5b
...
...
@@ -129,6 +129,7 @@
90105
=
Fehler beim Aufruf eine benutzerdefinierten Funktion
90106
=
Kann {0} nicht zur
\u
00FCcksetzen per TRUNCATE
90107
=
Kann {0} nicht l
\u
00F6schen weil {1} davon abh
\u
00E4ngt
90108
=
Nicht genug Hauptspeicher. Anzahl Bytes
\:
{0}
90109
=
View {0} ist ung
\u
00FCltig
\:
{1}
90110
=
{0} ausserhalb des Bereichts
90111
=
Fehler beim Zugriff auf eine verkn
\u
00FCpfte Tabelle mit SQL Befehl {0}, Grund
\:
{1}
...
...
h2/src/main/org/h2/res/_messages_en.properties
浏览文件 @
1d514d5b
...
...
@@ -129,6 +129,7 @@
90105
=
Exception calling user-defined function
90106
=
Cannot truncate {0}
90107
=
Cannot drop {0} because {1} depends on it
90108
=
Out of memory. Size
\:
{0}
90109
=
View {0} is invalid
\:
{1}
90110
=
{0} out of range
90111
=
Error accessing linked table with SQL statement {0}, cause
\:
{1}
...
...
h2/src/main/org/h2/res/_messages_ja.properties
浏览文件 @
1d514d5b
...
...
@@ -129,6 +129,7 @@
90105
=
\u
30E6
\u
30FC
\u
30B6
\u
5B9A
\u
7FA9
\u
95A2
\u6570\u3092\u
5B9F
\u
884C
\u
4E2D
\u
306B
\u
4F8B
\u5916\u
304C
\u
767A
\u
751F
\u3057\u
307E
\u3057\u
305F
90106
=
{0}
\u3092\u
7A7A
\u
306B
\u3067\u
304D
\u
307E
\u
305B
\u3093
90107
=
{1}
\u
304C
\u
4F9D
\u
5B58
\u3057\u3066\u3044\u
308B
\u
305F
\u3081\u3001
{0}
\u3092\u
30C9
\u
30ED
\u
30C3
\u
30D7
\u3059\u
308B
\u3053\u3068\u
306F
\u3067\u
304D
\u
307E
\u
305B
\u3093
90108
=
\#
Out of memory. Size
\:
{0}
90109
=
\u
30D3
\u
30E5
\u
30FC {0}
\u
304C
\u7121\u
52B9
\u3067\u3059\:
{1}
90110
=
{0}
\u
306F
\u
7BC4
\u
56F2
\u5916\u3067\u3059
90111
=
SQL
\u
30B9
\u
30C6
\u
30FC
\u
30C8
\u
30E1
\u
30F3
\u
30C8 {0}
\u
306B
\u3088\u
308B
\u
7D50
\u5408\u
30C6
\u
30FC
\u
30D6
\u
30EB
\u
30A2
\u
30AF
\u
30BB
\u
30B9
\u
30A8
\u
30E9
\u
30FC
...
...
h2/src/main/org/h2/res/_messages_pl.properties
浏览文件 @
1d514d5b
...
...
@@ -129,6 +129,7 @@
90105
=
Wyjatek wywoluje funkcje uzytkownika
90106
=
Nie mozna obciac {0}
90107
=
Nie mozna skasowac {0} poniewaz zalezy od {1}
90108
=
\#
Out of memory. Size
\:
{0}
90109
=
Widok {0} jest nieprawidlowy
90110
=
{0} poza zakresem
90111
=
\#
Error accessing linked table with SQL statement {0}, cause
\:
{1}
...
...
h2/src/main/org/h2/res/_messages_pt_br.properties
浏览文件 @
1d514d5b
...
...
@@ -129,6 +129,7 @@
90105
=
Exce
\u
00E7
\u
00E3o na chamada da fun
\u
00E7
\u
00E3o definida pelo usu
\u
00E1rio
90106
=
N
\u
00E3o pode fazer o truncate {0}
90107
=
N
\u
00E3o pode apagar {0} por que depende de {1}
90108
=
\#
Out of memory. Size
\:
{0}
90109
=
Vista {0}
\u
00E9 inv
\u
00E1lida
\:
{1}
90110
=
{0} out of range
90111
=
Erro ao acessar a tabela lincada com a instru
\u
00E7
\u
00E3o SQL {0}, causa
\:
{1}
...
...
h2/src/main/org/h2/store/DataPage.java
浏览文件 @
1d514d5b
...
...
@@ -545,13 +545,13 @@ public abstract class DataPage {
}
case
Value
.
JAVA_OBJECT
:
{
int
len
=
readInt
();
byte
[]
b
=
new
byte
[
len
]
;
byte
[]
b
=
createByteArray
(
len
)
;
read
(
b
,
0
,
len
);
return
ValueJavaObject
.
getNoCopy
(
b
);
}
case
Value
.
BYTES
:
{
int
len
=
readInt
();
byte
[]
b
=
new
byte
[
len
]
;
byte
[]
b
=
createByteArray
(
len
)
;
read
(
b
,
0
,
len
);
return
ValueBytes
.
getNoCopy
(
b
);
}
...
...
@@ -571,7 +571,7 @@ public abstract class DataPage {
case
Value
.
CLOB
:
{
int
smallLen
=
readInt
();
if
(
smallLen
>=
0
)
{
byte
[]
small
=
new
byte
[
smallLen
]
;
byte
[]
small
=
createByteArray
(
smallLen
)
;
read
(
small
,
0
,
smallLen
);
return
ValueLob
.
createSmallLob
(
dataType
,
small
);
}
...
...
@@ -604,6 +604,16 @@ public abstract class DataPage {
throw
Message
.
getInternalError
(
"type="
+
dataType
);
}
}
private
byte
[]
createByteArray
(
int
len
)
{
try
{
return
new
byte
[
len
];
}
catch
(
OutOfMemoryError
e
)
{
Error
e2
=
new
OutOfMemoryError
(
"Requested memory: "
+
len
);
e2
.
initCause
(
e
);
throw
e2
;
}
}
/**
* Fill up the buffer with empty space and an (initially empty) checksum
...
...
h2/src/main/org/h2/store/DiskFile.java
浏览文件 @
1d514d5b
...
...
@@ -176,11 +176,28 @@ public class DiskFile implements CacheWriter {
}
private
void
freeUnusedPages
()
throws
SQLException
{
// first, store the unused pages and current owner in a temporary list
IntArray
freePages
=
new
IntArray
();
HashSet
owners
=
new
HashSet
();
for
(
int
i
=
0
;
i
<
pageOwners
.
size
();
i
++)
{
if
(
pageOwners
.
get
(
i
)
!=
FREE_PAGE
&&
isPageFree
(
i
))
{
setPageOwner
(
i
,
FREE_PAGE
);
int
owner
=
pageOwners
.
get
(
i
);
if
(
owner
!=
FREE_PAGE
&&
isPageFree
(
i
))
{
owners
.
add
(
ObjectUtils
.
getInteger
(
owner
));
freePages
.
add
(
i
);
}
}
// now, for each current owner, remove those
// this is much faster than removing them individually
// as this would cause O(n^2) behavior
for
(
Iterator
it
=
owners
.
iterator
();
it
.
hasNext
();)
{
int
owner
=
((
Integer
)
it
.
next
()).
intValue
();
database
.
getStorage
(
owner
,
this
).
removePages
(
freePages
);
}
// now free up the pages
for
(
int
i
=
0
;
i
<
freePages
.
size
();
i
++)
{
int
idx
=
freePages
.
get
(
i
);
setPageOwner
(
idx
,
FREE_PAGE
);
}
}
/**
...
...
h2/src/main/org/h2/store/Storage.java
浏览文件 @
1d514d5b
...
...
@@ -131,7 +131,7 @@ public class Storage {
int
page
=
file
.
getPage
(
next
);
if
(
lastCheckedPage
!=
page
)
{
if
(
pageIndex
<
0
)
{
pageIndex
=
pages
.
findNext
ValueIndex
(
page
);
pageIndex
=
pages
.
findNext
IndexSorted
(
page
);
}
else
{
pageIndex
++;
}
...
...
@@ -352,13 +352,25 @@ public class Storage {
pages
.
addValueSorted
(
i
);
}
/**
* Remove a list of page from this storage.
*
* @param removeSorted the pages to remove
*/
void
removePages
(
IntArray
removeSorted
)
{
pages
.
removeAllSorted
(
removeSorted
);
}
/**
* Remove a page from this storage.
*
* @param i the page to remove
*/
void
removePage
(
int
i
)
{
pages
.
removeValue
(
i
);
int
idx
=
pages
.
findIndexSorted
(
i
);
if
(
idx
!=
-
1
)
{
pages
.
remove
(
idx
);
}
}
private
void
checkOnePage
()
throws
SQLException
{
...
...
h2/src/main/org/h2/util/IntArray.java
浏览文件 @
1d514d5b
...
...
@@ -201,6 +201,44 @@ public class IntArray {
throw
Message
.
getInternalError
();
}
/**
* Remove the last element of this list that matches this value.
*
* @param value the value to be remove
*/
public
void
removeLastValue
(
int
value
)
{
for
(
int
i
=
size
-
1
;
i
>=
0
;
i
--)
{
if
(
data
[
i
]
==
value
)
{
remove
(
i
);
return
;
}
}
throw
Message
.
getInternalError
();
}
/**
* Return the index with a this value.
* If the list is not sorted, the result of this operation is undefined.
*
* @param value the value to find
* @return the index or -1 if not found
*/
public
int
findIndexSorted
(
int
value
)
{
int
l
=
0
,
r
=
size
;
while
(
l
<
r
)
{
int
i
=
(
l
+
r
)
>>>
1
;
int
d
=
data
[
i
];
if
(
d
==
value
)
{
return
i
;
}
else
if
(
d
>
value
)
{
r
=
i
;
}
else
{
l
=
i
+
1
;
}
}
return
-
1
;
}
/**
* Return the next index with a value larger than this one.
* If the list is not sorted, the result of this operation is undefined.
...
...
@@ -208,7 +246,7 @@ public class IntArray {
* @param value the value to find
* @return the index
*/
public
int
findNext
ValueIndex
(
int
value
)
{
public
int
findNext
IndexSorted
(
int
value
)
{
int
l
=
0
,
r
=
size
;
while
(
l
<
r
)
{
int
i
=
(
l
+
r
)
>>>
1
;
...
...
@@ -220,13 +258,6 @@ public class IntArray {
}
}
return
l
;
// for(int i=0; i<size; i++) {
// if(data[i] >= value) {
// return i;
// }
// }
// return size;
}
/**
...
...
@@ -251,6 +282,24 @@ public class IntArray {
public
void
toArray
(
int
[]
array
)
{
System
.
arraycopy
(
data
,
0
,
array
,
0
,
size
);
}
/**
* Remove all values from the given sorted list from this sorted list.
*
* @param removeSorted the value to remove
*/
public
void
removeAllSorted
(
IntArray
removeSorted
)
{
int
[]
d
=
new
int
[
data
.
length
];
int
newSize
=
0
;
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
int
old
=
data
[
i
];
if
(
removeSorted
.
findIndexSorted
(
old
)
==
-
1
)
{
d
[
newSize
++]
=
old
;
}
}
data
=
d
;
size
=
newSize
;
}
// ArrayList data = new ArrayList();
//
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
1d514d5b
...
...
@@ -265,9 +265,14 @@ java org.h2.test.TestAll timer
System
.
setProperty
(
"h2.maxMemoryRowsDistinct"
,
"128"
);
/*
move DataPage.createByteArray to ByteUtils, improve message
run the performance tests as part of the unit test
switch to JDK 1.6 by default
integrate java queries
jazoon
H2 Console should support Java Queries
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论