Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
4463dbfa
提交
4463dbfa
authored
12月 26, 2006
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
4887e417
显示空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
224 行增加
和
65 行删除
+224
-65
ant-build.properties
h2/ant-build.properties
+5
-0
build.xml
h2/build.xml
+18
-6
advanced.html
h2/src/docsrc/html/advanced.html
+13
-4
build.html
h2/src/docsrc/html/build.html
+14
-2
history.html
h2/src/docsrc/html/history.html
+14
-1
Constants.java
h2/src/main/org/h2/engine/Constants.java
+3
-0
Session.java
h2/src/main/org/h2/engine/Session.java
+27
-0
BtreeIndex.java
h2/src/main/org/h2/index/BtreeIndex.java
+0
-2
BtreeLeaf.java
h2/src/main/org/h2/index/BtreeLeaf.java
+2
-3
BtreeNode.java
h2/src/main/org/h2/index/BtreeNode.java
+2
-3
ScanIndex.java
h2/src/main/org/h2/index/ScanIndex.java
+5
-1
FtpControl.java
h2/src/main/org/h2/server/ftp/FtpControl.java
+2
-1
Value.java
h2/src/main/org/h2/value/Value.java
+5
-1
ValueLob.java
h2/src/main/org/h2/value/ValueLob.java
+4
-0
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+3
-35
test.properties
h2/src/test/org/h2/test/bench/test.properties
+6
-5
TestCases.java
h2/src/test/org/h2/test/db/TestCases.java
+1
-1
TestLob.java
h2/src/test/org/h2/test/db/TestLob.java
+100
-0
没有找到文件。
h2/ant-build.properties
0 → 100644
浏览文件 @
4463dbfa
# properties for build.xml
jdk
=
1.4
version.name.maven
=
1.0.20061217
javac
=
javac
benchmark.drivers.dir
=
D:/data/java
h2/build.xml
浏览文件 @
4463dbfa
<project
name=
"h2"
default=
"all"
basedir=
"."
>
<project
name=
"h2"
default=
"all"
basedir=
"."
>
<property
name=
"version.name"
value=
"1.0.20061217"
/>
<property
file=
"ant-build.properties"
/>
<!--
<property name="version.name.maven" value="1.0.20061217"/>
<property name="jdk" value="1.4"/>
<property name="jdk" value="1.4"/>
<property name="javac" value="javac"/>
<property name="javac" value="javac"/>
-->
<path
id=
"benchmark.drivers.path"
>
<path
id=
"benchmark.drivers.path"
>
<!-- jar files required by the benchmark -->
<!-- jar files required by the benchmark -->
<pathelement
location=
"bin"
/>
<pathelement
location=
"bin"
/>
<pathelement
path=
"${java.class.path}/"
/>
<pathelement
path=
"${java.class.path}/"
/>
<fileset
dir=
"
D:/data/java
"
>
<fileset
dir=
"
${benchmark.drivers.dir}
"
>
<include
name=
"**/*.jar"
/>
<include
name=
"**/*.jar"
/>
</fileset>
</fileset>
</path>
</path>
...
@@ -62,18 +65,27 @@
...
@@ -62,18 +65,27 @@
<java
classname=
"org.h2.tools.code.CodeSwitch"
fork=
"true"
dir=
"src/tools"
>
<java
classname=
"org.h2.tools.code.CodeSwitch"
fork=
"true"
dir=
"src/tools"
>
<arg
line=
"+JDK13 -JDK14 -JDK16 ../main/org/h2"
/>
<arg
line=
"+JDK13 -JDK14 -JDK16 ../main/org/h2"
/>
</java>
</java>
<propertyfile
file=
"build.properties"
>
<entry
key=
"jdk"
value=
"1.3"
/>
</propertyfile>
</target>
</target>
<target
name=
"codeswitch_jdk14"
depends=
"codeswitch_prepare"
>
<target
name=
"codeswitch_jdk14"
depends=
"codeswitch_prepare"
>
<java
classname=
"org.h2.tools.code.CodeSwitch"
fork=
"true"
dir=
"src/tools"
>
<java
classname=
"org.h2.tools.code.CodeSwitch"
fork=
"true"
dir=
"src/tools"
>
<arg
line=
"-JDK13 +JDK14 -JDK16 ../main/org/h2"
/>
<arg
line=
"-JDK13 +JDK14 -JDK16 ../main/org/h2"
/>
</java>
</java>
<propertyfile
file=
"build.properties"
>
<entry
key=
"jdk"
value=
"1.4"
/>
</propertyfile>
</target>
</target>
<target
name=
"codeswitch_jdk16"
depends=
"codeswitch_prepare"
>
<target
name=
"codeswitch_jdk16"
depends=
"codeswitch_prepare"
>
<java
classname=
"org.h2.tools.code.CodeSwitch"
fork=
"true"
dir=
"src/tools"
>
<java
classname=
"org.h2.tools.code.CodeSwitch"
fork=
"true"
dir=
"src/tools"
>
<arg
line=
"-JDK13 +JDK16 +JDK14 ../main/org/h2"
/>
<arg
line=
"-JDK13 +JDK16 +JDK14 ../main/org/h2"
/>
</java>
</java>
<propertyfile
file=
"build.properties"
>
<entry
key=
"jdk"
value=
"1.6"
/>
</propertyfile>
</target>
</target>
<target
name=
"compileResources"
depends=
"clean"
>
<target
name=
"compileResources"
depends=
"clean"
>
...
@@ -217,15 +229,15 @@
...
@@ -217,15 +229,15 @@
</target>
</target>
<target
name=
"mavenBuildCentral"
>
<target
name=
"mavenBuildCentral"
>
<copy
tofile=
"bin/h2-${version.name}.jar"
file=
"bin/h2.jar"
/>
<copy
tofile=
"bin/h2-${version.name
.maven
}.jar"
file=
"bin/h2.jar"
/>
<copy
tofile=
"bin/pom.xml"
filtering=
"true"
file=
"src/installer/pom.xml"
>
<copy
tofile=
"bin/pom.xml"
filtering=
"true"
file=
"src/installer/pom.xml"
>
<filterset>
<filterset>
<filter
token=
"version"
value=
"${version.name}"
/>
<filter
token=
"version"
value=
"${version.name
.maven
}"
/>
</filterset>
</filterset>
</copy>
</copy>
<zip
destfile=
"bin/h2-maven-${version.name}.jar"
basedir=
"bin"
>
<zip
destfile=
"bin/h2-maven-${version.name
.maven
}.jar"
basedir=
"bin"
>
<include
name=
"pom.xml"
/>
<include
name=
"pom.xml"
/>
<include
name=
"h2-${version.name}.jar"
/>
<include
name=
"h2-${version.name
.maven
}.jar"
/>
</zip>
</zip>
</target>
</target>
...
...
h2/src/docsrc/html/advanced.html
浏览文件 @
4463dbfa
...
@@ -42,7 +42,7 @@ Advanced Topics
...
@@ -42,7 +42,7 @@ Advanced Topics
<a
href=
"#uuid"
>
<a
href=
"#uuid"
>
Universally Unique Identifiers (UUID)
</a><br
/>
Universally Unique Identifiers (UUID)
</a><br
/>
<a
href=
"#system_properties"
>
<a
href=
"#system_properties"
>
H2
System Properties
</a><br
/>
Settings Read from
System Properties
</a><br
/>
<a
href=
"#glossary_links"
>
<a
href=
"#glossary_links"
>
Glossary and Links
</a><br
/>
Glossary and Links
</a><br
/>
...
@@ -192,6 +192,15 @@ database that failed, then restart the server that was stopped,
...
@@ -192,6 +192,15 @@ database that failed, then restart the server that was stopped,
and re-run the CreateCluster tool.
and re-run the CreateCluster tool.
</ul>
</ul>
<h3>
Clustering Algorithm and Limitations
</h3>
Read-only queries are only executed against the first cluster node, but all other statements are
executed against all nodes. There is currently no load balancing made to avoid problems with
transactions. The following functions may yield different results on different cluster nodes and must be
executed with care: RANDOM_UUID(), SECURE_RAND(), SESSION_ID(), MEMORY_FREE(), MEMORY_USED(),
CSVREAD(), CSVWRITE(), RAND() [when not using a seed]. Those functions should not be used
directly in modifying statements (for example INSERT, UPDATE, or MERGE). However, they can be used
in read-only statements and the result can then be used for modifying statements.
<br
/><a
name=
"two_phase_commit"
></a>
<br
/><a
name=
"two_phase_commit"
></a>
<h2>
Two Phase Commit
</h2>
<h2>
Two Phase Commit
</h2>
The two phase commit protocol is supported. 2-phase-commit works as follows:
The two phase commit protocol is supported. 2-phase-commit works as follows:
...
@@ -647,7 +656,7 @@ One's annual risk of being hit by a meteorite is estimated to be one chance in 1
...
@@ -647,7 +656,7 @@ One's annual risk of being hit by a meteorite is estimated to be one chance in 1
that means the probability is about 0.000'000'000'06.
that means the probability is about 0.000'000'000'06.
<br
/><a
name=
"system_properties"
></a>
<br
/><a
name=
"system_properties"
></a>
<h2>
H2
System Properties
</h2>
<h2>
Settings Read from
System Properties
</h2>
<p>
<p>
Some settings of the database can be set on the command line using
Some settings of the database can be set on the command line using
-DpropertyName=value. It is usually not required to change those settings manually.
-DpropertyName=value. It is usually not required to change those settings manually.
...
@@ -657,10 +666,10 @@ Example:
...
@@ -657,10 +666,10 @@ Example:
<pre>
<pre>
java -Dh2.serverCachedObjects=256 org.h2.tools.Server
java -Dh2.serverCachedObjects=256 org.h2.tools.Server
</pre>
</pre>
<p
re
>
<p>
The current value of the settings can be read in the table
The current value of the settings can be read in the table
INFORMATION_SCHEMA.SETTINGS
INFORMATION_SCHEMA.SETTINGS
</p
re
>
</p>
<table><tr>
<table><tr>
<th>
Setting
</th>
<th>
Setting
</th>
<th>
Default
</th>
<th>
Default
</th>
...
...
h2/src/docsrc/html/build.html
浏览文件 @
4463dbfa
...
@@ -58,14 +58,26 @@ The other targets may be used as well.
...
@@ -58,14 +58,26 @@ The other targets may be used as well.
<br
/><a
name=
"maven2"
></a>
<br
/><a
name=
"maven2"
></a>
<h2>
Using Maven 2
</h2>
<h2>
Using Maven 2
</h2>
To build and upload the H2 .jar file to the local Maven 2 repository, execute the following command:
<h3>
Using a Central Repository
</h3>
You can include the database in your Maven 2 project as a dependency.
The version is currently 1.0.
<
year
><
month
><
day
>
. Example:
<pre>
<
dependency
>
<
groupId
>
com.h2database
<
/groupId
>
<
artifactId
>
h2
<
/artifactId
>
<
version
>
1.0.20061217
<
/version
>
<
/dependency
>
</pre>
<h3>
Using Snapshot Version
</h3>
To build a 'snapshot' H2 .jar file and upload it the to the local Maven 2 repository, execute the following command:
<pre>
<pre>
ant mavenUploadLocal
ant mavenUploadLocal
</pre>
</pre>
Afterwards, you can include the database in your Maven 2 project as a dependency:
Afterwards, you can include the database in your Maven 2 project as a dependency:
<pre>
<pre>
<
dependency
>
<
dependency
>
<
groupId
>
org
.h2database
<
/groupId
>
<
groupId
>
com
.h2database
<
/groupId
>
<
artifactId
>
h2
<
/artifactId
>
<
artifactId
>
h2
<
/artifactId
>
<
version
>
1.0-SNAPSHOT
<
/version
>
<
version
>
1.0-SNAPSHOT
<
/version
>
<
/dependency
>
<
/dependency
>
...
...
h2/src/docsrc/html/history.html
浏览文件 @
4463dbfa
...
@@ -34,6 +34,18 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
...
@@ -34,6 +34,18 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
<h3>
Version 1.0 (Current)
</h3>
<h3>
Version 1.0 (Current)
</h3>
<h3>
Version 1.0 / 2007-TODO
</h3><ul>
<li>
If a CLOB or BLOB was deleted in a transaction and the database crashed before the transaction was committed or rolled back,
the object was lost if it was large. Fixed.
<li>
Now using ant-build.properties. The jdk is automatically updated when using ant codeswitch_...
<li>
Cluster: Now the server can detect if a query is read-only, and in this case the result is only read from the first cluster node.
However, there is currently no load balancing made to avoid problems with transactions / locking.
<li>
Many settings are now initialized from system properties and can be changed on the command line without having
recompile the database. See Advances / Settings Read from System Properties.
<li>
H2 is now available in Maven. The groupId is com.h2database, the artifactId h2 and the version 1.0.20061217.
To create the maven artifacts yourself, use 'ant mavenUploadLocal' and 'ant mavenBuildCentral'.
</ul>
<h3>
Version 1.0 / 2006-12-17
</h3><ul>
<h3>
Version 1.0 / 2006-12-17
</h3><ul>
<li>
Can be compiled with JDK 1.6. However, only very few of the JDBC 4.0 features are implemented so far.
<li>
Can be compiled with JDK 1.6. However, only very few of the JDBC 4.0 features are implemented so far.
<li>
The unit test of OpenJPA works now.
<li>
The unit test of OpenJPA works now.
...
@@ -1551,7 +1563,7 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
...
@@ -1551,7 +1563,7 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
<li>
Backup tool should work with other databases as well
<li>
Backup tool should work with other databases as well
<li>
Console: -ifExists doesn't work for the console. Add a flag to disable other dbs
<li>
Console: -ifExists doesn't work for the console. Add a flag to disable other dbs
<li>
Maybe use Fowler Noll Vo hash function
<li>
Maybe use Fowler Noll Vo hash function
<li>
Improved
Full text search (update index real-time or in a lower priority thread) Update now, update every n where n could be never
.
<li>
Improved
full text search (supports LOBs, readers / tokenizers / filters)
.
<li>
Update in-place
<li>
Update in-place
<li>
Check if 'FSUTIL behavior set disablelastaccess 1' improves the performance (fsutil behavior query disablelastaccess)
<li>
Check if 'FSUTIL behavior set disablelastaccess 1' improves the performance (fsutil behavior query disablelastaccess)
<li>
Remove finally() (almost) everywhere
<li>
Remove finally() (almost) everywhere
...
@@ -1592,6 +1604,7 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
...
@@ -1592,6 +1604,7 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
<li>
File_Read / File_Store funktionen: FILE_STORE('test.sql', ?), FILE_READ('test.sql')
<li>
File_Read / File_Store funktionen: FILE_STORE('test.sql', ?), FILE_READ('test.sql')
<li>
Public interface for functions (not public static)
<li>
Public interface for functions (not public static)
<li>
Index usage for IN(...), IN_ARRAY(..), and IN_ARRAY_RANGES(..); support ARRAY in JDBC API (variable size)
<li>
Index usage for IN(...), IN_ARRAY(..), and IN_ARRAY_RANGES(..); support ARRAY in JDBC API (variable size)
<li>
Change LOB mechanism (less files, keep index of lob files, point to files and row, delete unused files earlier)
</ul>
</ul>
<h3>
Not Planned
</h3>
<h3>
Not Planned
</h3>
...
...
h2/src/main/org/h2/engine/Constants.java
浏览文件 @
4463dbfa
...
@@ -11,8 +11,10 @@ package org.h2.engine;
...
@@ -11,8 +11,10 @@ package org.h2.engine;
* - System.out > trace messages
* - System.out > trace messages
*
*
* Release checklist
* Release checklist
* - Update latest version in docs: http://mirrors.ibiblio.org/pub/mirrors/maven2/com/h2database/h2/
* - ant jarClient, check jar file size
* - ant jarClient, check jar file size
* - try compiling with JDK 1.3, 1.4, 1.5 and 1.6
* - try compiling with JDK 1.3, 1.4, 1.5 and 1.6
* set path=C:\Programme\Java\jdk1.6.0\bin;%PATH%
* - change FAQ (next release planned, known bugs)
* - change FAQ (next release planned, known bugs)
* - check version, change build number in Constants.java and build.xml
* - check version, change build number in Constants.java and build.xml
* - check code coverage
* - check code coverage
...
@@ -48,6 +50,7 @@ package org.h2.engine;
...
@@ -48,6 +50,7 @@ package org.h2.engine;
*
*
* - Send a mail to Google Groups
* - Send a mail to Google Groups
* - newsletter: prepare, send (always send to BCC!!)
* - newsletter: prepare, send (always send to BCC!!)
* - http://maven.apache.org/guides/mini/guide-ibiblio-upload.html
*
*
* @author Thomas
* @author Thomas
*/
*/
...
...
h2/src/main/org/h2/engine/Session.java
浏览文件 @
4463dbfa
...
@@ -6,6 +6,8 @@ package org.h2.engine;
...
@@ -6,6 +6,8 @@ package org.h2.engine;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.Random
;
import
java.util.Random
;
import
org.h2.command.Command
;
import
org.h2.command.Command
;
...
@@ -26,6 +28,7 @@ import org.h2.store.UndoLogRecord;
...
@@ -26,6 +28,7 @@ import org.h2.store.UndoLogRecord;
import
org.h2.table.Table
;
import
org.h2.table.Table
;
import
org.h2.table.TableData
;
import
org.h2.table.TableData
;
import
org.h2.util.ObjectArray
;
import
org.h2.util.ObjectArray
;
import
org.h2.value.Value
;
/**
/**
* @author Thomas
* @author Thomas
...
@@ -55,6 +58,7 @@ public class Session implements SessionInterface {
...
@@ -55,6 +58,7 @@ public class Session implements SessionInterface {
private
boolean
allowLiterals
;
private
boolean
allowLiterals
;
private
String
currentSchemaName
;
private
String
currentSchemaName
;
private
String
traceModuleName
;
private
String
traceModuleName
;
private
HashSet
unlinkSet
;
public
Table
findLocalTempTable
(
String
name
)
{
public
Table
findLocalTempTable
(
String
name
)
{
Table
t
=
null
;
Table
t
=
null
;
...
@@ -192,6 +196,16 @@ public class Session implements SessionInterface {
...
@@ -192,6 +196,16 @@ public class Session implements SessionInterface {
undoLog
.
clear
();
undoLog
.
clear
();
cleanTempTables
();
cleanTempTables
();
}
}
if
(
unlinkSet
!=
null
&&
unlinkSet
.
size
()
>
0
)
{
// need to flush the log file, because we can't unlink lobs if the commit record is not written
logSystem
.
flush
();
Iterator
it
=
unlinkSet
.
iterator
();
while
(
it
.
hasNext
())
{
Value
v
=
(
Value
)
it
.
next
();
v
.
unlink
(
database
);
}
unlinkSet
=
null
;
}
unlockAll
();
unlockAll
();
}
}
...
@@ -447,4 +461,17 @@ public class Session implements SessionInterface {
...
@@ -447,4 +461,17 @@ public class Session implements SessionInterface {
return
database
;
return
database
;
}
}
public
void
unlinkAtCommit
(
Value
v
)
{
if
(
unlinkSet
==
null
)
{
unlinkSet
=
new
HashSet
();
}
unlinkSet
.
add
(
v
);
}
public
void
unlinkAtCommitStop
(
Value
v
)
{
if
(
unlinkSet
!=
null
)
{
unlinkSet
.
remove
(
v
);
}
}
}
}
h2/src/main/org/h2/index/BtreeIndex.java
浏览文件 @
4463dbfa
...
@@ -151,8 +151,6 @@ int count;
...
@@ -151,8 +151,6 @@ int count;
int
splitPoint
=
root
.
add
(
row
,
session
);
int
splitPoint
=
root
.
add
(
row
,
session
);
if
(
splitPoint
!=
0
)
{
if
(
splitPoint
!=
0
)
{
SearchRow
pivot
=
root
.
getData
(
splitPoint
);
SearchRow
pivot
=
root
.
getData
(
splitPoint
);
int
test
;
// deletePage(session, root);
BtreePage
page1
=
root
;
BtreePage
page1
=
root
;
BtreePage
page2
=
root
.
split
(
session
,
splitPoint
);
BtreePage
page2
=
root
.
split
(
session
,
splitPoint
);
setRoot
(
new
BtreeNode
(
this
,
page1
,
pivot
,
page2
));
setRoot
(
new
BtreeNode
(
this
,
page1
,
pivot
,
page2
));
...
...
h2/src/main/org/h2/index/BtreeLeaf.java
浏览文件 @
4463dbfa
...
@@ -129,9 +129,8 @@ public class BtreeLeaf extends BtreePage {
...
@@ -129,9 +129,8 @@ public class BtreeLeaf extends BtreePage {
public
BtreePage
split
(
Session
session
,
int
splitPoint
)
throws
SQLException
{
public
BtreePage
split
(
Session
session
,
int
splitPoint
)
throws
SQLException
{
ObjectArray
data
=
new
ObjectArray
();
ObjectArray
data
=
new
ObjectArray
();
int
max
=
pageData
.
size
();
int
max
=
pageData
.
size
();
int
test
;
if
(
Constants
.
CHECK
&&
index
.
getDatabase
().
getLogIndexChanges
()
&&
!
getDeleted
())
{
if
(
Constants
.
CHECK
&&
index
.
getDatabase
().
getLogIndexChanges
()
&&
!
getDeleted
())
{
//
page must have been deleted already before calling getSplitPoint()
//
page must have been deleted already before calling getSplitPoint()
throw
Message
.
getInternalError
();
throw
Message
.
getInternalError
();
}
}
for
(
int
i
=
splitPoint
;
i
<
max
;
i
++)
{
for
(
int
i
=
splitPoint
;
i
<
max
;
i
++)
{
...
...
h2/src/main/org/h2/index/BtreeNode.java
浏览文件 @
4463dbfa
...
@@ -176,7 +176,6 @@ public class BtreeNode extends BtreePage {
...
@@ -176,7 +176,6 @@ public class BtreeNode extends BtreePage {
IntArray
children
=
new
IntArray
();
IntArray
children
=
new
IntArray
();
splitPoint
++;
splitPoint
++;
int
max
=
pageData
.
size
();
int
max
=
pageData
.
size
();
int
test
;
if
(
Constants
.
CHECK
&&
index
.
getDatabase
().
getLogIndexChanges
()
&&
!
getDeleted
())
{
if
(
Constants
.
CHECK
&&
index
.
getDatabase
().
getLogIndexChanges
()
&&
!
getDeleted
())
{
// page must have been deleted already before calling getSplitPoint()
// page must have been deleted already before calling getSplitPoint()
throw
Message
.
getInternalError
();
throw
Message
.
getInternalError
();
...
...
h2/src/main/org/h2/index/ScanIndex.java
浏览文件 @
4463dbfa
...
@@ -94,6 +94,7 @@ public class ScanIndex extends Index {
...
@@ -94,6 +94,7 @@ public class ScanIndex extends Index {
for
(
int
i
=
0
;
i
<
row
.
getColumnCount
();
i
++)
{
for
(
int
i
=
0
;
i
<
row
.
getColumnCount
();
i
++)
{
Value
v
=
row
.
getValue
(
i
);
Value
v
=
row
.
getValue
(
i
);
Value
v2
=
v
.
link
(
database
,
getId
());
Value
v2
=
v
.
link
(
database
,
getId
());
session
.
unlinkAtCommitStop
(
v2
);
if
(
v
!=
v2
)
{
if
(
v
!=
v2
)
{
row
.
setValue
(
i
,
v2
);
row
.
setValue
(
i
,
v2
);
}
}
...
@@ -121,7 +122,10 @@ public class ScanIndex extends Index {
...
@@ -121,7 +122,10 @@ public class ScanIndex extends Index {
storage
.
removeRecord
(
session
,
row
.
getPos
());
storage
.
removeRecord
(
session
,
row
.
getPos
());
if
(
containsLargeObject
)
{
if
(
containsLargeObject
)
{
for
(
int
i
=
0
;
i
<
row
.
getColumnCount
();
i
++)
{
for
(
int
i
=
0
;
i
<
row
.
getColumnCount
();
i
++)
{
row
.
getValue
(
i
).
unlink
(
database
);
Value
v
=
row
.
getValue
(
i
);
if
(
v
.
isLinked
())
{
session
.
unlinkAtCommit
(
v
);
}
}
}
}
}
}
else
{
}
else
{
...
...
h2/src/main/org/h2/server/ftp/FtpControl.java
浏览文件 @
4463dbfa
...
@@ -322,7 +322,8 @@ public class FtpControl extends Thread {
...
@@ -322,7 +322,8 @@ public class FtpControl extends Thread {
String
list
=
server
.
getDirectoryListing
(
directory
,
directories
);
String
list
=
server
.
getDirectoryListing
(
directory
,
directories
);
reply
(
150
,
"Starting transfer"
);
reply
(
150
,
"Starting transfer"
);
server
.
log
(
list
);
server
.
log
(
list
);
data
.
send
(
list
.
getBytes
(
"UTF-8"
));
// need to use the current locale (UTF-8 would be wrong for the Windows Explorer)
data
.
send
(
list
.
getBytes
());
reply
(
226
,
"Done"
);
reply
(
226
,
"Done"
);
}
}
...
...
h2/src/main/org/h2/value/Value.java
浏览文件 @
4463dbfa
...
@@ -585,6 +585,10 @@ public abstract class Value {
...
@@ -585,6 +585,10 @@ public abstract class Value {
return
this
;
return
this
;
}
}
public
boolean
isLinked
()
{
return
false
;
}
public
void
unlink
(
DataHandler
handler
)
throws
SQLException
{
public
void
unlink
(
DataHandler
handler
)
throws
SQLException
{
}
}
...
...
h2/src/main/org/h2/value/ValueLob.java
浏览文件 @
4463dbfa
...
@@ -335,6 +335,10 @@ public class ValueLob extends Value {
...
@@ -335,6 +335,10 @@ public class ValueLob extends Value {
return
super
.
convertTo
(
t
);
return
super
.
convertTo
(
t
);
}
}
public
boolean
isLinked
()
{
return
linked
;
}
public
void
unlink
(
DataHandler
handler
)
throws
SQLException
{
public
void
unlink
(
DataHandler
handler
)
throws
SQLException
{
if
(
linked
&&
fileName
!=
null
)
{
if
(
linked
&&
fileName
!=
null
)
{
String
temp
;
String
temp
;
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
4463dbfa
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
*/
*/
package
org
.
h2
.
test
;
package
org
.
h2
.
test
;
import
java.io.File
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.util.Properties
;
import
java.util.Properties
;
...
@@ -66,8 +67,9 @@ start cmd /k "java org.h2.test.TestAll all >testAll.txt"
...
@@ -66,8 +67,9 @@ start cmd /k "java org.h2.test.TestAll all >testAll.txt"
start cmd /k "java org.h2.test.TestAll random >testRandom.txt"
start cmd /k "java org.h2.test.TestAll random >testRandom.txt"
start cmd /k "java org.h2.test.TestAll btree >testBtree.txt"
start cmd /k "java org.h2.test.TestAll btree >testBtree.txt"
Test for hot spots:
java -agentlib:yjpagent=sampling,noj2ee,dir=C:\temp\Snapshots org.h2.test.bench.TestPerformance -init -db 1
java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2:test;TRACE_LEVEL_FILE=3;LOG=2;MAX_LOG_SIZE=1000;DATABASE_EVENT_LISTENER='org.h2.samples.ShowProgress' -user sa -script test.sql
java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2:test;TRACE_LEVEL_FILE=3;LOG=2;MAX_LOG_SIZE=1000;DATABASE_EVENT_LISTENER='org.h2.samples.ShowProgress' -user sa -script test.sql
*/
*/
public
boolean
smallLog
,
big
,
networked
,
memory
,
ssl
,
textStorage
,
diskUndo
,
diskResult
,
deleteIndex
,
traceSystemOut
;
public
boolean
smallLog
,
big
,
networked
,
memory
,
ssl
,
textStorage
,
diskUndo
,
diskResult
,
deleteIndex
,
traceSystemOut
;
...
@@ -86,44 +88,10 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2
...
@@ -86,44 +88,10 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2
TestAll
test
=
new
TestAll
();
TestAll
test
=
new
TestAll
();
test
.
printSystem
();
test
.
printSystem
();
int
todoSendMail
;
// here's the whole enchilada
// delete the index and log file
//create table test(id int, data array)
//create table test(id int, data array)
//document array_get, array_length
//document array_get, array_length
// todo: document system properties in advancaed
// lobs: rename / delete: need to check if rename works if stop in the middle
// options for java functions: readonly, deterministic
// options for java functions: readonly, deterministic
// document cluster: not allowed operations: update/insert with random data (however in a readonly select it is ok)
// test & document cluster: read only selects only go to the first cluster node
// test & document settings via -Dh2.check=false
// set path=C:\Programme\Java\jdk1.6.0\bin;%PATH%
// There is one thing I forgot: you need to change the in the build script
// <property name="jdk" value="1.4"/> to
// <property name="jdk" value="1.6"/>
new
TestCrashAPI
().
init
(
test
).
testCase
(
1656916106
);
// Bug 2111148370 seed=1656916106 id=-1834 callCount=1787 openCount=50 General error: java.lang.Error: 0 blocks to read pos=192 [HY000-34]
new
TestCrashAPI
().
init
(
test
).
testCase
(
437623957
);
// Bug -1343599238 seed=437623957 id=-1317 callCount=1289 openCount=42 General error: java.lang.OutOfMemoryError: Java heap space [HY000-34]
// add to maven
// http://jira.codehaus.org/browse/MAVENUPLOAD-1276
// http://maven.apache.org/guides/mini/guide-ibiblio-upload.html
// java -agentlib:yjpagent=sampling,noj2ee,dir=C:\temp\Snapshots org.h2.test.bench.TestPerformance -init -db 1
// Check if new Hibernate dialect for H2 is ok
// http://opensource.atlassian.com/projects/hibernate/browse/HHH-2300
// open JPA test - submit patch
// open JPA test - submit patch
// d:\data\h2test\openjpa\openjpa-persistence-jdbc\src\test\resources\META-INF\persistence.xml
// d:\data\h2test\openjpa\openjpa-persistence-jdbc\src\test\resources\META-INF\persistence.xml
...
...
h2/src/test/org/h2/test/bench/test.properties
浏览文件 @
4463dbfa
...
@@ -7,16 +7,17 @@ db5 = HSQLDB, org.hsqldb.jdbcDriver, jdbc:hsqldb:hsql://localhost/xdb, sa
...
@@ -7,16 +7,17 @@ db5 = HSQLDB, org.hsqldb.jdbcDriver, jdbc:hsqldb:hsql://localhost/xdb, sa
db6
=
Derby, org.apache.derby.jdbc.ClientDriver, jdbc:derby://localhost/data/testServ;create=true, sa, sa
db6
=
Derby, org.apache.derby.jdbc.ClientDriver, jdbc:derby://localhost/data/testServ;create=true, sa, sa
db7
=
PostgreSQL, org.postgresql.Driver, jdbc:postgresql:test, sa, sa
db7
=
PostgreSQL, org.postgresql.Driver, jdbc:postgresql:test, sa, sa
db8
=
MySQL, com.mysql.jdbc.Driver, jdbc:mysql://localhost/test?jdbcCompliantTruncation=false, sa, sa
db8
=
MySQL, com.mysql.jdbc.Driver, jdbc:mysql://localhost/test?jdbcCompliantTruncation=false, sa, sa
db9
=
Firebird, org.firebirdsql.jdbc.FBDriver, jdbc:firebirdsql:localhost:c:/temp/firebird/test, sysdba, masterkey
xdb9
=
OneDollarDB, in.co.daffodil.db.jdbc.DaffodilDBDriver, jdbc:daffodilDB_embedded:school;path=C:/temp;create=true, sa
#db2 = Firebird, org.firebirdsql.jdbc.FBDriver, jdbc:firebirdsql:localhost:c:/temp/firebird/test, sysdba, masterkey
xdb10
=
Oracle, oracle.jdbc.driver.OracleDriver, jdbc:oracle:thin:@localhost:1521:test, scott, tiger
#db2 = Oracle, oracle.jdbc.driver.OracleDriver, jdbc:oracle:thin:@localhost:1521:XE, client, client
xdb11
=
DB2, COM.ibm.db2.jdbc.net.DB2Driver, jdbc:db2://localhost/test, test, test
#db2 = OneDollarDB, in.co.daffodil.db.jdbc.DaffodilDBDriver, jdbc:daffodilDB_embedded:school;path=C:/temp;create=true, sa
xdb12
=
MSSQLServer, com.microsoft.jdbc.sqlserver.SQLServerDriver, jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=test, test, test
#db2 = DB2, COM.ibm.db2.jdbc.net.DB2Driver, jdbc:db2://localhost/test, test, test
#db2 = MSSQLServer, com.microsoft.jdbc.sqlserver.SQLServerDriver, jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=test, test, test
firebirdsql.datetime
=
TIMESTAMP
firebirdsql.datetime
=
TIMESTAMP
postgresql.datetime
=
TIMESTAMP
postgresql.datetime
=
TIMESTAMP
derby.datetime
=
TIMESTAMP
derby.datetime
=
TIMESTAMP
oracle.datetime
=
TIMESTAMP
test1
=
org.h2.test.bench.BenchSimple
test1
=
org.h2.test.bench.BenchSimple
test2
=
org.h2.test.bench.BenchA
test2
=
org.h2.test.bench.BenchA
...
...
h2/src/test/org/h2/test/db/TestCases.java
浏览文件 @
4463dbfa
...
@@ -169,7 +169,7 @@ public class TestCases extends TestBase {
...
@@ -169,7 +169,7 @@ public class TestCases extends TestBase {
error
(
"query still running"
);
error
(
"query still running"
);
}
}
time
=
System
.
currentTimeMillis
()
-
time
;
time
=
System
.
currentTimeMillis
()
-
time
;
if
(
time
>
1
000
)
{
if
(
time
>
5
000
)
{
error
(
"closing took "
+
time
);
error
(
"closing took "
+
time
);
}
}
deleteDb
(
"cases"
);
deleteDb
(
"cases"
);
...
...
h2/src/test/org/h2/test/db/TestLob.java
浏览文件 @
4463dbfa
...
@@ -15,6 +15,7 @@ import java.sql.Connection;
...
@@ -15,6 +15,7 @@ import java.sql.Connection;
import
java.sql.DatabaseMetaData
;
import
java.sql.DatabaseMetaData
;
import
java.sql.PreparedStatement
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.ResultSet
;
import
java.sql.Savepoint
;
import
java.sql.Statement
;
import
java.sql.Statement
;
import
java.util.Random
;
import
java.util.Random
;
...
@@ -32,6 +33,8 @@ public class TestLob extends TestBase {
...
@@ -32,6 +33,8 @@ public class TestLob extends TestBase {
if
(
config
.
memory
)
{
if
(
config
.
memory
)
{
return
;
return
;
}
}
testLobTransactions
();
testLobRollbackStop
();
testLobCopy
();
testLobCopy
();
testLobHibernate
();
testLobHibernate
();
testLobCopy
(
false
);
testLobCopy
(
false
);
...
@@ -47,6 +50,103 @@ public class TestLob extends TestBase {
...
@@ -47,6 +50,103 @@ public class TestLob extends TestBase {
testJavaObject
();
testJavaObject
();
}
}
private
void
testLobTransactions
()
throws
Exception
{
if
(
config
.
logMode
==
0
)
{
return
;
}
deleteDb
(
"lob"
);
Connection
conn
=
reconnect
(
null
);
conn
.
createStatement
().
execute
(
"CREATE TABLE TEST(ID IDENTITY, DATA CLOB, DATA2 VARCHAR)"
);
conn
.
setAutoCommit
(
false
);
Random
random
=
new
Random
(
1
);
int
rows
=
0
;
Savepoint
sp
=
null
;
int
len
=
getSize
(
100
,
2000
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
switch
(
random
.
nextInt
(
10
))
{
case
0
:
// System.out.println("insert");
conn
.
createStatement
().
execute
(
"INSERT INTO TEST(DATA, DATA2) VALUES('"
+
i
+
"' || SPACE(10000), '"
+
i
+
"')"
);
rows
++;
break
;
case
1
:
if
(
rows
>
0
)
{
// System.out.println("delete");
conn
.
createStatement
().
execute
(
"DELETE FROM TEST WHERE ID="
+
random
.
nextInt
(
rows
));
}
break
;
case
2
:
if
(
rows
>
0
)
{
// System.out.println("update");
conn
.
createStatement
().
execute
(
"UPDATE TEST SET DATA='x' || DATA, DATA2='x' || DATA2 WHERE ID="
+
random
.
nextInt
(
rows
));
}
break
;
case
3
:
if
(
rows
>
0
)
{
// System.out.println("commit");
conn
.
commit
();
sp
=
null
;
}
break
;
case
4
:
if
(
rows
>
0
)
{
// System.out.println("rollback");
conn
.
rollback
();
sp
=
null
;
}
break
;
case
5
:
// System.out.println("savepoint");
sp
=
conn
.
setSavepoint
();
break
;
case
6
:
if
(
sp
!=
null
)
{
// System.out.println("rollback to savepoint");
conn
.
rollback
(
sp
);
}
break
;
case
7
:
if
(
rows
>
0
)
{
// System.out.println("shutdown");
conn
.
createStatement
().
execute
(
"CHECKPOINT"
);
conn
.
createStatement
().
execute
(
"SHUTDOWN IMMEDIATELY"
);
conn
=
reconnect
(
null
);
conn
.
setAutoCommit
(
false
);
sp
=
null
;
}
break
;
}
ResultSet
rs
=
conn
.
createStatement
().
executeQuery
(
"SELECT * FROM TEST"
);
while
(
rs
.
next
())
{
String
d1
=
rs
.
getString
(
"DATA"
).
trim
();
String
d2
=
rs
.
getString
(
"DATA2"
).
trim
();
check
(
d1
,
d2
);
}
}
conn
.
close
();
}
private
void
testLobRollbackStop
()
throws
Exception
{
if
(
config
.
logMode
==
0
)
{
return
;
}
deleteDb
(
"lob"
);
Connection
conn
=
reconnect
(
null
);
conn
.
createStatement
().
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY, DATA CLOB)"
);
conn
.
createStatement
().
execute
(
"INSERT INTO TEST VALUES(1, SPACE(10000))"
);
conn
.
setAutoCommit
(
false
);
conn
.
createStatement
().
execute
(
"DELETE FROM TEST"
);
conn
.
createStatement
().
execute
(
"CHECKPOINT"
);
conn
.
createStatement
().
execute
(
"SHUTDOWN IMMEDIATELY"
);
conn
=
reconnect
(
null
);
ResultSet
rs
=
conn
.
createStatement
().
executeQuery
(
"SELECT * FROM TEST"
);
check
(
rs
.
next
());
rs
.
getInt
(
1
);
check
(
rs
.
getString
(
2
).
length
(),
10000
);
conn
.
close
();
}
private
void
testLobCopy
()
throws
Exception
{
private
void
testLobCopy
()
throws
Exception
{
deleteDb
(
"lob"
);
deleteDb
(
"lob"
);
Connection
conn
=
reconnect
(
null
);
Connection
conn
=
reconnect
(
null
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论