nitrite / nitrite-java

NoSQL embedded document store for Java

Home Page:https://bit.ly/no2db

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error after update 3.4.3 -> 3.4.4

envas opened this issue · comments

I updated Nitrite in my app from 3.4.3 to 3.4.4 (that's the only change I've made, no code changed) I now I get an error when accessing database , concrete on db.getRepository(My.class). When I revert back to 3.4.3 everything is ok. So for now I am sticky with 3.4.3.

What I did:

  1. Close the database in the app with 3.4.3 on classpath, leave the app.
  2. Start the app with 3.4.4 on classpath
    • open database is ok
    • db.getRepository() crashes with the following error - full errro stack follows
Exception in thread "main" java.lang.ExceptionInInitializerError
        at com.neopsis.cb200.GwBootstrap.bootstrap(GwBootstrap.java:146)
        at com.neopsis.cb200.CBox4J.main(CBox4J.java:79)
Caused by: java.lang.IllegalStateException: Unable to read the page at position 824633732560 [1.4.200/6]
        at org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:950)
        at org.h2.mvstore.MVStore.readPage(MVStore.java:2213)
        at org.h2.mvstore.MVMap.readPage(MVMap.java:672)
        at org.h2.mvstore.MVMap.readOrCreateRootPage(MVMap.java:688)
        at org.h2.mvstore.MVMap.setRootPos(MVMap.java:682)
        at org.h2.mvstore.MVStore.openMap(MVStore.java:576)
        at org.h2.mvstore.MVStore.openMap(MVStore.java:535)
        at org.h2.mvstore.MVStore.openMap(MVStore.java:516)
        at org.dizitart.no2.store.NitriteMVStore.openMap(NitriteMVStore.java:89)
        at org.dizitart.no2.internals.IndexMetaService.getIndexMetadata(IndexMetaService.java:152)
        at org.dizitart.no2.internals.IndexMetaService.hasIndex(IndexMetaService.java:60)
        at org.dizitart.no2.internals.NitriteService.hasIndex(NitriteService.java:93)
        at org.dizitart.no2.internals.DefaultNitriteCollection.hasIndex(DefaultNitriteCollection.java:114)
        at org.dizitart.no2.objects.DefaultObjectRepository.createIndexes(DefaultObjectRepository.java:317)
        at org.dizitart.no2.objects.DefaultObjectRepository.initRepository(DefaultObjectRepository.java:303)
        at org.dizitart.no2.objects.DefaultObjectRepository.<init>(DefaultObjectRepository.java:57)
        at org.dizitart.no2.objects.RepositoryFactory.open(RepositoryFactory.java:46)
        at org.dizitart.no2.Nitrite.getRepository(Nitrite.java:140)
        at com.neopsis.cb200.database.Db.getDbConfig(Db.java:279)
        at com.neopsis.cb200.database.Db.getDbConfig(Db.java:271)
        at com.neopsis.cb200.database.MemDb.<clinit>(MemDb.java:43)
        ... 2 more
Caused by: java.lang.IllegalArgumentException: Could not deserialize [-84, -19, 0, 5, 115, 114, 0, 53, 111, 114, 103, 46, 100, 105, 122, 105, 116, 97, 114, 116, 46, 110, 111, 50, 46, 105, 110, 116, 101, 114, 110, 97, 108, 115, 46, 73, 110, 100, 101, 120, 77, 101, 116, 97, 83, 101, 114, 118, 105, 99, 101, 36, 73, 110, 100, 101, 120, 77, 101, 116, 97, 19, -115, 41, 124, -29, 79, -77, -36, 2, 0, 3, 76, 0, 5, 105, 110, 100, 101, 120, 116, 0, 24, 76, 111, 114, 103, 47, 100, 105, 122, 105, 116, 97, 114, 116, 47, 110, 111, 50, 47, 73, 110, 100, 101, 120, 59, 76, 0, 8, 105, 110, 100, 101, 120, 77, 97, 112, 116, 0, 18, 76, 106, 97, 118, 97, 47, 108, 97, 110, 103, 47, 83, 116, 114, 105, 110, 103, 59, 76, 0, 7, 105, 115, 68, 105, 114, 116, 121, 116, 0, 43, 76, 106, 97, 118, 97, 47, 117, 116, 105, 108, 47, 99, 111, 110, 99, 117, 114, 114, 101, 110, 116, 47, 97, 116, 111, 109, 105, 99, 47, 65, 116, 111, 109, 105, 99, 66, 111, 111, 108, 101, 97, 110, 59, 120, 112, 115, 114, 0, 22, 111, 114, 103, 46, 100, 105, 122, 105, 116, 97, 114, 116, 46, 110, 111, 50, 46, 73, 110... [1.4.200/0]
        at org.h2.mvstore.DataUtils.newIllegalArgumentException(DataUtils.java:924)
        at org.h2.mvstore.type.ObjectDataType.deserialize(ObjectDataType.java:376)
        at org.h2.mvstore.type.ObjectDataType$SerializedObjectType.read(ObjectDataType.java:1547)
        at org.h2.mvstore.type.ObjectDataType.read(ObjectDataType.java:231)
        at org.h2.mvstore.type.ObjectDataType.read(ObjectDataType.java:114)
        at org.h2.mvstore.Page$Leaf.readPayLoad(Page.java:1511)
        at org.h2.mvstore.Page.read(Page.java:607)
        at org.h2.mvstore.Page.read(Page.java:239)
        at org.h2.mvstore.MVStore.readPage(MVStore.java:2211)
        ... 21 more
Caused by: java.io.InvalidClassException: org.dizitart.no2.internals.IndexMetaService$IndexMeta; local class incompatible: stream classdesc serialVersionUID = 1408827874803168220, local class serialVersionUID = 1647971212
        at java.base/java.io.ObjectStreamClass.initNonProxy(Unknown Source)
        at java.base/java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
        at java.base/java.io.ObjectInputStream.readClassDesc(Unknown Source)
        at java.base/java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
        at java.base/java.io.ObjectInputStream.readObject0(Unknown Source)
        at java.base/java.io.ObjectInputStream.readObject(Unknown Source)
        at java.base/java.io.ObjectInputStream.readObject(Unknown Source)
        at org.h2.mvstore.type.ObjectDataType.deserialize(ObjectDataType.java:374)
        ... 28 more

Looks like the problem is the new IndexMeta serialID! What have happened:

  • the 3.4.3 database serialized data with a generated serial ID
  • when I try to read read this data with the version 3.4.4 with another serial ID, I get the error and I can't use the old database anymore because the two classes do not have the same Serial ID and my program have no guarantee that the two serialized objects correspond to the same class format.

This is for me a breaking change!

Please stick to 3.4.3 version. 3.4.4 was released to fix the issue with generic serial UID. If you are creating new database, you can go with 3.4.4, otherwise stick to 3.4.3.