Skip to content

Commit a139283

Browse files
authored
chore: add info in log for sticky node not found. (#18549)
1 parent f7efc2c commit a139283

File tree

1 file changed

+10
-3
lines changed
  • src/query/service/src/servers/http/middleware

1 file changed

+10
-3
lines changed

src/query/service/src/servers/http/middleware/session.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,11 @@ pub async fn forward_request_with_body<T: Into<reqwest::Body>>(
560560
Ok(poem_resp)
561561
}
562562

563+
fn get_request_info(mut req: Request) -> String {
564+
req.headers_mut().remove(AUTHORIZATION);
565+
format!("{req:?}")
566+
}
567+
563568
impl<E: Endpoint> Endpoint for HTTPSessionEndpoint<E> {
564569
type Output = Response;
565570

@@ -593,8 +598,10 @@ impl<E: Endpoint> Endpoint for HTTPSessionEndpoint<E> {
593598
);
594599
forward_request(req, node).await
595600
} else {
596-
let msg =
597-
format!("session lost due to server restart or shutdown: node '{sticky_node_id}' not found in cluster",);
601+
let msg = format!(
602+
"Sticky session state lost: node '{sticky_node_id}' not found in cluster, request={}",
603+
get_request_info(req)
604+
);
598605
warn!("[HTTP-SESSION] {}", msg);
599606
Err(Error::from(HttpErrorCode::bad_request(
600607
ErrorCode::BadArguments(msg),
@@ -627,7 +634,7 @@ impl<E: Endpoint> Endpoint for HTTPSessionEndpoint<E> {
627634
.into());
628635
}
629636
Ok(None) => {
630-
let msg = format!("Not find the '{}' warehouse; it is possible that all nodes of the warehouse have gone offline. Please exit the client and reconnect, or use `use warehouse <new_warehouse>`", warehouse);
637+
let msg = format!("Not find the '{}' warehouse; it is possible that all nodes of the warehouse have gone offline. Please exit the client and reconnect, or use `use warehouse <new_warehouse>`. request = {}.", warehouse, get_request_info(req));
631638
warn!("[HTTP-SESSION] {}", msg);
632639
return Err(Error::from(HttpErrorCode::bad_request(
633640
ErrorCode::UnknownWarehouse(msg),

0 commit comments

Comments
 (0)