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

Inconsistent element count commig after store call #686

Open
helenoalves opened this issue Dec 27, 2023 · 2 comments
Open

Inconsistent element count commig after store call #686

helenoalves opened this issue Dec 27, 2023 · 2 comments

Comments

@helenoalves
Copy link

Hi Microstream Team,

I`m using microstream and receiving this error on the log from time to time: Inconsistent element count: specified 2 vs. iterated 8756688418745

For sure, with a different number of specified and iterated.
It happens on the part of code that I call store method of one collection.

I made several changes to this collection, such as removing and adding elements in a map that contains two nested Queues as values.

This is the microstream part of the code I have found this error:

if(address != elementsBinaryBound || iterator.hasNext())

I need two answers about it:

  1. How can I reproduce it in Unit Testing?
  2. Is there some approach that I should follow to overcome this issue? As calling storeRoot every time I change the root collection.

Looking forward to your support.

@helenoalves helenoalves changed the title Inconsiste Inconsistent element count commig after store call Dec 27, 2023
@hg-ms
Copy link
Contributor

hg-ms commented Jan 9, 2024

Hello,
Do you access the collection from multiple threads? If so, it is very likely that another thread modified the collection while Microstream did the store operation. The required synchronization can’t be done by Microstream and must be done by the application.

@helenoalves
Copy link
Author

helenoalves commented Jan 9, 2024

I got it!
It can be a probable cause.
Besides that, I have found that I was trying to store an empty collection in that case. So, I isolated the case and caught the BinaryPersistenceException.

I am happy to hear one response.
Thanks

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

No branches or pull requests

2 participants