Hello,
I'm using the latest version of mapdb and sometimes I have the following exception (under windows):
INFO | jvm 1 | 2013/09/24 07:32:57 | Caused by: java.lang.InternalError: could not rename file
INFO | jvm 1 | 2013/09/24 07:32:57 | at org.mapdb.StoreDirect.compact(StoreDirect.java:670)
INFO | jvm 1 | 2013/09/24 07:32:57 | at org.mapdb.StoreWAL.compact(StoreWAL.java:743)
INFO | jvm 1 | 2013/09/24 07:32:57 | at org.mapdb.EngineWrapper.compact(EngineWrapper.java:111)
INFO | jvm 1 | 2013/09/24 07:32:57 | at org.mapdb.EngineWrapper.compact(EngineWrapper.java:111)
INFO | jvm 1 | 2013/09/24 07:32:57 | at org.mapdb.DB.compact(DB.java:1264)
After this exception, mapdb is unusable and I lost all datas:
INFO | jvm 1 | 2013/09/24 07:34:17 | Caused by: java.lang.NullPointerException
INFO | jvm 1 | 2013/09/24 07:34:17 | at org.mapdb.Volume$ByteBufferVol.internalByteBuffer(Volume.java:317)
INFO | jvm 1 | 2013/09/24 07:34:17 | at org.mapdb.Volume$ByteBufferVol.getLong(Volume.java:356)
INFO | jvm 1 | 2013/09/24 07:34:17 | at org.mapdb.StoreWAL.getLongStackPage(StoreWAL.java:575)
INFO | jvm 1 | 2013/09/24 07:34:17 | at org.mapdb.StoreWAL.longStackTake(StoreWAL.java:599)
INFO | jvm 1 | 2013/09/24 07:34:17 | at org.mapdb.StoreDirect.freePhysTake(StoreDirect.java:833)
INFO | jvm 1 | 2013/09/24 07:34:17 | at org.mapdb.StoreDirect.physAllocate(StoreDirect.java:509)
INFO | jvm 1 | 2013/09/24 07:34:17 | at org.mapdb.StoreWAL.put(StoreWAL.java:98)
INFO | jvm 1 | 2013/09/24 07:34:17 | at org.mapdb.Caches$HashTable.put(Caches.java:186)
INFO | jvm 1 | 2013/09/24 07:34:17 | at org.mapdb.EngineWrapper.put(EngineWrapper.java:45)
INFO | jvm 1 | 2013/09/24 07:34:17 | at org.mapdb.SnapshotEngine.put(SnapshotEngine.java:44)
INFO | jvm 1 | 2013/09/24 07:34:17 | at org.mapdb.BTreeMap.put2(BTreeMap.java:712)
INFO | jvm 1 | 2013/09/24 07:34:17 | at org.mapdb.BTreeMap.put(BTreeMap.java:566)
Questions are :
How to prevent from this issue?
How to restore original files?
How to perform a backup before the compact execution?
Note: Exception in the code is here
if(!physFile.renameTo(physFile_))throw new InternalError("could not rename file");
Maybe it can be useful to add more information in InternalError like throw new InternalError("could not rename file " + physFile + " to" + physFile_)
Thanks.