Hi, guys. There I had used the MapDB to stored byte array data in hash set data struct. But some times there had throws an strange exception. see below:
org.mapdb.DBException$PointerChecksumBroken: Bit parity in file pointer is broken, data possibly corrupted.
at org.mapdb.DataIO.parity4Get(DataIO.java:1149)
at org.mapdb.StoreCached.loadLongStackPage(StoreCached.java:248)
at org.mapdb.StoreCached.longStackTake(StoreCached.java:179)
at org.mapdb.StoreDirect.freeRecidTake(StoreDirect.java:1644)
at org.mapdb.StoreDirect.preallocate(StoreDirect.java:595)
at org.mapdb.StoreCached.put(StoreCached.java:501)
at org.mapdb.Engine$CloseOnJVMShutdown.put(Engine.java:450)
at org.mapdb.HTreeMap.putNew(HTreeMap.java:978)
at org.mapdb.HTreeMap.putInner(HTreeMap.java:953)
at org.mapdb.HTreeMap.put(HTreeMap.java:883)
at org.mapdb.HTreeMap$KeySet.add(HTreeMap.java:1278)
at so.sao.analytics.sdk.mapdb.MessageStoreDB.push(MessageStoreDB.java:95)
By now my resolve way is delete the MapDB build filed, then restart server again. It's run well. So strange. My MapDB work code like below:
DB db = DBMaker.fileDB(dbFile)
.asyncWriteEnable()
.transactionDisable()
.closeOnJvmShutdown()
.make();
Set<byte[]> messages = db.hashSet(topicName, Serializer.BYTE_ARRAY);
messages.add(byte[]); // also the exception had happened here.
Also I had other question, how can I use one MapDB file in multi threads. Just closed the locked type. all right?
So is there some thing wrong in my code. Wait for you reply. Thanks.