read-only intent with SQL Server availability group
Joshua Lang <[email protected]> Wed, 15 Nov 2017 18:28:49 -0800
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <CAFTwDJS4raYDhrNjFhfVE_NZhMsA185WT6+JsXQFvPe8KpbtYg@mail.gmail.com> |
When attempting to connect to SQL Server 2016 availability group listener, I'm seeing a "Unexpected EOF from the server" error if read-only intent is specified (this can be done via the freetds.conf file, for example). This is using the latest dev1.00.308 code and an availability group with a single secondary replica. The failure seems to come from the listener closing the connection after sending an ENVCHANGE routing message (type 20) message to the client. See https://msdn.microsoft.com/en-us/library/dd303449.aspx From my reading of the TDS protocol specification, it seems as though a TDS 7.1 client and later should handle the ENVCHANGE routing message and reconnect to the host specified in the routing message when the read-only intent flag is set. Isn't the whole point of the read-only intent flag so that clients can be routed to read-only replicas when possible? Note that FreeTDS does connect successfully to the secondary (read-only) replica, and writes to it fail as one would expect.