ADO.NET configuration improvements
This is continuation to #3864, which should be done in any case. In addition to it
- The new Orleans 2.0.0 configuration options could also make it easier to deploy the database script by a function call, even creating a database if one doesn't exist. This is already being done in tests.
- The deployment could make use of function calls such as
UselSqlServer,UseMySqland fail with clear message if the approriate connector library is not found. - Some internal configuration option on choosing serializers, streaming and so on could be lifted to
Option<T>system.
Additionally, it could make sense to provide a series of retry functions that perhaps take account database error codes (e.g. deadlocks retried, log-in failures aborting immediately). The retry functions could provide functions with a different shape to different occasions. Consider this as opposed to or in concomitance to widely used circuit breakers such as Polly.
Adding here that when deploying services, such as reminders, persistence and so on, an option to migragate from previous version could be useful. Additional hurdle is that, say, if there's potentially hundreds of gigabytes of data in persistent storage or tens of millions of rows in reminders table, how to do that gracefully dependent on deployment characteristics. One way could be with a overridable default implementation that is sensible in such as a way that not every piece of data needs to be migrated atomically.
Now that Orleans has moved to the new configuration system, it would make sense to add an option to point to a specific connector library to load. One example is https://github.com/mysql-net/MySqlConnector, which is an option one might favour as opposed to the "official distribution". This could be true for any connector library.
Cross-referencing also https://github.com/dotnet/orleans/pull/3262 (and /cc @berdon).
To add some notes, ideally this could be configurable per version and maybe even per operation (e.g. for Oracle MySql libraries some operations related streaming are blocking ones, not all). Which would mean we perhaps would like to surface the connector loader to the options and even turn the connector info into a class which can explicitly set the control flags, such as https://github.com/dotnet/orleans/blob/master/src/AdoNet/Shared/Storage/RelationalStorage.cs#L274 that takes some extra precaution to make calls unblocking.
This is a performance benefit, but also a way for users to quickly unblock themselves without waiting for a Orleans Nuget release if a bug surfaces in a connector library and it needs to be used.
Paging @xiazen since this touches upon https://github.com/dotnet/orleans/issues/4059 (public surface).
Let me summarize this, since it touches many issues I want to make sure I didn't miss anything.
- use the option and DI way to configure (de)serializers , which also is one way to solve the migration problem you mentioned in your second comment. issue opened for this #4059.
- make database scrip finding easier, issue opened #3864 , consider utilizing option and NugetContentFiles on this.
- @veikkoeeva you mentioned streaming, which I don't quite understand, AdoNet providers has no streaming providers, right? Am I misunderstanding what you mean by streaming ? But orleans streaming can definitely use some love of options, an issue was openned for it #4080
- Utilizing option to enable loading a third-party connector library. related issue #3262
- make
isSynchronousAdoNetImplementationconfigurable
Is this all ? Or did I miss anything?
@xiazen
- The migration problem solved by (de)serializer configuration is possible partially. I.e. when one wants to change the serialization format, say, from binary to JSON or to some other format Orleans doesn't even control. This could be, say, Parquet, and inserted into Hadoop cluster via SQL Server (to make an example). The other part is to just to write plain hand-crafted transformation code. This is currently supposed to be done so that one inherits from the picker and writes it there and chooces (de)serializer however is needed for the task at hand. I think this would require proper pipeline, as noted in Gitter discussion.
- Indeed, when installing the Nuget package, it would make sense to have the scripts in project root. They're easier to find that way, also in the future adding configuration that does things like creates the database if it doesn't exist anymore (creates perhaps schemas, filegroups etc.) would be a lot easier to to add in subsequent releases. Those who want more control can do otherwise. For instance, I have a sample project in the makings where I've moved them into a
.sqlprojand deploy via Dacpac, but someone might prefer DbUp, Red Gate or some other tooling. - You are right. I mentioned streaming as in using
Stream. I don't know what would be the way to expose per-provider settings like this. This particular feature is useful if the data blobs are large, since otherwise the providers work by allocating a large array and trying to load all the data at once. Database can ingest even multi-gigabyte blobs. Maybe for Orleans 3.0 patching/streaming becomes an option andCancellationTokenis extended to client-side too. :) This also touches upon (de)serializer choice in that if one knows data is going via client to database, it'd make to be able to choose (de)serializer per-grain and avoid encoding/decoding hassle. - Sounds very good.
- That flag is already configurable, but the value is actually hard-coded per ADO.NET invariant -- not per connector library and version. You can see the configuration here. It would be useful if this factory here could use these libraries as default, but could also use, say, something like
Func<TLibrary>to load one supplied by the user. One example of such a connector library is MySqlConnector. In .NET Full there was a way to do this "in a standard way" (see docs), but it was at least briefly removed in .NET Standard 1.n (but see https://github.com/dotnet/corefx/issues/4571#issuecomment-303203528). It's worth looking into this again, I think. This would have been my preferred way to handle the situation originally, unfortunately the original configuration system made it nigh impossible, so an invariant indicator was tacked as a extra parameter to the configuration string.
Some of this may sound as "not needed", but relational vendors make a selling point about the 1001 one knobs they have and how reliably one can run business on them. When Azure SLAs won't cut it. :)
We are marking this issue as stale due to the lack of activity in the past six months. If there is no further activity within two weeks, this issue will be closed. You can always create a new issue based on the guidelines provided in our pinned announcement.
This issue has been marked stale for the past 30 and is being closed due to lack of activity.