Skip to content

Support SQL Server Availability Groups #183

@rossipedia

Description

@rossipedia

At Stack Exchange we need to support SQL Server AlwaysOn Availability Groups, and bringing this support to Tedious would make it a much more viable solution for those in similar situations. There's definitely quite a few parts to getting the full feature-set implemented, so I'd like to keep this PR open as kind of a running discussion/integration during the implementation process.

The first set of changes involves the fReadOnlyIntent bit. I found that Tedious had the wrong bits set for the various TypeFlags. Fixing that allowed setting the fReadOnlyIntent bit and getting the proper ENVCHANGE token (type 20) back from SQL Server after logging in. After that it was a matter of fixing up the state machine to properly transition and reconnect to the server/port indicated in the ENVCHANGE token.

Hopefully (meaning I haven't tested this yet), this will have the added benefit of gracefully handling a manual fail-over as well.

The next step is to handle the situation where a DNS lookup for the SQL Server host name returns multiple IP addresses, which should be attempted in order until a connection is made. I'm pretty sure I'll be able to re-use the REROUTING state for that. We're going to use Microsoft's native driver as the reference implementation for how connection attempts should be performed. See SQL Server Native Client Support for High Availability, Disaster Recovery.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions