Hi,

I'm trying to run H2 off of a pluggable filesystem that I've written with 
some success so far.

While I can issue a simple select query (such as, *"select * from 
INFORMATION_SCHEMA.tables"*) and get back the query results just fine, I'm 
observing a couple problem from H2's side (though not necessarily due to H2 
squarely!).


*Problem 1:* The size of the .h2.db file keeps increasing, in increments of 
1 to 2MB, merely with a database connection-open and -close -- even without 
any select query involved. Here's the program I'm using:

public class MyFilePath extends FilePath {
// ...
}
 FileSystem fs = null;
Connection conn = null;
try {
// <Setup 'env' here...>
fs = (FooFileSystem) FileSystems.newFileSystem(URI.create("foo:/"), env);

FilePath.register(new MyFilePath("foo:/"));

*// Question: Btw, where do I register my FileBase subclass? *

conn = DriverManager.getConnection("jdbc:h2:foo:/abc;CIPHER=AES", "user", 
"password");
} catch(Exception x) {
x.printStackTrace();
} finally {
if (conn != null) conn.close();
if(fs != null) fs.close();
}


And here's the pattern of size-increases upon each run of the above program:
 

===================================================
Run #:   Database file size (bytes)
===================================================
          129024  (initial)
  1      2226176  (increase by: 2097152, or 2 MB)
  2      3274752  (increase by: 1048576, or 1 MB)
  3      5371904  (increase by: 2097152, or 2 MB)
  4      5371904  (increase by:       0, or 0 MB)
  5      7469056  (increase by: 2097152, or 2 MB)
  6      7469056  (increase by:       0, or 0 MB)
  7     10614784  (increase by: 3145728, or 3 MB)
===================================================



  *Question 1*: Could someone help narrow down the portion of H2 codebase 
that I should step through in the debugger to troubleshoot this problem? 
For example, knowing what H2 conceptually does during connection open 
and/or close would help. Note that, outside of H2 database access, I can 
copy regular files from/to this filesystem using Java API just fine, with 
the source and destination file sizes and contents always matching. Only 
that, I'm not sure what 'pattern' of Java API usage H2 is employing to be 
causing this problem to manifest!

  *Question 2*: How and where do I register my FileBase subclass with H2? I 
didn't find this mentioned in the documentation (at 
http://www.h2database.com/html/advanced.html#file_system).


*Problem 2:* At the time of connection close, I'm getting the following 
exception in the .trace.db file:

04-27 09:11:47 database: close
org.h2.message.DbException: File corrupted while reading record: "wrong 
checksum". Possible solution: use the recovery tool [90030-174]
at org.h2.message.DbException.get(DbException.java:172)
at org.h2.message.DbException.get(DbException.java:149)
at org.h2.store.PageStore.getPage(PageStore.java:746)
at org.h2.store.PageStore.compact(PageStore.java:700)
at org.h2.store.PageStore.compact(PageStore.java:528)
at org.h2.engine.Database.closeOpenFilesAndUnlock(Database.java:1241)
at org.h2.engine.Database.close(Database.java:1191)
at org.h2.engine.Database.removeSession(Database.java:1069)
at org.h2.engine.Session.close(Session.java:666)
at org.h2.jdbc.JdbcConnection.close(JdbcConnection.java:366)
at H2Test.main(H2Test.java:70)
Caused by: org.h2.jdbc.JdbcSQLException: File corrupted while reading 
record: "wrong checksum". Possible solution: use the recovery tool 
[90030-174]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:332)
... 11 more

  *Question 3*: Is there a quick and easy way to figure out what could 
possibly be causing this exception? Could Problem 2 (causing an improper 
database shutdown) be causing Problem 1?


Many thanks,
/PN

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to