Open stiv-yakovenko opened 5 years ago
I also tried alternative approach:
db.close();
try {
Files.delete(Paths.get(DB_FILE_NAME));
} catch (IOException e) {
e.printStackTrace();
}
db = DBMaker
.fileDB(DB_FILE_NAME).transactionEnable()
.make();
but I get
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.stivyakovenko.WebServer.main(WebServer.java:71)
Caused by: org.mapdb.DBException$FileLocked: File is already opened and is locked: ./db/simple
at org.mapdb.volume.Volume.lockFile(Volume.java:502)
at org.mapdb.volume.RandomAccessFileVol.<init>(RandomAccessFileVol.java:52)
at org.mapdb.volume.RandomAccessFileVol$1.makeVolume(RandomAccessFileVol.java:26)
at org.mapdb.StoreWAL$realVolume$1.invoke(StoreWAL.kt:75)
at org.mapdb.StoreWAL$realVolume$1.invoke(StoreWAL.kt:18)
at org.mapdb.StoreWAL.<init>(StoreWAL.kt:74)
at org.mapdb.StoreWAL$Companion.make(StoreWAL.kt:56)
at org.mapdb.StoreWAL$Companion.make$default(StoreWAL.kt:55)
at org.mapdb.DBMaker$Maker.make(DBMaker.kt:464)
at org.stivyakovenko.SimpleDB.<clinit>(SimpleDB.java:21)
... 1 more
I have treemap in mapdb with 150K entries. Calling treemap.clear() takes minutes. How can I do this quickly? Creating new one with
gives crash org.mapdb.DBException$WrongConfiguration: Named record already exists: pageCache. How can I clear collection in a reasonable time?
Thanx.