From 22a0da114ff8705c9b65bffafcdcac477b7da705 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Mon, 22 Mar 2021 13:18:48 +0200 Subject: [PATCH] page server: Name the threads for debugging. --- src/bin/pageserver.rs | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/bin/pageserver.rs b/src/bin/pageserver.rs index 15e5af1236..74a038292d 100644 --- a/src/bin/pageserver.rs +++ b/src/bin/pageserver.rs @@ -8,6 +8,7 @@ use log::*; use pageserver::page_service; use pageserver::restore_s3; use pageserver::walreceiver; +use pageserver::walredo; use std::io::Error; @@ -22,9 +23,11 @@ fn main() -> Result<(), Error> { info!("starting..."); // Initialize the WAL applicator - let walredo_thread = thread::spawn(|| { - walredo::wal_applicator_main(); - }); + let walredo_thread = thread::Builder::new() + .name("WAL redo thread".into()).spawn( + || { + walredo::wal_applicator_main(); + }).unwrap(); threads.push(walredo_thread); // Before opening up for connections, restore the latest base backup from S3. @@ -35,18 +38,22 @@ fn main() -> Result<(), Error> { // Launch the WAL receiver thread. It will try to connect to the WAL safekeeper, // and stream the WAL. If the connection is lost, it will reconnect on its own. // We just fire and forget it here. - let walreceiver_thread = thread::spawn(|| { - // thread code - walreceiver::thread_main(); - }); + let walreceiver_thread = thread::Builder::new() + .name("WAL receiver thread".into()).spawn( + || { + // thread code + walreceiver::thread_main(); + }).unwrap(); threads.push(walreceiver_thread); // GetPage@LSN requests are served by another thread. (It uses async I/O, // but the code in page_service sets up it own thread pool for that) - let page_server_thread = thread::spawn(|| { - // thread code - page_service::thread_main(); - }); + let page_server_thread = thread::Builder::new() + .name("Page Service thread".into()).spawn( + || { + // thread code + page_service::thread_main(); + }).unwrap(); threads.push(page_server_thread); // never returns.