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

Send ReadOnlyIntent when ApplicationIntent=ReadOnly specified #297

Merged
merged 1 commit into from
Jun 2, 2023

Conversation

suzak
Copy link
Contributor

@suzak suzak commented May 29, 2023

In our production environment, we use Always On availability groups and availability group listeners. However, tiberius does not support connecting to readonly replicas, preventing us from utilizing readonly replicas.

To connect to readonly replica via availability group listener, we should specify ApplicaitonIntent=ReadOnly in connection string1. It sets TypeFlags' fReadOnlyIntent bit2.

This PR makes tiberius to support ApplicationIntent=ReadOnly.

Footnotes

  1. https://learn.microsoft.com/en-us/sql/database-engine/availability-groups/windows/configure-read-only-routing-for-an-availability-group-sql-server?view=sql-server-2017

  2. https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-tds/773a62b6-ee89-4c02-9e5e-344882630aac

Copy link
Contributor

@tomhoule tomhoule left a comment

Choose a reason for hiding this comment

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

lgtm! Thank you for the PR.

@tomhoule tomhoule merged commit 98943b2 into prisma:main Jun 2, 2023
31 checks passed
@myoder020
Copy link

how does prisma create a connection using tiberius? I'm connecting to an availability group that has read only routing setup and I can connect to it using SSMS but applying the same connection string to prisma is connecting to the primary instead of the secondary replica.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants