storage has invalid header?

245 views
Skip to first unread message

Reinhard Schwab

unread,
Feb 1, 2016, 6:25:36 AM2/1/16
to MapDB
Hello,

I am new to MapDB and I have experienced one problem, when I try to open a db.

The stacktrace is

Exception in thread "main" java.io.IOError: java.io.IOException: storage has invalid header
at org.mapdb.StoreDirect.checkHeaders(StoreDirect.java:212)
at org.mapdb.StoreDirect.<init>(StoreDirect.java:197)
at org.mapdb.DBMaker.extendStoreDirect(DBMaker.java:800)
at org.mapdb.DBMaker.makeEngine(DBMaker.java:663)
at org.mapdb.DBMaker.make(DBMaker.java:631)
at kg.wikipedia.TestMapDB.getDB(TestMapDB.java:34)
at kg.wikipedia.TestMapDB.test1(TestMapDB.java:68)
at kg.wikipedia.TestMapDB.main(TestMapDB.java:107)
Caused by: java.io.IOException: storage has invalid header
... 8 more

The version of MapDB is 0.9.4.
I have transactions disabled, and I close the db before shutdown of the JVM by calling db.close().

This is how I get a db instance 

public DB getDB(File dbPath, boolean readonly) {
DBMaker<?> dbMaker = DBMaker.newFileDB(dbPath);
dbMaker = dbMaker.transactionDisable();
dbMaker = dbMaker.closeOnJvmShutdown();
if (readonly) {
// NOTE: i don't need transactions, disabling should improve speed
// db = DBMaker.newFileDB(dbPath).transactionDisable()
// .closeOnJvmShutdown().readOnly().make();
dbMaker = dbMaker.readOnly();
}
db = dbMaker.make();
return db;
}

If I enable transactions, I dont see the problem.


Best regards
Reinhard

Igor Castang

unread,
Feb 2, 2016, 11:17:45 AM2/2/16
to MapDB
Hello I would strongly advice to work with at least the last stable version :

http://mvnrepository.com/artifact/org.mapdb/mapdb/1.0.8

regards

Reinhard Schwab

unread,
Feb 3, 2016, 5:05:12 AM2/3/16
to MapDB
Hello I have now upgraded to 0.9.5 and it looks like the problem has gone. I will upgrade to 1.0.8 later...

thanks
Reply all
Reply to author
Forward
0 new messages