Skip to content

Commit 35d04ac

Browse files
mysql-srv: Add CONNECT_WITH_DB capability
If the client replies to an initial handshake packet with CapabilityFlags::CLIENT_CONNECT_WITH_DB set, RS attempts to parse the database. This client flag is set if the client wants to connect to a specific database after the initial handshake. In order for this functionality to work, the server must also support the capability and send it as part of the initial handshake packet. We are currently not sending the CONNECT_WITH_DB capability in the initial handshake packet and attempting to parse the database name if the client sends the capability. This is causing the handshake to parse the next field in the handshake packet as the database name. Fixes: REA-4290 Close #714, close #1186 Release-Note-Core: Add the capability to connect to a specific MySQL database as part of the connection. Change-Id: Ic9c511a3776f0c45bb04f0f2953f188cfa64ac65 Reviewed-on: https://gerrit.readyset.name/c/readyset/+/7179 Tested-by: Buildkite CI Reviewed-by: Luke Osborne <luke@readyset.io>
1 parent cbd449e commit 35d04ac

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mysql-srv/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ use std::io;
172172
use std::sync::Arc;
173173

174174
use async_trait::async_trait;
175-
use constants::{CLIENT_PLUGIN_AUTH, PROTOCOL_41, RESERVED, SECURE_CONNECTION};
175+
use constants::{CLIENT_PLUGIN_AUTH, CONNECT_WITH_DB, PROTOCOL_41, RESERVED, SECURE_CONNECTION};
176176
use error::{other_error, OtherErrorKind};
177177
use mysql_common::constants::CapabilityFlags;
178178
use readyset_adapter_types::{DeallocateId, ParsedCommand};
@@ -388,7 +388,8 @@ struct StatementData {
388388
params: u16,
389389
}
390390

391-
const CAPABILITIES: u32 = PROTOCOL_41 | SECURE_CONNECTION | RESERVED | CLIENT_PLUGIN_AUTH;
391+
const CAPABILITIES: u32 =
392+
PROTOCOL_41 | SECURE_CONNECTION | RESERVED | CLIENT_PLUGIN_AUTH | CONNECT_WITH_DB;
392393

393394
impl<B: MySqlShim<W> + Send, R: AsyncRead + Unpin, W: AsyncWrite + Unpin + Send>
394395
MySqlIntermediary<B, R, W>

0 commit comments

Comments
 (0)