Skip to content

Commit f92aaec

Browse files
committed
update opensrv for fix issue 4430
Signed-off-by: Ye Sijun <junnplus@gmail.com>
1 parent 353a69e commit f92aaec

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

query/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ common-tracing = { path = "../common/tracing" }
5454
bincode = { git = "https://github.com/datafuse-extras/bincode", rev = "fd3f9ff" }
5555
cargo-license = { git = "https://github.com/datafuse-extras/cargo-license", rev = "f1ce4a2" }
5656
opensrv-clickhouse = { git = "https://github.com/datafuselabs/opensrv", rev = "9690be9", package = "opensrv-clickhouse" }
57-
opensrv-mysql = { git = "https://github.com/datafuselabs/opensrv", rev = "9690be9", package = "opensrv-mysql" }
57+
opensrv-mysql = { git = "https://github.com/datafuselabs/opensrv", rev = "e744427", package = "opensrv-mysql" }
5858
sqlparser = { git = "https://github.com/datafuse-extras/sqlparser-rs", rev = "da3b180" }
5959

6060
# Crates.io dependencies

query/src/servers/mysql/mysql_interactive_worker.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,9 @@ impl<W: std::io::Write> InteractiveWorkerBase<W> {
361361
}
362362

363363
async fn do_init(&mut self, database_name: &str) -> Result<()> {
364+
if database_name.is_empty() {
365+
return Ok(());
366+
}
364367
let init_query = format!("USE `{}`;", database_name);
365368

366369
let do_query = self.do_query(&init_query).await;

query/src/sessions/session_ctx.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,11 @@ impl SessionContext {
9191
pub fn get_current_tenant(&self) -> String {
9292
if self.conf.query.management_mode {
9393
let lock = self.current_tenant.read();
94-
lock.clone()
95-
} else {
96-
self.conf.query.tenant_id.clone()
94+
if !lock.is_empty() {
95+
return lock.clone();
96+
}
9797
}
98+
self.conf.query.tenant_id.clone()
9899
}
99100

100101
// Get current user

query/tests/it/sessions/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ async fn test_session_in_management_mode() -> Result<()> {
8181
// Tenant.
8282
{
8383
let actual = session.get_current_tenant();
84-
assert_eq!(&actual, "");
84+
assert_eq!(&actual, "test");
8585

8686
session.set_current_tenant("tenant2".to_string());
8787
let actual = session.get_current_tenant();

0 commit comments

Comments
 (0)