Geoweaver icon indicating copy to clipboard operation
Geoweaver copied to clipboard

Support for DEFRAG on H2

Open gokulprathin8 opened this issue 9 months ago • 2 comments

H2 currently does not automatically DEGRAF / COMPACT the database on quit. This creates huge file sizes. We need to explore further to see if we can make this run automatically

the command to run compact is

shutdown compact

but I dont think CRON is the solution here since the command shutsdown the db performing compact operation so the db connection will most probably be disconnected We shell / bash script to stop the geoweaver server and perform the operation and restart the server would be the best, we can do this at time when we expect no traffic like 3 AM

gokulprathin8 avatar Apr 29 '24 19:04 gokulprathin8

Currently he is how we perform defrag manually on our remote instance:

$ java -cp h2-1.3.176.jar org.h2.tools.Shell -url "jdbc:h2:file:/home/chetana/h2/gw.mv.db" -user "geoweaver" -password "<YOUR_PASSWORD>"
$ compact shutdown;

This operation should be performed automatically. A better alternative is by using SQLite which needs testing to make sure it is a drop-in replacement for H2.

gokulprathin8 avatar May 11 '24 23:05 gokulprathin8

try sqlite as our primary db https://github.com/xerial/sqlite-jdbc

gokulprathin8 avatar May 15 '24 20:05 gokulprathin8