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

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

我把 "localDb.commit();" 放在每个 "localDb.compact();" 之前,但仍然得到异常:

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)

我的commit()、compact()位于Thread.run(),我的DBMaster配置是:

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

存储大小:471M,包括*.compact、*.compact.p、*.p、*.t java-版本:java版本“1.8.0_11” uname -r: 2.6.32-279.el6.x86_64

谢谢!

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()".