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

Always read grain state during activation if it has not been rehydrated #8944

Merged
merged 4 commits into from
Apr 13, 2024

Conversation

ReubenBond
Copy link
Member

@ReubenBond ReubenBond commented Apr 12, 2024

Fixes #8936

This fixes the issue identified in #8936 where accessing state in the grain's constructor would cause it to not be loaded during activation. Additionally, trying to access RecordExists before a successful read has been issued will result in an InvalidOperationException being thrown.

This also reduces the number of fields in StateStorageBridge<T> by moving fields which can be shared between multiple instances to a shared object.

Microsoft Reviewers: Open in CodeFlow

@ReubenBond ReubenBond force-pushed the perf/statestoragebridge-lighten branch from 518d453 to 36c1f07 Compare April 13, 2024 15:33
@ReubenBond ReubenBond changed the title Reduce memory footprint of StateStorageBridge<TState> Stop access to grain state prior to activation from preventing state read during activation Apr 13, 2024
@ReubenBond ReubenBond changed the title Stop access to grain state prior to activation from preventing state read during activation Always read grain state during activation if it has not been rehydrated Apr 13, 2024
@ReubenBond ReubenBond merged commit deda4ba into dotnet:main Apr 13, 2024
18 checks passed
@ReubenBond ReubenBond deleted the perf/statestoragebridge-lighten branch April 13, 2024 16:17
@github-actions github-actions bot locked and limited conversation to collaborators May 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IPersistentState<MyClass>.RecordExists is false until .ReadStateAsync() is called
1 participant