tiberius icon indicating copy to clipboard operation
tiberius copied to clipboard

Add Support for MultiSubnetFailover when using a High Availability Group

Open pip8786 opened this issue 11 months ago • 6 comments

Currently Prisma doesn't support the MultiSubnetFailover option of SQL Server. See https://github.com/prisma/prisma/issues/9187. I think this would require support at the driver level so I'm adding an issue here.

Other info: https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/sql/sqlclient-support-for-high-availability-disaster-recovery

pip8786 avatar Apr 02 '24 18:04 pip8786

An example of implementation is here:

https://github.com/tediousjs/tedious/blob/a51e57dd20f7739e1b2cb21600ae56fe93a4ce96/src/connection.ts#L2067

connectInParallel

https://github.com/tediousjs/tedious/blob/a51e57dd20f7739e1b2cb21600ae56fe93a4ce96/src/connector.ts#L9

dariusj18 avatar Apr 18 '24 15:04 dariusj18

Thanks @dariusj18 . That seems relatively simple so maybe the maintainers could implement this pretty quickly in their rust code. I tried looking at the connection code and I'm definitely not qualified to try a PR in Rust.

pip8786 avatar Apr 18 '24 15:04 pip8786

I'd give it stab, but I am kinda worried that PRs won't be merged in. There hasn't been much activity and a few people that have commented say things like "I'm not the owner of this crate anymore"

So I don't know if anyone is really maintaining it.

dariusj18 avatar Apr 19 '24 00:04 dariusj18

Upon further further evaluation, the TcpStream connection is created in a few places

https://github.com/prisma/tiberius/blob/e74b5562ba66fd9f84e3a60492339beff2cd0a4b/src/sql_browser/async_std.rs#L16

https://github.com/prisma/tiberius/blob/e74b5562ba66fd9f84e3a60492339beff2cd0a4b/src/sql_browser/tokio.rs#L18

https://github.com/prisma/tiberius/blob/e74b5562ba66fd9f84e3a60492339beff2cd0a4b/src/sql_browser/smol.rs#L17

it seems that these exist for different library compatibilities.

dariusj18 avatar Apr 26 '24 17:04 dariusj18

So do you think we need to post an issue on prisma-engines as well or is this still the right place?

pip8786 avatar Apr 26 '24 17:04 pip8786

This is the right place.

dariusj18 avatar Apr 26 '24 18:04 dariusj18

I created a simple example PR https://github.com/prisma/tiberius/pull/357 with changes I assume would be needed. This is the first time I have touched rust, so I am not sure if it is correct. Also, if it is correct, the same changes would be needed to be made to tokio and smol implementations.

tylerclendenin avatar Sep 30 '24 15:09 tylerclendenin