mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-17 10:22:56 +00:00
This introduces a new module to handle thread creation and shutdown. All page server threads are now registered in a global hash map, and there's a function to request individual threads to shut down gracefully. Thread shutdown request is signalled to the thread with a flag, as well as a Future that can be used to wake up async operations if shutdown is requested. Use that facility to have the libpq listener thread respond to pageserver shutdown, based on Kirill's earlier prototype (https://github.com/zenithdb/zenith/pull/1088). That addresses https://github.com/zenithdb/zenith/issues/1036, previously the libpq listener thread would not exit until one more connection arrives. This also eliminates a resource leak in the accept() loop. Previously, we added the JoinHanlde of each new thread to a vector but old handles for threads that had already exited were never removed.
46 lines
1.1 KiB
Rust
46 lines
1.1 KiB
Rust
pub mod basebackup;
|
|
pub mod branches;
|
|
pub mod config;
|
|
pub mod http;
|
|
pub mod import_datadir;
|
|
pub mod layered_repository;
|
|
pub mod page_cache;
|
|
pub mod page_service;
|
|
pub mod relish;
|
|
pub mod remote_storage;
|
|
pub mod repository;
|
|
pub mod tenant_mgr;
|
|
pub mod tenant_threads;
|
|
pub mod thread_mgr;
|
|
pub mod virtual_file;
|
|
pub mod walingest;
|
|
pub mod walreceiver;
|
|
pub mod walrecord;
|
|
pub mod walredo;
|
|
|
|
use lazy_static::lazy_static;
|
|
use zenith_metrics::{register_int_gauge_vec, IntGaugeVec};
|
|
use zenith_utils::zid::{ZTenantId, ZTimelineId};
|
|
|
|
lazy_static! {
|
|
static ref LIVE_CONNECTIONS_COUNT: IntGaugeVec = register_int_gauge_vec!(
|
|
"pageserver_live_connections_count",
|
|
"Number of live network connections",
|
|
&["pageserver_connection_kind"]
|
|
)
|
|
.expect("failed to define a metric");
|
|
}
|
|
|
|
pub const LOG_FILE_NAME: &str = "pageserver.log";
|
|
|
|
/// Config for the Repository checkpointer
|
|
#[derive(Debug, Clone, Copy)]
|
|
pub enum CheckpointConfig {
|
|
// Flush in-memory data that is older than this
|
|
Distance(u64),
|
|
// Flush all in-memory data
|
|
Flush,
|
|
// Flush all in-memory data and reconstruct all page images
|
|
Forced,
|
|
}
|