Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read hashSet dbfile error #419

Closed
wszyquan opened this issue Dec 5, 2014 · 2 comments
Closed

read hashSet dbfile error #419

wszyquan opened this issue Dec 5, 2014 · 2 comments
Labels

Comments

@wszyquan
Copy link

wszyquan commented Dec 5, 2014

java.lang.AssertionError
at org.mapdb.SerializerPojo.deserializeUnknownHeader(SerializerPojo.java:444)
at org.mapdb.SerializerBase.deserialize3(SerializerBase.java:1216)
at org.mapdb.SerializerBase.deserialize(SerializerBase.java:1132)
at org.mapdb.SerializerBase.deserialize(SerializerBase.java:867)
at org.mapdb.SerializerPojo.deserialize(SerializerPojo.java:701)
at org.mapdb.HTreeMap$2.deserialize(HTreeMap.java:135)
at org.mapdb.HTreeMap$2.deserialize(HTreeMap.java:121)
at org.mapdb.Store.deserialize(Store.java:297)
at org.mapdb.StoreDirect.get2(StoreDirect.java:475)
at org.mapdb.StoreWAL.get2(StoreWAL.java:368)
at org.mapdb.StoreWAL.get(StoreWAL.java:352)
at org.mapdb.EngineWrapper.get(EngineWrapper.java:58)
at org.mapdb.AsyncWriteEngine.get(AsyncWriteEngine.java:333)
at org.mapdb.Caches$HashTable.get(Caches.java:245)
at org.mapdb.EngineWrapper.get(EngineWrapper.java:58)
at org.mapdb.HTreeMap.recursiveDirCount(HTreeMap.java:350)
at org.mapdb.HTreeMap.recursiveDirCount(HTreeMap.java:345)
at org.mapdb.HTreeMap.recursiveDirCount(HTreeMap.java:345)
at org.mapdb.HTreeMap.recursiveDirCount(HTreeMap.java:345)
at org.mapdb.HTreeMap.sizeLong(HTreeMap.java:325)
at org.mapdb.HTreeMap.size(HTreeMap.java:305)
at org.mapdb.HTreeMap$KeySet.size(HTreeMap.java:795)
at com.snd.api.message.MapDb.dbSetFile(MapDb.java:131)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Test case below

run two times throw above error

@test
public void dbSetFile() {
// configure and open database using builder pattern.
// all options are available with code auto-completion.
DB db = DBMaker.newFileDB(new File("c://testdbset23"))
.closeOnJvmShutdown().transactionDisable()
/* encryptionEnable("password") */.make();

    String setName = "hashSet2";
    Set<Integer> set = null;

    if (!db.exists(setName)) {
        HTreeSetMaker treeSet = db.createHashSet(setName);
        set = treeSet.expireAfterAccess(30, TimeUnit.DAYS).make();
        System.out.println("create");
    } else {
        set = db.getHashSet(setName);
        System.out.println("read exists");
    }

    System.out.println(set.contains(1));
    for (int i = 0; i < 10000; i++)
        set.add(i);

    System.out.println(set.size());
    db.close();

}
@jankotek
Copy link
Owner

Fixed in 1.0 branch with 39ba84d commit

@jankotek
Copy link
Owner

This issue is now fixed in both branches

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants