prisma / tiberius

TDS 7.2+ (Microsoft SQL Server) driver for Rust
Apache License 2.0
311 stars 113 forks source link

Send ReadOnlyIntent when ApplicationIntent=ReadOnly specified #297

Closed suzak closed 1 year ago

suzak commented 1 year ago

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 string^1. It sets TypeFlags' fReadOnlyIntent bit^2.

This PR makes tiberius to support ApplicationIntent=ReadOnly.

myoder020 commented 4 months ago

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.

dpoupon-pla commented 1 week ago

We have the same issue than @myoder020. in our case, Prisma is still connecting to the primary instead of the read-only replica.