-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Preliminary relational persistence queries #1682
Conversation
@shayhatsor Do you approve this change? |
@sergeybykov, @shayhatsor This is not ready to go in and the final queries go to the actual scripts. I'll update the heading. I just wanted to give a bit of heads up that I started pulling the pieces together and I'm sketching the solution. No later than next week I put down more detail as how I expect the queries behave when there is a significant amount of data. The script comments partially go into that direction already. |
@sergeybykov, this is a WIP of @veikkoeeva. I just read #1176. It is a great enhancement !
|
|
@sergeybykov. It's good we're moving forward from SQL Server 2000. The last refactoring was a bit more complicated since I kept support for SQL Server 2000. I might take the task of optimizing |
@shayhatsor Sounds good. We'll try to address #1068 in 1.3.0. |
A note that I update the queries and added notes on the script on my thinking. The cross-join operator creates some test data if one wants to try. I remember currently 10 000 000 rows, which would be a lot faster inserted another way, but perhaps this way it gives an idea how much effort it would take to insert that much data (in reality it'd be little more due to pessimistic locking, seen in the "update script") in production. The index is about 200 MB with that arrangement and the query does generate a RID lookup, but it doesn't look like hurting any. Had I moved it by using e.g. covering index ( The MySQL script should be much the same looking, but I work on it a bit later. I plan to incorporate this to the proper script and get the tests running. <edit: The script has slight inconsistencies on version numbers. Just ignore, work in progress etc. This is just to show I've made progress about the general approach and in case someone has an observation already in this early stages. |
<edit: Scrap the gists here, I put a more concrete idea at I have a positive delay attending some startup events on 26th and I'm preparing some material. If someone really needs this feature, ping me on Gitter and let's work out something. I got a bit stuck on deciding on how could I arrange all the tests nicely. :) I was thinking something that could drive the tests in parallel to all the backends and make setup more uniform or then just something that gets me running.
I very likely end up doing something less radical, but here as a git of the basic idea. Some explanation:
The purpose for per-backend tests is just to forward the calls to the actual test object, like here. If one uses theories, for instance, they need to be duplicated as per storage backend test. It looks to me this is the only place where one has duplication (there is also in current implementation). It would be nicer if one could inject the concrete The difference to the current membership tests would be to not to use inheritance and then separate setup/detection logic from constructors that are then inherited and use Anyway, that is what I was thinking the other night. I'm not pushing this idea too hard. Maybe test arrangement is a separate issue. If you have ideas, all welcomed of course. Some discussion on Gitter. |
I wrote earlier that I got stuck on thinking how to arrange so the persistence tests could be run on relational in all the relevant environments now and in the future. There has been some discussion time to time to somehow unify the various ways tests are being currently run. I included one proposal here as I was thinking on my way forward. Perhaps this could warrant a separate issue. The rationale:
The type of tests could be defined like this. A specific type of implementation exercising them could look like this. That is, it delegates the parameters to tests that all the implementations share. Instance data can be stored (in the common tests class) and specific backend types (like SQL Server) can define extra tests. I'm not sure if this is the right way to start discussion, but feedback invited for specifically on how I could reuse the persitence test logic on relational backend and then could I go with this plan and the other tests could be refactored as time allows. @jdom, thoughts? @sergeybykov? @jason-bragg? @shayhatsor? @dsarfati? Or whoever plans to work on this or has a stake here. |
@veikkoeeva, If I understand correctly, this PR is about the development of relational storage provider. Which will enable the use any ADO provider to persist grain state. That's a great enhancement. Another issue that you're raising here is about taking the "providers" tests to the next level. Currently, the test coverage is very good, but as you've pointed out, there's much room for improvement in terms of running in CI, checking and preparing test environments etc. |
[TestCategory("Functional"), TestCategory("Temp_Persistence"), TestCategory("SqlServer")] | ||
public Task PersistenceStorage_SqlServer_Read(int someValue) | ||
{ | ||
return PersistenceStorageTests.Store_Read(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this a Theory, since you aren't using someValue
at all?
@shayhatsor That is correct. I see @jdom made some good points already. I think it makes sense to move this to another issue and have discussion there. Even the worst outcome is a good one in that we get a place to discuss what would be desirable from a testing system. Personally I got somewhat stuck on thinking how to reuse the storage tests and I have experiened this pain of "how to reuse tests across backends" and "where to add and what so that it works without causing maintenance strain" before too. Other one is that I can see a situation in which I see Orleans source code run as a subtree or submodule dependency and perhaps the tests too, in which case the system could be more open-ended, open for extension, closed for modification. In any event, if it is OK, I would like to move tomorrow (in about 24 hours). It is personal life reasons in that I have pulled some all-nighters (unrelated to Orleans) and I think I need to sleep (so if there's glaringly sloppy thinking, it might explain it). :) (Oh, I see I didn't write in the preliminary script plan one of the goals is to make the structure also a readily sharded one, there isn't per-database generated. But I write about that later.) |
I do agree with both, that we should move the refactoring/sharing of the these tests across different implementations, to a different PR/issue altogether. |
@shayhatsor Getting readier. This is more as a heads up it should be almost there than asking for concrete review. I think I'd like to fix a few issues on hard-coding choices (e.g. serialization to to JSON format, queries hardcoded to the class), comments added the SQL script tidied and in general the code improved. I took this already for a short spin (reading, writing, cleaning) and it looked to manage them. Not plugged into tests yet either. Perhaps a notable issue here is that the natural |
@veikkoeeva, as always, your work is like an online course in relational storage 👍 |
@shayhatsor That is better, I like stronger typing. I'll do that an add one column for the key extension too. I forgot to mention currently there is One should prefer the chosen hash is reasonable collision resistant (Jenkins hash is) as externally supplied could be used to create grain IDs and DDoS the service and/or storage, but it should also be noted perhaps in comments at start, this coupling for the database might create an unwanted bond. |
{ | ||
new object[] | ||
{ | ||
GrainReference.FromGrainId(GrainId.GetGrainId(UniqueKey.NewKey(1, UniqueKey.Category.Grain))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should use random IDs so that concurrent test runs do not interfere with each other
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, a good point. I just looked the current tests won't run afoul each other even if concurrent, but there can be more test classes. I think I refine a bit on how the data sets are used too and redo this. Thanks for this, I'll hope to be in position to invite for wider scrutinty in the near future (I think I'll add some tests too).
@veikkoeeva, do you consider this PR ready for merge? As mentioned earlier, there are some improvements that can be done later. |
@shayhatsor I think so. I'll take a closer look today. I'll squash the two commits too by then. |
@veikkoeeva, take as much time as you need. It's important that we'll make an effort to contain all of the breaking changes required by the feature in this PR, making it the new contract definition between the ADO storage provider and the underlying storage. |
@shayhatsor (/cc @ashkan-saeedi-mazdeh) I think this is good to go. I fixed the name problem using code like this
|
I can squash these two commits together. Should I do it? |
For those who are interested, I think it is worth exploring the interception API and if there's something that should be changed, removed or added. For instance, it might very well be worth to add a possibility to intercept and even change the name of the grain name class (before extracting the base class when all information is present) so that one can evolve the name of the state class reading with old name, saving with a new one. I think currently all other cases are covered. |
key = new AdoGrainKey(grainReference.GetPrimaryKey(out keyExtension), keyExtension); | ||
} | ||
|
||
if(key == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition is always false, you can just remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tsibelman Cheers! You are right. I wonder what's the use of that function getting the key as string then..? :D
@veikkoeeva, I suggest you squash this PR into one commit. Maybe call it something like |
This introduces a new, simple to use storage provider for ADO.NET with first implementations for SQL Server and MySQL. This also removes the existing one, which was difficult to set up and evolve.
@shayhatsor Sounds like plan. Squashed also. |
@veikkoeeva, for you consideration, this is an exhaustive list of all the remaining issues, nice-to-haves, ideas, limitations or anything that might be relevant for future reference (these aren't sorted by importance):
|
Nice work here. If I may suggest something, please update the changelog.md file with something relevant to end users (breaking changes, etc). Doesn't need to be exhaustive, because you can link them to this PR |
@jdom, note that the commit message includes the relevant info. |
A quick note: I'll get back in about 1.5 hours. |
In addition to the exhaustive and detailed list I'd like to add a few more notes:
Phew! Likely all I had to write for now. :) |
@shayhatsor, @tsibelman Thanks for comments and patience, naturally. |
@jdom I'll update the release notes too before next release. Just give a nudge if you see I'm lagging. I'll try to do that soon, maybe even tomorrow. :) |
@veikkoeeva, thank you for this great contribution! |
An update storage provider for existing relational backends
Notes to follow...
Fixes #1176.