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

Support Npgsql 6.0 for clustering and reminders #7402

Merged
merged 1 commit into from
Dec 1, 2021

Conversation

EdeMeijer
Copy link
Contributor

@EdeMeijer EdeMeijer commented Nov 22, 2021

Starting with Npgsql 6.0, date-time handling got more strict (https://www.npgsql.org/doc/types/datetime.html#timestamps-and-timezones). Using Npgsql 6.0 with Orleans broke some clustering queries, in particular when trying to mark previous versions of the same silo as dead when the previous version did not shutdown gracefully.

The issue is that when loading current cluster members, the DateTimes were loaded with type unspecified, because the table uses datetime without time zone. Then when reusing those date objects for update queries, Npgsql would not allow this anymore.

My solution is to follow the general advice for Postgres to always use timestamp with time zone (timestamptz) for storing date-times. By doing so, the membership DateTime gets loaded with type utc, and everything keeps working.

For consistency I also updated the date columns for reminders, and verified everything still works.

Microsoft Reviewers: Open in CodeFlow

@ReubenBond
Copy link
Member

LGTM. Thank you, @EdeMeijer!

@ReubenBond ReubenBond merged commit a9bf72a into dotnet:3.x Dec 1, 2021
@EdeMeijer
Copy link
Contributor Author

I forgot to mention, I only tested this with a Cockroach DB backend, not actual postgres. I'm 99,99% sure it will be all the same though.

@ReubenBond ReubenBond added the Needs: backport PRs which should be backported to a (prior) release branch label Jan 6, 2022
@ReubenBond ReubenBond self-assigned this Jan 6, 2022
@ReubenBond ReubenBond added this to the 3.6.0 milestone Jan 6, 2022
EdeMeijer added a commit to EdeMeijer/orleans that referenced this pull request Jan 12, 2022
The changes in dotnet#7402 are fine for new deployments, but existing deployments need a way to migrate tables and routines in order to apply the same changes.

Users can run the SQL in the 3 migration files when upgrading to 3.5.2.
ReubenBond added a commit that referenced this pull request Jan 12, 2022
* Create PostgreSQL migrations for version 3.6.0

The changes in #7402 are fine for new deployments, but existing deployments need a way to migrate tables and routines in order to apply the same changes.

Users can run the SQL in the 3 migration files when upgrading to 3.6.0

Co-authored-by: Reuben Bond <203839+ReubenBond@users.noreply.github.com>
ReubenBond added a commit to ReubenBond/orleans that referenced this pull request Jan 12, 2022
* Create PostgreSQL migrations for version 3.6.0

The changes in dotnet#7402 are fine for new deployments, but existing deployments need a way to migrate tables and routines in order to apply the same changes.

Users can run the SQL in the 3 migration files when upgrading to 3.6.0

Co-authored-by: Reuben Bond <203839+ReubenBond@users.noreply.github.com>
ReubenBond added a commit that referenced this pull request Jan 12, 2022
* Create PostgreSQL migrations for version 3.6.0

The changes in #7402 are fine for new deployments, but existing deployments need a way to migrate tables and routines in order to apply the same changes.

Users can run the SQL in the 3 migration files when upgrading to 3.6.0

Co-authored-by: Reuben Bond <203839+ReubenBond@users.noreply.github.com>

Co-authored-by: Ede Meijer <ede@elastict.nl>
@github-actions github-actions bot locked and limited conversation to collaborators Dec 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs: backport PRs which should be backported to a (prior) release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants