page server: Name the threads for debugging.

This commit is contained in:
Heikki Linnakangas
2021-03-22 13:18:48 +02:00
committed by Stas Kelvich
parent 375f8e3134
commit 22a0da114f

View File

@@ -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.