tenant shutdown: add some debug logging

This proved useful while debugging

https://github.com/neondatabase/neon/pull/4451#issuecomment-1584503248

resulting in

d4a86a415b
This commit is contained in:
Christian Schwarz
2023-06-09 16:45:18 +02:00
parent 88baa4fff7
commit b6cb362f11
2 changed files with 7 additions and 1 deletions

View File

@@ -1926,6 +1926,8 @@ impl Tenant {
/// This will attempt to shutdown even if tenant is broken.
pub(crate) async fn shutdown(&self, freeze_and_flush: bool) -> Result<(), ShutdownError> {
debug_assert_current_span_has_tenant_id();
debug!("start");
// Set tenant (and its timlines) to Stoppping state.
//
// Since we can only transition into Stopping state after activation is complete,
@@ -1972,6 +1974,7 @@ impl Tenant {
// this will additionally shutdown and await all timeline tasks.
task_mgr::shutdown_tasks(None, Some(self.tenant_id), None).await;
debug!("complete");
Ok(())
}

View File

@@ -684,8 +684,11 @@ impl Timeline {
/// Flush to disk all data that was written with the put_* functions
#[instrument(skip(self), fields(tenant_id=%self.tenant_id, timeline_id=%self.timeline_id))]
pub async fn freeze_and_flush(&self) -> anyhow::Result<()> {
debug!("start");
self.freeze_inmem_layer(false);
self.flush_frozen_layers_and_wait().await
let ret = self.flush_frozen_layers_and_wait().await;
debug!(is_err = ret.is_err(), "complete");
ret
}
/// Outermost timeline compaction operation; downloads needed layers.