Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
caca6aaf
提交
caca6aaf
authored
4月 13, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
031c0dbc
隐藏空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
102 行增加
和
87 行删除
+102
-87
build.xml
h2/build.xml
+5
-1
changelog.html
h2/src/docsrc/html/changelog.html
+18
-0
features.html
h2/src/docsrc/html/features.html
+4
-2
roadmap.html
h2/src/docsrc/html/roadmap.html
+1
-0
TransactionCommand.java
h2/src/main/org/h2/command/dml/TransactionCommand.java
+12
-1
MultiVersionCursor.java
h2/src/main/org/h2/index/MultiVersionCursor.java
+1
-3
MultiVersionIndex.java
h2/src/main/org/h2/index/MultiVersionIndex.java
+4
-2
FileSystemZip.java
h2/src/main/org/h2/store/fs/FileSystemZip.java
+4
-1
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+6
-72
TestMultiConn.java
h2/src/test/org/h2/test/db/TestMultiConn.java
+28
-0
TestMvcc1.java
h2/src/test/org/h2/test/mvcc/TestMvcc1.java
+13
-3
supportTemplates.txt
h2/src/test/org/h2/test/todo/supportTemplates.txt
+2
-1
Build.java
h2/src/tools/org/h2/build/Build.java
+3
-0
dictionary.txt
h2/src/tools/org/h2/build/doc/dictionary.txt
+1
-1
没有找到文件。
h2/build.xml
浏览文件 @
caca6aaf
...
...
@@ -55,6 +55,7 @@
<copy
todir=
"bin"
overwrite=
"true"
>
<fileset
dir=
"src/main"
includes=
"META-INF/services/*"
/>
<fileset
dir=
"src/installer"
includes=
"*.bat"
/>
<fileset
dir=
"src/installer"
includes=
"*.sh"
/>
<fileset
dir=
"src/test"
excludes=
"**/*.java,**/package.html"
/>
</copy>
</target>
...
...
@@ -112,6 +113,7 @@
<exclude
name=
"org/h2/samples/**/*.*"
/>
<exclude
name=
"org/h2/test/**/*.*"
/>
<exclude
name=
"**/*.bat"
/>
<exclude
name=
"**/*.sh"
/>
<exclude
name=
"**/*.txt"
/>
</jar>
</target>
...
...
@@ -125,6 +127,7 @@
<jar
jarfile=
"bin/h2client.jar"
basedir=
"bin"
manifest=
"bin/META-INF/MANIFEST.MF"
>
<include
name=
"**/*.*"
/>
<exclude
name=
"**/*.bat"
/>
<exclude
name=
"**/*.sh"
/>
</jar>
</target>
...
...
@@ -138,6 +141,7 @@
<jar
jarfile=
"bin/h2db.jar"
basedir=
"bin"
manifest=
"bin/META-INF/MANIFEST.MF"
>
<include
name=
"**/*.*"
/>
<exclude
name=
"**/*.bat"
/>
<exclude
name=
"**/*.sh"
/>
</jar>
</target>
...
...
@@ -284,7 +288,7 @@
<target
name=
"zip"
>
<zip
destfile=
"../h2.zip"
>
<fileset
dir=
".."
includes=
"h2/build.
xml
"
/>
<fileset
dir=
".."
includes=
"h2/build.
*
"
/>
<fileset
dir=
".."
includes=
"h2/ant-build.properties"
/>
<fileset
dir=
".."
includes=
"h2/bin/**/*"
/>
<fileset
dir=
".."
includes=
"h2/docs/**/*"
/>
...
...
h2/src/docsrc/html/changelog.html
浏览文件 @
caca6aaf
...
...
@@ -16,6 +16,24 @@ Change Log
<h2>
Next Version (unreleased)
</h2>
<ul><li>
The autocomplete in the H2 Console has been improved a bit.
</li><li>
The tools in the H2 Console are now translatable.
</li><li>
The servlet and lucene jar files are now automatically downloaded when building.
</li><li>
The code switch tool has been replaced by a simpler tool called
SwitchSource that just uses find and replace.
</li><li>
Started to write a Ant replacement ('JAnt') that uses pure Java
build definitions. Advantages: ability to debug the build, extensible,
flexible, no XML, a bit faster. Future plan: support creating custom h2
distributions (for embedded use). Maybe create a new project 'Jant'
or 'Javen' if other people are interested.
</li><li>
The jar file is now about 10% smaller because the variable debugging info
is no longer included. The source file and line number debugging info
is still included. If required, the jar file size of the full version can
be further reduced to about 720 KB using 'build jarSmall' or even
more by removing unneeded components.
</li><li>
Added shell scripts run.sh and build.sh. chmod +x is required,
but otherwise it should work. Feedback or improvements are welcome!
</li><li>
Databases in zip files: large queries are now support. Temp files are created in
the temp directory if required. The documentation how to create
the zip file has been corrected.
</li><li>
Invalid inline views threw confusing SQL exceptions.
</li><li>
The Japanese translation of the error messages and the
H2 Console has been improved. Thanks a lot to Masahiro IKEMOTO.
...
...
h2/src/docsrc/html/features.html
浏览文件 @
caca6aaf
...
...
@@ -989,13 +989,15 @@ By calling Connection.isReadOnly() or by executing the SQL statement CALL READON
<h2>
Read Only Databases in Zip or Jar File
</h2>
<p>
To create a read-only database in a zip, first create a regular persistent database, and then create a backup.
If you are using a database named 'test', an easy way to do that is using the BACKUP SQL statement:
If you are using a database named 'test', an easy way to do that is using the B
ackup tool or the B
ACKUP SQL statement:
</p>
<pre>
BACKUP TO 'data.zip'
</pre>
<p>
Afterwards, you can log out, and directly open the database in the zip file using the following database URL:
The database must not have pending changes, that means you need to close all connections to the
database, open one single connection, and then execute the statement. Afterwards, you can log out,
and directly open the database in the zip file using the following database URL:
</p>
<pre>
jdbc:h2:zip:~/data.zip!/test
...
...
h2/src/docsrc/html/roadmap.html
浏览文件 @
caca6aaf
...
...
@@ -404,6 +404,7 @@ Roadmap
</li><li>
Doclet (javadocs): constructors are not listed
</li><li>
Support direct lookup for MIN and MAX when using WHERE (see todo.txt / Direct Lookup)
</li><li>
Support other array types (String[], double[]) in PreparedStatement.setObject(int, Object);
</li><li>
MVCC should not be memory bound (uncommitted data is kept in memory in the delta index; maybe using a regular btree index solves the problem)
</li></ul>
<h2>
Not Planned
</h2>
...
...
h2/src/main/org/h2/command/dml/TransactionCommand.java
浏览文件 @
caca6aaf
...
...
@@ -161,10 +161,21 @@ public class TransactionCommand extends Prepared {
// close the database, but don't update the persistent setting
session
.
getDatabase
().
setCloseDelay
(
0
);
Database
db
=
session
.
getDatabase
();
// throttle, to allow testing concurrent
// execution of shutdown and query
session
.
throttle
();
Session
[]
sessions
=
db
.
getSessions
(
false
);
for
(
int
i
=
0
;
i
<
sessions
.
length
;
i
++)
{
Session
s
=
sessions
[
i
];
synchronized
(
s
)
{
if
(
db
.
getMultiThreaded
())
{
synchronized
(
s
)
{
s
.
rollback
();
}
}
else
{
// if not multi-threaded, the session could already own
// the lock, which would result in a deadlock
// the other session can not concurrently do anything
// because the current session has locked the database
s
.
rollback
();
}
if
(
s
!=
session
)
{
...
...
h2/src/main/org/h2/index/MultiVersionCursor.java
浏览文件 @
caca6aaf
...
...
@@ -149,9 +149,7 @@ public class MultiVersionCursor implements Cursor {
if
(
isThisSession
)
{
throw
Message
.
getInternalError
();
}
else
{
// another session updated the row: must be deleted
// in base as well
throw
Message
.
getInternalError
();
// another session updated the row
}
}
else
{
if
(
isThisSession
)
{
...
...
h2/src/main/org/h2/index/MultiVersionIndex.java
浏览文件 @
caca6aaf
...
...
@@ -127,8 +127,10 @@ public class MultiVersionIndex implements Index {
while
(
c
.
next
())
{
Row
r
=
c
.
get
();
if
(
r
.
getPos
()
==
row
.
getPos
())
{
delta
.
remove
(
session
,
row
);
return
true
;
if
(
r
==
row
||
table
.
getScanIndex
(
session
).
compareRows
(
r
,
row
)
==
0
)
{
delta
.
remove
(
session
,
row
);
return
true
;
}
}
}
return
false
;
...
...
h2/src/main/org/h2/store/fs/FileSystemZip.java
浏览文件 @
caca6aaf
...
...
@@ -49,7 +49,10 @@ public class FileSystemZip extends FileSystem {
}
public
String
createTempFile
(
String
prefix
,
String
suffix
,
boolean
deleteOnExit
,
boolean
inTempDir
)
throws
IOException
{
throw
new
IOException
(
"File system is read-only"
);
if
(!
inTempDir
)
{
throw
new
IOException
(
"File system is read-only"
);
}
return
FileSystemDisk
.
getInstance
().
createTempFile
(
prefix
,
suffix
,
deleteOnExit
,
true
);
}
public
void
delete
(
String
fileName
)
throws
SQLException
{
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
caca6aaf
...
...
@@ -158,68 +158,9 @@ java org.h2.test.TestAll timer
test
.
printSystem
();
/*
build.sh
run.sh
jdbc:h2:zip:source.zip!/source
The database is read only [90097-69] 90097/90097 (Help)
org.h2.jdbc.JdbcSQLException: The database is read only [90097-69]
at org.h2.message.Message.getSQLException(Message.java:91)
at org.h2.message.Message.getSQLException(Message.java:95)
at org.h2.message.Message.getSQLException(Message.java:73)
at org.h2.message.Message.getSQLException(Message.java:116)
at org.h2.engine.Database.checkWritingAllowed(Database.java:1401)
at org.h2.log.LogSystem.add(LogSystem.java:410)
at org.h2.store.DiskFile.addRecord(DiskFile.java:867)
at org.h2.store.Storage.addRecord(Storage.java:141)
at org.h2.index.ScanIndex.add(ScanIndex.java:115)
at org.h2.table.TableData.addRow(TableData.java:97)
at org.h2.engine.Database.addMeta(Database.java:685)
at org.h2.engine.Database.addDatabaseObject(Database.java:759)
at org.h2.engine.Database.setMasterUser(Database.java:1364)
at org.h2.engine.Engine.openSession(Engine.java:63)
at org.h2.engine.Engine.getSession(Engine.java:104)
at org.h2.engine.Session.createSession(Session.java:203)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:976)
timebomb should interrupt all threads
Thread[] list = new Thread[1000];
Thread.currentThread().getThreadGroup().enumerate(list);
for (int i = 0; i < list.length; i++) {
Thread t = list[i];
if (t != null && t != Thread.currentThread()) {
System.out.println("interrupting " + t.toString());
t.interrupt();
test case for out of memory (try to corrupt the database using out of memory)
Caused by: java.lang.Error: read len -1170950400
at org.h2.message.Message.getInternalError(Message.java:128)
at org.h2.store.FileStore.readFully(FileStore.java:210)
at org.h2.store.DiskFile.copyDirect(DiskFile.java:838)
at org.h2.command.dml.BackupCommand.backupDiskFile(BackupCommand.java:113)
at org.h2.command.dml.BackupCommand.backupTo(BackupCommand.java:71)
at org.h2.command.dml.BackupCommand.update(BackupCommand.java:52)
at org.h2.command.CommandContainer.update(CommandContainer.java:69)
at org.h2.command.Command.executeUpdate(Command.java:197)
in your cvs tutorial (on h2database.com) you have an example code for
Reading a CSV File from a Java Application.
In the example you use the static reference Csv.read(...);
to the non static method read(...) in line 1.
I used Csv csv = Csv.getInstance();
and then csv.read(...)
i guess the same problem occurs in the
Writing a CSV File from a Java Application
example above with Csv.write(...)
Caused by: java.io.IOException: File system is read-only
at org.h2.store.fs.FileSystemZip.createTempFile(FileSystemZip.java:52)
at org.h2.util.FileUtils.createTempFile(FileUtils.java:140)
at org.h2.engine.Database.createTempFile(Database.java:1177)
analyzer configuration option for the fulltext search
optimize where x not in (select):
...
...
@@ -269,19 +210,12 @@ Add where required // TODO: change in version 1.1
http://www.w3schools.com/sql/
History:
The servlet and lucene jar files are now automatically downloaded when building.
The code switch tool has been replaced by a simpler tool called
SwitchSource that just uses find and replace.
Started to write a Ant replacement ('JAnt') that uses pure Java
build definitions. Advantages: ability to debug the build, extensible,
flexible, no XML, a bit faster. Future plan: support creating custom h2
distributions (for embedded use). Maybe create a new project 'Jant'
or 'Javen' if other people are interested.
The jar file is now about 10% smaller because the variable debugging info
is no longer included. The source file and line number debugging info
is still included. If required, the jar file size of the full version can
be further reduced to about 720 KB using 'build jarSmall' or even
more by removing unneeded components.
Multi version concurrency (MVCC): when a row was updated,
and the updated column was not indexed,
this update was visible sometimes for other sessions even if it was
not committed
Calling SHUTDOWN on one connection and starting a query on
another connection concurrently could result in a Java level deadlock.
Roadmap:
...
...
h2/src/test/org/h2/test/db/TestMultiConn.java
浏览文件 @
caca6aaf
...
...
@@ -19,12 +19,40 @@ import org.h2.test.TestBase;
public
class
TestMultiConn
extends
TestBase
implements
DatabaseEventListener
{
public
void
test
()
throws
Exception
{
testConcurrentShutdownQuery
();
testCommitRollback
();
testConcurrentOpen
();
testThreeThreads
();
}
private
static
int
wait
;
private
void
testConcurrentShutdownQuery
()
throws
Exception
{
Connection
conn1
=
getConnection
(
"multiConn"
);
Connection
conn2
=
getConnection
(
"multiConn"
);
final
Statement
stat1
=
conn1
.
createStatement
();
stat1
.
execute
(
"CREATE ALIAS SLEEP FOR \"java.lang.Thread.sleep(long)\""
);
final
Statement
stat2
=
conn2
.
createStatement
();
stat1
.
execute
(
"SET THROTTLE 100"
);
new
Thread
()
{
public
void
run
()
{
try
{
stat2
.
executeQuery
(
"CALL SLEEP(100)"
);
try
{
Thread
.
sleep
(
10
);
}
catch
(
Exception
e
)
{
// ignore
}
stat2
.
executeQuery
(
"CALL SLEEP(100)"
);
}
catch
(
SQLException
e
)
{
// ignore
}
}
}
.
start
();
Thread
.
sleep
(
50
);
stat1
.
execute
(
"SHUTDOWN"
);
conn1
.
close
();
}
private
void
testThreeThreads
()
throws
Exception
{
deleteDb
(
"multiConn"
);
...
...
h2/src/test/org/h2/test/mvcc/TestMvcc1.java
浏览文件 @
caca6aaf
...
...
@@ -53,8 +53,7 @@ public class TestMvcc1 extends TestBase {
if
(!
config
.
mvcc
)
{
return
;
}
// TODO Prio 1: make unit test work (remaining problem: optimization for
// select min/max)
// TODO Prio 1: row level locking for update / delete (as PostgreSQL)
// TODO Prio 1: document: exclusive table lock still used when altering
// tables, adding indexes, select ... for update; table level locks are
// checked
...
...
@@ -112,7 +111,18 @@ public class TestMvcc1 extends TestBase {
c2
.
commit
();
s2
.
execute
(
"drop table test"
);
c2
.
rollback
();
// update same key problem
s1
.
execute
(
"CREATE TABLE TEST(ID INT, NAME VARCHAR, PRIMARY KEY(ID))"
);
s1
.
execute
(
"INSERT INTO TEST VALUES(1, 'Hello')"
);
c1
.
commit
();
test
(
s2
,
"SELECT NAME FROM TEST WHERE ID=1"
,
"Hello"
);
s1
.
execute
(
"UPDATE TEST SET NAME = 'Hallo' WHERE ID=1"
);
test
(
s2
,
"SELECT NAME FROM TEST WHERE ID=1"
,
"Hello"
);
test
(
s1
,
"SELECT NAME FROM TEST WHERE ID=1"
,
"Hallo"
);
s1
.
execute
(
"DROP TABLE TEST"
);
c1
.
commit
();
c2
.
commit
();
// referential integrity problem
s1
.
execute
(
"create table a (id integer identity not null, code varchar(10) not null, primary key(id))"
);
...
...
h2/src/test/org/h2/test/todo/supportTemplates.txt
浏览文件 @
caca6aaf
...
...
@@ -28,7 +28,9 @@ I am sorry to say that, but it looks like a corruption problem. I am very intere
- Could you send the full stack trace of the exception?
- What is your database URL?
- You can find out if the database is corrupted when running SCRIPT TO 'test.sql'
- What version H2 are you using?
- With which version of H2 was this database created? You can find it out using: select * from information_schema.settings where name='info.BUILD_ID'
- Did you use multiple connections?
- The first workarounds is: append ;RECOVER=1 to the database URL. Does it work when you do this?
- The second workarounds is: delete the index.db file (it is re-created automatically) and try again. Does it work when you do this?
...
...
@@ -40,6 +42,5 @@ I am sorry to say that, but it looks like a corruption problem. I am very intere
- Is the database usually closed normally, or is process terminated forcefully or the computer switched off?
- Is it possible to reproduce this problem using a fresh database (sometimes, or always)?
- Are there any other exceptions (maybe in the .trace.db file)? Could you send them to me please?
- Was the database originally created with an older version of H2?
- Do you still have any .trace.db files, and if yes could you send them?
- Could you send me the .data.db file where this exception occurs?
h2/src/tools/org/h2/build/Build.java
浏览文件 @
caca6aaf
...
...
@@ -80,6 +80,7 @@ public class Build extends BuildBase {
files
=
filterFiles
(
files
,
false
,
"target/org/h2/samples/*"
);
files
=
filterFiles
(
files
,
false
,
"target/org/h2/test/*"
);
files
=
filterFiles
(
files
,
false
,
"*.bat"
);
files
=
filterFiles
(
files
,
false
,
"*.sh"
);
files
=
filterFiles
(
files
,
false
,
"*.txt"
);
jar
(
"target/h2.jar"
,
"target"
,
files
);
}
...
...
@@ -92,6 +93,7 @@ public class Build extends BuildBase {
files
=
filterFiles
(
files
,
false
,
"target/org/h2/samples/*"
);
files
=
filterFiles
(
files
,
false
,
"target/org/h2/test/*"
);
files
=
filterFiles
(
files
,
false
,
"*.bat"
);
files
=
filterFiles
(
files
,
false
,
"*.sh"
);
files
=
filterFiles
(
files
,
false
,
"*.txt"
);
files
=
filterFiles
(
files
,
false
,
"target/META-INF/*"
);
zip
(
"target/h2classes.zip"
,
"target"
,
files
,
true
,
true
);
...
...
@@ -145,6 +147,7 @@ public class Build extends BuildBase {
files
=
getFiles
(
"src/installer"
);
files
=
filterFiles
(
files
,
true
,
"*.bat"
);
files
=
filterFiles
(
files
,
true
,
"*.sh"
);
copy
(
"target"
,
files
,
"src/installer"
);
files
=
getFiles
(
"src/test"
);
...
...
h2/src/tools/org/h2/build/doc/dictionary.txt
浏览文件 @
caca6aaf
...
...
@@ -492,4 +492,4 @@ selecting vista everywhere locations zones fragment svg thought constructors
doubles validating matched established accu accum stats resetting parallel
delays guess downloaded jars advantages interrupt javen sourcepath unneeded
compressibility ext crc enumerate components mkdir jant downloading mismatch
timebomb
\ No newline at end of file
timebomb thinks
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论