Search code examples
commitmapdb

java.lang.IllegalAccessError: WAL not empty; commit first, than compact


I put "localDb.commit();" before every "localDb.compact();" but still get the exception:

Exception in thread "Thread-0" java.lang.IllegalAccessError: WAL not empty; commit first, than compact at org.mapdb.StoreWAL.compactPreUnderLock(StoreWAL.java:1100) at org.mapdb.StoreDirect.compact(StoreDirect.java:810) at org.mapdb.EngineWrapper.compact(EngineWrapper.java:130) at org.mapdb.EngineWrapper.compact(EngineWrapper.java:130) at org.mapdb.DB.compact(DB.java:1626)

My commit(), compact() are located in Thread.run(), and my DBMaker configuration is:

DB localDb = DBMaker.newFileDB(new File(filename)).closeOnJvmShutdown().make();

store size: 471M, including *.compact, *.compact.p, *.p, *.t java -version: java version "1.8.0_11" uname -r: 2.6.32-279.el6.x86_64

Thanks!


Solution

  • https://github.com/jankotek/MapDB/issues/463

    I found the reason via my colleague's code review. It's my fault that I put commit() / compact() into a consumer thread, and queue.offer() into a producer thread, which called by a servlet; so "queue.offer()" may be called between "commit()" and "compact()".