Severe regression in Microsoft.Orleans.Persistence.AdoNet when migrating from Orleans 3 to 9
- Dominant language
- C#
- Stars
- 10.9k
- Forks
- 2.1k
- Avg merge
- 14h 42m
- Merged PRs (30d)
- 354
Description
Hi!
I'm migrating a fairly large project from Orleans 3.x to Orleans 9.2.1, and I'm encountering major issues with the AdoNet Persistence provider.
The primary problem is that the storage layer no longer uses the grain type in the key construction.
Instead, it uses a hard-coded string "state" as part of the key.
As a result, if multiple grains of different types share the same grain ID (which seems to be very common and valid scenario), the generated key is identical for all of them — leading to conflicts and broken persistence behavior.
In Orleans 3.x, the grain type was correctly included in the key, preventing this collision.
This effectively means AdoNet persistence is now unusable in real-world scenarios.
I’ve created a minimal reproduction of the issue here: https://github.com/srollinet/Orleand.AdoNetPersistenceIssue
This issue has already been raised here https://github.com/dotnet/orleans/issues/8746 2 years ago but was never adressed
And maybe this issue https://github.com/dotnet/orleans/issues/9706 is also a regression caused by the same changes
looking at the code https://github.com/dotnet/orleans/blob/f23233a70dd3c4d5f216c7be2aa2ed8faca7a58a/src/AdoNet/Orleans.Persistence.AdoNet/Storage/Provider/AdoNetGrainStorage.cs#L208-L214
It is clear that it hasn't evolved after changes on the interface (which is now missleading due to inconsistencies between the parameter names and their values)
- `grainType` is always `"state"` -> calling `ExtractBaseClass(grainType);` doesn't make sense anymore
- `grainReference` is not a reference anymore
There are also a few less critical issues:
- Documentation for AdoNet persistence is unclear and outdated.
- Some SQL scripts are missing or inconsistent across providers. (PR openend >1 year ago https://github.com/dotnet/orleans/pull/8896)
My biggest concern is that the `Microsoft.Orleans.Persistence.AdoNet` package appears to be poorly maintained:
- The repository contains no test coverage for this provider.
- Related issues have been reported for years without resolution.
- It seems this persistence provider may have been deprioritized or even abandoned.
Given that AdoNet persistence is part of the official Orleans distribution, it’s a bit concerning to see such a major regression go unaddressed for multiple releases.
I’d be happy to help work on a fix, however, from my initial analysis, it seems difficult to do so without introducing a breaking change, since any fix that changes the key format might break existing setups where the current behavior does not cause issues.
I’d appreciate any guidance or input on how best to approach this.
Thank you for your time and for maintaining Orleans! (Which is a framework I truly appreciate and enjoy working with, despite the tone of this issue.)
Contributor guide
Research direction
Start with src/AdoNet/Orleans.Persistence.AdoNet/Storage/Provider/AdoNetGrainStorage.cs at the cited lines, then run the linked minimal reproduction and compare its key behavior with Orleans 3.x. Review the related issues and SQL-script PR before deciding how compatibility should work; done means distinct grain types persist without key collisions and the provider has regression coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100