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

bugfix: using collection name as key for caching collections #131

Conversation

TimoSchmechel
Copy link
Contributor

Currently the statename is used as the key for caching collections in the MongoGrainStorage. However the statename is always set to "state" as seen here in the Orleans source code: https://github.com/dotnet/orleans/blob/2bcd83351385c0dd98cd3a60cdcfb17ce890f966/src/Orleans.Runtime/Core/GrainRuntime.cs#L88C42-L88C42

This leads to all grain states using the same mongo collection. It will be the first one that gets created with that key which is likely undeterministic depending on your Orleans application.

A simple test scenario can highlight this bug. You just need 2 grain types with their own states. Depending on which grain type is activated first, will determine which mongo collection is used. I can provide a test repo if need be.

This fix just uses the collection name as the key in the cache.

@wassim-k
Copy link
Collaborator

Thanks for your contribution, can you please increase the patch version in Orleans.Providers.MongoDB.csproj and we can get it merged.

@TimoSchmechel
Copy link
Contributor Author

@wassim-k thats done

@wassim-k wassim-k merged commit 19d4b39 into OrleansContrib:master Dec 20, 2023
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants