Skip to content

Support Npgsql 6.0 for clustering and reminders - #7402

Merged
ReubenBond merged 1 commit into
dotnet:3.xfrom
EdeMeijer:npgsql-6.0-support
Dec 1, 2021
Merged

ReubenBond merged 1 commit into
dotnet:3.xfrom
EdeMeijer:npgsql-6.0-support

Conversation

@EdeMeijer

@EdeMeijer EdeMeijer commented Nov 22, 2021 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Member

LGTM. Thank you, @EdeMeijer!

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

Copy link
Copy Markdown
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
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.

2 participants