fix: correctly detach spawned mysql listener task (#657)

Co-authored-by: luofucong <luofucong@greptime.com>
This commit is contained in:
LFC
2022-11-29 18:39:18 +08:00
committed by GitHub
parent 75dcf2467b
commit 020b9936cd
2 changed files with 5 additions and 12 deletions

View File

@@ -82,20 +82,14 @@ impl MysqlServer {
let (r, w) = stream.into_split();
let w = BufWriter::with_capacity(DEFAULT_RESULT_SET_WRITE_BUFFER_SIZE, w);
// TODO(LFC): Use `output_stream` to write large MySQL ResultSet to client.
let spawn_result = io_runtime
.spawn(AsyncMysqlIntermediary::run_on(shim, r, w))
.await;
match spawn_result {
Ok(run_result) => {
if let Err(e) = run_result {
// TODO(LFC): Write this error and the below one to client as well, in MySQL text protocol.
io_runtime.spawn(async move {
// TODO(LFC): Use `output_stream` to write large MySQL ResultSet to client.
if let Err(e) = AsyncMysqlIntermediary::run_on(shim, r, w).await {
// TODO(LFC): Write this error to client as well, in MySQL text protocol.
// Looks like we have to expose opensrv-mysql's `PacketWriter`?
error!(e; "Internal error occurred during query exec, server actively close the channel to let client try next time.")
}
}
Err(e) => error!("IO runtime cannot execute task, error: {}", e),
}
});
Ok(())
}
}

View File

@@ -184,7 +184,6 @@ async fn test_query_concurrently() -> Result<()> {
let should_recreate_conn = expected == 1;
if should_recreate_conn {
connection.disconnect().await.unwrap();
connection = create_connection(server_port, index % 2 == 0)
.await
.unwrap();