Re: Automatically compact databases from time to time (as a background process)

2012-02-23 Thread IntensiveH2
Hi,

I tried your proposal but I have the issue below (with public long
transactionTimeout = 33554432):

INFO   | jvm 1| 2012/02/23 08:54:21 | WrapperManager Error: Error
in WrapperListener.start callback.  java.lang.StackOverflowError
INFO   | jvm 1| 2012/02/23 08:54:21 | WrapperManager Error:
java.lang.StackOverflowError
INFO   | jvm 1| 2012/02/23 08:54:21 | WrapperManager Error: at
java.util.HashMap$KeyIterator.init(HashMap.java:826)
INFO   | jvm 1| 2012/02/23 08:54:21 | WrapperManager Error: at
java.util.HashMap$KeyIterator.init(HashMap.java:826)
INFO   | jvm 1| 2012/02/23 08:54:21 | WrapperManager Error: at
java.util.HashMap.newKeyIterator(HashMap.java:840)
INFO   | jvm 1| 2012/02/23 08:54:21 | WrapperManager Error: at
java.util.HashMap$KeySet.iterator(HashMap.java:874)
INFO   | jvm 1| 2012/02/23 08:54:21 | WrapperManager Error: at
java.util.HashSet.iterator(HashSet.java:153)
INFO   | jvm 1| 2012/02/23 08:54:21 | WrapperManager Error: at
java.util.AbstractCollection.toArray(AbstractCollection.java:120)
INFO   | jvm 1| 2012/02/23 08:54:21 | WrapperManager Error: at
java.util.Collections$SynchronizedCollection.toArray(Collections.java:
1566)
INFO   | jvm 1| 2012/02/23 08:54:21 | WrapperManager Error: at
java.util.ArrayList.init(ArrayList.java:131)
INFO   | jvm 1| 2012/02/23 08:54:21 | WrapperManager Error: at
org.h2.util.New.arrayList(New.java:71)
INFO   | jvm 1| 2012/02/23 08:54:21 | WrapperManager Error: at
org.h2.engine.Database.getSessions(Database.java:1410)
INFO   | jvm 1| 2012/02/23 08:54:21 | WrapperManager Error: at
org.h2.store.PageStore.getFirstUncommittedSection(PageStore.java:830)
INFO   | jvm 1| 2012/02/23 08:54:21 | WrapperManager Error: at
org.h2.store.PageStore.checkpoint(PageStore.java:427)
INFO   | jvm 1| 2012/02/23 08:54:21 | WrapperManager Error: at
org.h2.store.PageStore.commit(PageStore.java:1432)
INFO   | jvm 1| 2012/02/23 08:54:21 | WrapperManager Error: at
org.h2.engine.Database.commit(Database.java:1767)
INFO   | jvm 1| 2012/02/23 08:54:21 | WrapperManager Error: at
org.h2.engine.Session.rollback(Session.java:511)
INFO   | jvm 1| 2012/02/23 08:54:21 | WrapperManager Error: at
org.h2.store.PageStore.commit(PageStore.java:1457)
On 20 fév, 19:49, Thomas Mueller thomas.tom.muel...@gmail.com wrote:
 Hi,

 If you want, I have some code that could be used as a starting point.
 It's work in progress.

 Warning: I havent test it; I didn't run it at all. It could be
 completely wrong, and possibly corrupt the database. Also, the term
 TRANSACTION_TIMEOUT is misleading and has to be changed (it should
 be something like really maximum transaction log size; if the
 transaction log is larger than this then the transaction of the
 session with the oldest open transaction is rolled back).

 http://h2database.com/p.html#29e32a33bca7541cb70ea3cc9d483814

 Regards,
 Thomas

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: Automatically compact databases from time to time (as a background process)

2012-02-23 Thread IntensiveH2
Hi,

I tested the compact command.
I have no issue regarding corruption but I need time to perform
additional validations.
But compact command closed all opened connection and if you have a
pool of connection, it's a problem
The error message is:
org.h2.jdbc.JdbcSQLException: Database is already closed (to disable
automatic closing at VM shutdown, add ;DB_CLOSE_ON_EXIT=FALSE to the
db URL) [90121-164]

Thierry.

On 15 fév, 13:13, Noel Grandin noelgran...@gmail.com wrote:
 Hi

 I had a quick bash at implementing this by taking an exclusive lock on
 the DB and re-using the existing compacting code.
 So I added a
   COMPACT
 command.

 But the unit test I added indicates that I'm corrupting the database
 somehow.

 Patch attached - Thomas, perhaps you have an idea?

 Regards, Noel.

 On 2012-02-15 11:51, IntensiveH2 wrote:







  Thanks for the quick answer but currently it's not possible to reboot
  my application on a regular basis because my application must ensure
  scheduling, failover, HA 
  and it's not possible to stop it.
  I really need to have a solution at runtime without restarting my
  application.
  Thanks.

  On 15 f�v, 10:40, Noel Grandinnoelgran...@gmail.com  wrote:
  Not sure what Thomas' plans are,

  but what I can suggest is that you set this setting to a nice large number
  -Dh2.maxCompactTime=6
  And reboot your application on a regular basis.

  See herehttp://www.h2database.com/html/grammar.html#shutdown
  which sets the maximum time to compact the database on shutdown (in
  milliseconds).

  On 2012-02-15 11:05, IntensiveH2 wrote:

  Hi,
  I use H2 in a commercial product and I have an issue regarding the
  size of the DB (with a customer).
  Currently the DB size is 12 GB and after a shutdown compact/restart
  the new size is 800 MB
  When you start connection on DB (12 GB) it took around 70 minutes to
  start (on solaris) before to shutdow it with the compact option.
  This is not acceptable (from customer comment).
  NOTE: current version used of h2 are 1.3.159, 1.3.161 and 1.3.163 (the
  result is the same for all version)
  Do you have planned (urgently) to defragment/compact at runtime
  (similar to SHUTDOWN COMPACT) in a background thread?
  Do you have another solution to avoid this issue (long startup and
  compact at runtime)?
  Best regards.
  Thierry.



  online-compact.diff
 11KAfficherTélécharger

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: Something about the License

