提交 caca6aaf authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 031c0dbc
......@@ -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/**/*"/>
......
......@@ -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.
......
......@@ -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 Backup tool or the BACKUP 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
......
......@@ -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>
......
......@@ -161,12 +161,23 @@ 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];
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) {
s.close();
}
......
......@@ -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) {
......
......@@ -127,10 +127,12 @@ public class MultiVersionIndex implements Index {
while (c.next()) {
Row r = c.get();
if (r.getPos() == row.getPos()) {
if (r == row || table.getScanIndex(session).compareRows(r, row) == 0) {
delta.remove(session, row);
return true;
}
}
}
return false;
}
......
......@@ -49,8 +49,11 @@ public class FileSystemZip extends FileSystem {
}
public String createTempFile(String prefix, String suffix, boolean deleteOnExit, boolean inTempDir) throws IOException {
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 {
throw Message.getUnsupportedException();
......
......@@ -159,67 +159,8 @@ java org.h2.test.TestAll timer
/*
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:
......
......@@ -19,6 +19,7 @@ import org.h2.test.TestBase;
public class TestMultiConn extends TestBase implements DatabaseEventListener {
public void test() throws Exception {
testConcurrentShutdownQuery();
testCommitRollback();
testConcurrentOpen();
testThreeThreads();
......@@ -26,6 +27,33 @@ public class TestMultiConn extends TestBase implements DatabaseEventListener {
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");
final Connection conn1 = getConnection("multiConn");
......
......@@ -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
......@@ -113,6 +112,17 @@ public class TestMvcc1 extends TestBase {
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))");
......
......@@ -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?
......@@ -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");
......
......@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论