Search code examples
databasegrails

What are these autogenerated Db files?


I'm developing a grails app that uses reentrant locking and database locking. I just noticed some additional files that were autogenerated. I am wondering what they are. They are called:

devDb.h2.db
devDb.lock.db
devDb.trace.db

There is also a set for test configuration:

testDb.h2.db
testDb.trace.db

I am assumming that *Db.h2.db is just my database (set to be a file rather than in memory in my DataSource.groovy). But what about the other ones?


Solution

    • devDb.h2.db is the database itself. ( devDb.mv.db for the newer version )
    • devDb.lock.db is a lock file. H2 allows multiple processes to share the database and this file is used to coordinate access. When the database shuts down cleanly, this file should be removed automatically.
    • devDb.trace.db is just a log for inspecting or debugging H2. Whether or not it's created and how much detail gets logged can be controlled by adding a TRACE_LEVEL_FILE parameter to the JDBC URL.
    • testDb.h2.db and testDb.trace.db are the same as the devDb counterparts that are used in the test environment (e.g. grails test-app).