2012-02-23 Thread Ron
Hi
Anybody can help me?

On 2月22日, 下午9时06分, Ron nnronk...@gmail.com wrote:
 Sorry,I do not speak English. I have a question.
 If I develop a project using H2. This project is DB Server too, and I
 call it another name, but I tell to the user it is really H2,
 I just modify some code of H2 and add some other function.
 If I use this project to commercial area, did I violate the license?

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



FILE ID mismatch - upgrade db

2012-02-23 Thread Onno
Hi,

i am using the h2 database in a productive environment and we
accidently deployed the version 1.0.71 because that's the one in the
spring repository. (Yeah, that was pretty stupid)

Now I had to repair several databases manually with some dataloss
because the FILE ID mismatch error occured. In order to fix this, I
guess I need to upgrade the db engine. BUT: Currently I'm not able to
upgrade using the backup and restore process, so is there a version
thats safe to upgrade to just by replacing the jar which might solve
the current problem?

The highest version which still worked with an existing DB was
Version 1.1.119 (2009-09-26). Everything 1.2 complained about the
changed file format. Is this a stable release? Any major downsides to
this approach?

I know, this is probably not a good practice, but right now I need to
get rid of the error because I have more than 200 instances and some
of them already started to fail. I need a quick fix. The correct
upgrade will follow later...

I highly appreciate your answers!

Thanks,
Onno

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: Aggregate performance issue

2012-02-23 Thread Loic Petit
Hi Thomas,

Thanks for the answer (I didnt see it at first).
I'm just testing every possible query plans for a study and I have
also an accumulated buffer that can do the trick as well.
Any thoughts on why the group sorted has a poorer performance? Is
there a way to override the choices?

Thanks

LP

On 16 fév, 20:22, Thomas Mueller thomas.tom.muel...@gmail.com wrote:
 Hi,

 Large result sets are buffered on disk (in a temporary table or temporary
 file).

 What you could do is create a separate table where you keep the sum of the
 value, plus the count, grouped by id. The table would need to be updated
 using a trigger. That way, you don't need to read all rows every time.

 Regards,
 Thomas

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: backup encrypted database

2012-02-23 Thread Adam McMahon
Thomas,

Thanks for pointing that out, I did not realize that SCRIPT allowed
that.  Your solution will work fine.  Thanks again!

On Feb 22, 11:44 pm, Thomas Mueller thomas.tom.muel...@gmail.com
wrote:
 Hi,

 I would use the script statement; it does does support an encrypted
 target:http://h2database.com/html/grammar.html#script

 It's true that the backup statement doesn't encrypt the output file
 directly; in theory you could use the encrypting file system
 implementation, but this implementation is not complete yet.

 Regards,
 Thomas

 On Mon, Feb 20, 2012 at 8:21 PM, Adam McMahon 
 a...@cs.miami.edujavascript:;
 wrote:







  Hi H2 Group,

  I have an H2 database that I use the built in AES file encryption.  I
  would like to find a good backup solution in which the backup is also
  encrypted using the same file password

  I could copy the database file, but the database will always be
  running, so simply copying the file may not be a good solution.  And,
  if I understand the sql SCRIPT and BACKUP commands correctly they will
  not encrypt the output file.  Any ideas?

  Thanks,

  -Adam

  --
  You received this message because you are subscribed to the Google Groups

 H2 Database group. To post to this group, send email to 
 h2-database@googlegroups.comjavascript:;
 .
  To unsubscribe from this group, send email to

 h2-database+unsubscr...@googlegroups.com javascript:;. For more options, 
 visit this group at

 http://groups.google.com/group/h2-database?hl=en.









-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: User-Defined Function Values

2012-02-23 Thread Thomas Mueller
Hi,

 Referencing the column like this:

      id = resultSet.getString(getNextIdAndUpdate);

 Is not going to work when the column is named this:

     PUBLIC.GETNEXTIDANDUPDATE()

Ah, I guess the main problem is the () at the end. I didn't see that
first, sorry.

Could you change the query to:

SELECT getNextIdAndUpdate() AS getNextIdAndUpdate

Regards,
Thomas

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: Something about the License

2012-02-23 Thread Thomas Mueller
Hi,

 I just modify some code of H2 and add some other function.

In that case I believe you will have to post the changes you made to
the H2 source code. If you just call methods of H2 from within your
application, then not. Only if you change the H2 code itself.

Regards,
Thomas

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: User-Defined Function Values

2012-02-23 Thread Joe Parsons
 Ah, I guess the main problem is the () at the end. I didn't see that
 first, sorry.

 Could you change the query to:

 SELECT getNextIdAndUpdate() AS getNextIdAndUpdate


I certainly could, but my goal was to change nothing in the code to
accommodate my unit testing.  Referencing the column by name works
fine running against a standard PostgreSQL instance, which requires
neither the parenthesis nor the schema name.  Shouldn't H2's
PostgreSQL compatibility mode support this behavior?

- Joe

-- 
You received this message because you are subscribed to the Google Groups H2 
Database group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.