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

Get Postgres Storage Provider Working #3384

Merged
merged 2 commits into from Sep 8, 2017
Merged

Get Postgres Storage Provider Working #3384

merged 2 commits into from Sep 8, 2017

Conversation

ashtonkj
Copy link
Contributor

@ashtonkj ashtonkj commented Sep 6, 2017

Fix Postgresql CreateOrleansTables script
Add PostgreSqlStorageTests.

Huge thanks to @halfnelson for getting the SQL script working. Tests seem to be passing except for those referenced in #3163 (comment).

See screenshot:
postgresqlorleans1

Add PostgreSqlStorageTests.
@dnfclas
Copy link

dnfclas commented Sep 6, 2017

@ashtonkj,
Thanks for your contribution.
To ensure that the project team has proper rights to use your work, please complete the Contribution License Agreement at https://cla2.dotnetfoundation.org.

It will cover your contributions to all .NET Foundation-managed open source projects.
Thanks,
.NET Foundation Pull Request Bot

@dnfclas
Copy link

dnfclas commented Sep 6, 2017

@ashtonkj, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request.

Thanks, .NET Foundation Pull Request Bot

@jdom
Copy link
Member

jdom commented Sep 6, 2017

/cc @shayhatsor @veikkoeeva @halfnelson @rohail99 @dandago as you guys might help reviewing ang getting this in

Copy link
Contributor

@veikkoeeva veikkoeeva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor notes from me. The tests indeed should pass. @ashtonK, have you tried this in a "normal setup" besides tests? I'm off from my own computer now, but I wouldn't like to delay this a day (or two) just because of that.

@jdom Should the documentation be updated to indicate there is a provider for PostgreSQL too? The documentation is at http://dotnet.github.io/orleans/Documentation/Getting-Started-With-Orleans/Grain-Persistence.html.

@@ -859,3 +859,213 @@ VALUES
WHERE
ServiceId = @ServiceId AND @ServiceId IS NOT NULL;
');


CREATE TABLE storage
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the sake of consistency with other scripts, using a capital 's' would be nicer here. I.e. define as Storage,

THEN
_newGrainStateVersion := _GrainStateVersion + 1;
END IF;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe should avoid this many empty lines.

_PayloadXml,
(now() at time zone 'utc'),
1
WHERE NOT EXISTS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There could be a smarter way to do this in PostgreSQL, but maybe not an issue for this PR.

GET DIAGNOSTICS RowCountVar = ROW_COUNT;
IF RowCountVar > 0
THEN
_newGrainStateVersion := 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nit, but the identations seem to be off here. This is unfortunately something I've introduced myself too to other scripts, but if you feel like labouring over this, maybe something to notice.

(
'WriteToStorageKey','

select * from WriteToStorage(@GrainIdHash, @GrainIdN0, @GrainIdN1, @GrainTypeHash, @GrainTypeString, @GrainIdExtensionString, @ServiceId, @GrainStateVersion, @PayloadBinary, CAST(@PayloadJson AS jsonb), CAST(@PayloadXml AS xml));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the previous nit, see intendentations.

VALUES
(
'ReadFromStorageKey','

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty lines and intendation, see previous nits.

@ashtonkj
Copy link
Contributor Author

ashtonkj commented Sep 7, 2017

Thanks @veikkoeeva. I'll work on those this evening so that we can get it in at the right standard.

@ashtonkj
Copy link
Contributor Author

ashtonkj commented Sep 8, 2017

@veikkoeeva Looks like there are a mix of tabs and spaces throughout the file. Do you mind if I increase the surface area of this PR by replacing all tabs with spaces (only in this file) so that we can get more consistent indentation?

@jdom
Copy link
Member

jdom commented Sep 8, 2017

Absolutely, go for it

Fix capitilisation of Storage table (though this is just for script purposes, Postgres will automatically lower case this anyway).
@veikkoeeva
Copy link
Contributor

@ashtonkj I concur with @jdom, sounds great.

@ashtonkj
Copy link
Contributor Author

ashtonkj commented Sep 8, 2017

@veikkoeeva Changes made.

@veikkoeeva
Copy link
Contributor

This looks good to me. There could be room for improved performance in the future, but it's not a concern for this PR.

@jdom
Copy link
Member

jdom commented Sep 8, 2017

@dotnet-bot test this please

@jdom jdom merged commit 311c26e into dotnet:master Sep 8, 2017
@jdom
Copy link
Member

jdom commented Sep 8, 2017

Thanks @ashtonkj and @veikkoeeva !

@dandago
Copy link

dandago commented Sep 14, 2017

Seeing this only now (I've been travelling). So this adds support for PostgreSQL as a Storage Provider? Nice job! As @veikkoeeva suggested, we should probably update the docs once a release is shipped that includes this change. If you let me know when that happens, I could take care of it.

@ashtonkj
Copy link
Contributor Author

@dandago it is in the version that is currently on MyGet. Over time we will probably optimise it more for Postgres, but it is working well in my current scenario.

@dandago
Copy link

dandago commented Sep 17, 2017

@ashtonkj OK, by MyGet I presume you mean an internal feed, and that it is not yet available on public NuGet. It is best to only update the docs when it is out there for public consumption, otherwise people would get confused.

sergeybykov pushed a commit to sergeybykov/orleans that referenced this pull request Sep 29, 2017
* Fix Postgresql CreateOrleansTables script to work as storage provider.
* Add PostgreSqlStorageTests.
* Normalize white-space.
jdom pushed a commit that referenced this pull request Sep 29, 2017
* Fix Postgresql CreateOrleansTables script to work as storage provider.
* Add PostgreSqlStorageTests.
* Normalize white-space.
@github-actions github-actions bot locked and limited conversation to collaborators Dec 10, 2023
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.

None yet

5 participants