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

Chunk ... no longer exists #41

Closed
ptoews opened this issue Dec 21, 2017 · 14 comments
Closed

Chunk ... no longer exists #41

ptoews opened this issue Dec 21, 2017 · 14 comments
Assignees
Labels
Milestone

Comments

@ptoews
Copy link

ptoews commented Dec 21, 2017

I'm using Nitrite database to store a million documents and then perform different read operations on them (for benchmarking).
After storing the documents, while trying to read all documents via collection.find().iterator(), I get the following exception:

java.lang.IllegalStateException: Chunk 162 no longer exists [1.4.196/9]
	at org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:765)
	at org.h2.mvstore.MVStore.getChunkIfFound(MVStore.java:953)
	at org.h2.mvstore.MVStore.getChunk(MVStore.java:935)
	at org.h2.mvstore.MVStore.readPage(MVStore.java:1943)
	at org.h2.mvstore.MVMap.readPage(MVMap.java:741)
	at org.h2.mvstore.Page.getChildPage(Page.java:217)
	at org.h2.mvstore.Cursor.fetchNext(Cursor.java:150)
	at org.h2.mvstore.Cursor.next(Cursor.java:50)
	at org.dizitart.no2.internals.DocumentCursor$DocumentCursorIterator.nextMatch(DocumentCursor.java:115)
	at org.dizitart.no2.internals.DocumentIterator.next(DocumentIterator.java:54)
	at org.dizitart.no2.internals.DocumentIterator.next(DocumentIterator.java:32)
        ...

Then, the next smaller read operations return more values than they should.(Not related to this problem)
I create the database with the default options and three indexes, and it occurs with and without enabled compressing. The used version is 2.1.0.

Is a million documents too much for Nitrite? The same data and test cases work fine with pure MVStore. Inserting only ~340 entries works fine too.

@anidotnet
Copy link
Contributor

Could you please post the complete code here for both nitrite and mvstore alone to reproduce this error?

@anidotnet anidotnet self-assigned this Dec 22, 2017
@ptoews
Copy link
Author

ptoews commented Dec 22, 2017

I've tested it with another dataset with ~270k entries that worked fine as well.
The project is really big and many classes are involved, so I hope the adapter classes are enough for you:

NitriteDB:
Constructing DB:

Nitrite db = Nitrite.builder().compressed()
			.filePath(storageDir + File.separatorChar + DB_FILE).openOrCreate();
NitriteCollection collection = db.getCollection(COLLECTION_NAME);
this.collectionAccessor = new CollectionAccessor(db, collection);

CollectionAccessor.java: https://pastebin.com/N63681vg
IteratorWrapper.java: https://pastebin.com/vpeXUMcE

MVStore:
H2MVStoreMultiMap.java: https://pastebin.com/V8wsUXP2
IteratorWrapper is basically the same, without the document converting.

@anidotnet
Copy link
Contributor

MVStore example is not giving this exception is because you are creating only one map there. But in nitrite, it creates 6 maps - 1 for collection, 3 for indices, 2 for meta information.

Can you please do me a favor and create 4 mvmaps in mvstore example and insert data in all of them simultaneously in the same fashion? I just need to confirm if it is the volume of data that is creating problem or not. I might take this case to mvstore developers, so it will be better if I give as much info as possible.

@ptoews
Copy link
Author

ptoews commented Dec 22, 2017

I forgot to mention that H2MVStoreMutliMap class is instantiated three times.
But why do you want me to create only 4 mvmaps? What are the other two for then, because indexing should be enabled there too.

However, instantiating my MVStore multimap both 4 and 6 times works without problems.

@anidotnet
Copy link
Contributor

I just want to make sure, you are creating 4 mvmaps in the same store and inserting 1 million of records in each of them parallely right?

I asked for 4 mvmaps, as other 2 are meta maps, it contains only few records, so does not contribute to this problem at all.

@ptoews
Copy link
Author

ptoews commented Dec 22, 2017

I just want to make sure, you are creating 4 mvmaps in the same store and inserting 1 million of records in each of them parallely right?

Yes, exactly.

@anidotnet
Copy link
Contributor

Thank you. Let me re-create the scenario and see what can be done about this.

@anidotnet anidotnet added the bug label Dec 22, 2017
@ptoews
Copy link
Author

ptoews commented Dec 22, 2017

I'm currently trying to reduce the code for reproducing the error as well, and it looks like it depends on an outer layer that I didn't include here. I'll keep you updated if there maybe is a mistake on my side.

@ptoews
Copy link
Author

ptoews commented Dec 22, 2017

Nevermind that, I just didn't get the exception sometimes randomly.
So here is the reduced code that definitely threw one for me:
https://pastebin.com/kk9P06sG

@anidotnet
Copy link
Contributor

Thanks a lot for the time. I am looking into it.

@anidotnet anidotnet modified the milestones: 2.1.0, 2.1.1 Dec 27, 2017
anidotnet added a commit that referenced this issue Dec 27, 2017
@anidotnet
Copy link
Contributor

Fix is ready in 2.1.1-SNAPSHOT. Please test and confirm

@ptoews
Copy link
Author

ptoews commented Dec 28, 2017

I'm using Nitrite via Maven, but it's not available there yet?

@anidotnet
Copy link
Contributor

anidotnet commented Dec 28, 2017

@ptoews
Copy link
Author

ptoews commented Dec 28, 2017

Thanks. Yes, now it works.

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