dotnet / orleans

Cloud Native application framework for .NET
https://docs.microsoft.com/dotnet/orleans
MIT License
10.07k stars 2.03k forks source link

PostgreSql provider doesn't initialize correctly #2991

Closed MonneOnrust closed 7 years ago

MonneOnrust commented 7 years ago

I'm building a .NET Core 1.1 app with packages from the orleans-prerelease MyGet repository. I'm trying to persist the grain state in PostgreSql, but there are some bugs in the initialization. The first is, when using the latest stable Npgsql package (currently 3.2.2), initialization hangs at the time a database connection is opened. With version 3.1.9 there is no hang and initialization fails at the time results from the default initialization query are parsed. The reason is that the database initialization script doesn't insert records for 'WriteToStorageKey', 'ReadFromStorageKey' and 'ClearStorageKey' in the 'OrleansQuery' table. Both bugs originate from Orleans.Storage.AdoNetStorageProvider.Init.

It seems like the PostgreSql provider isn't entirely finished, since there also isn't a storage table defined in the script that can hold grain state.

sergeybykov commented 7 years ago

@shayhatsor @veikkoeeva, what do you think?

shayhatsor commented 7 years ago

AFAIK @xclayl has implemented only membership, so @MonneOnrust is right, the PostgreSql provider doesn't have persistence implemented. I don't know of any limitation for using a specific package version. @MonneOnrust, Does the same hang happens on non .NET Core run ?

veikkoeeva commented 7 years ago

Yes, there is only membership. Specifically, no reminders, storages, queuing or geo-clustering or event sourcing. Will be added in due time, but can't promise dates. :)

MonneOnrust commented 7 years ago

Thanks for answering. @shayhatsor this issue also occurs with a .NET Framework host.

For which storage providers is grain persistence / event sourcing currently supported? And a second question: is there a page where you keep track of the features that are implemented in .NET Standard already?

xclayl commented 7 years ago

It has everything but storage/persistence, compared to SQL Server from 1.2.x. Looking at the history of the TSQL file, I don't see any changes other than storage, so I assume it's still the same as SQL Server minus storage. I have the Orleans development set up once again and I'll look at this when I can, which will probably be next week.

xclayl commented 7 years ago

I think this can be closed b/c the answer is persistence hasn't been implemented in Postgres. This was due to me personally not invested in that feature and I wouldn't be able to support it. The challenge isn't the Orleans framework I believe, but rather defining the Postgres tables structure and worrying about DB locking, concurrency, etc. If you wanted to take a stab at it, I can help you create a pull request, and I would imagine the core members here would very open to accepting it (with tests copied from the MySQL or SqlServer to cover this feature). If you want to run tests, they (currently) require integrated security (SSPI) in your pg_hba.conf file. I'm no expert with this, but I can help with whatever I know.