mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-14 17:02:56 +00:00
wip: more logging
This commit is contained in:
@@ -172,7 +172,7 @@ enum TaskStateUpdate<E> {
|
||||
Progress(E),
|
||||
}
|
||||
|
||||
impl<E: Clone> TaskHandle<E> {
|
||||
impl<E: Clone + std::fmt::Debug> TaskHandle<E> {
|
||||
/// Initializes the task, starting it immediately after the creation.
|
||||
///
|
||||
/// The second argument to `task` is a child token of `cancel_parent` ([`CancellationToken::child_token`]).
|
||||
@@ -244,10 +244,30 @@ impl<E: Clone> TaskHandle<E> {
|
||||
}
|
||||
|
||||
/// Aborts current task, waiting for it to finish.
|
||||
async fn shutdown(self) {
|
||||
if let Some(jh) = self.join_handle {
|
||||
async fn shutdown(mut self) {
|
||||
if let Some(mut jh) = self.join_handle {
|
||||
self.cancellation.cancel();
|
||||
match jh.await {
|
||||
|
||||
let res = loop {
|
||||
tokio::select! {
|
||||
res = &mut jh => {
|
||||
break res;
|
||||
},
|
||||
received = self.events_receiver.changed() => {
|
||||
match received {
|
||||
Ok(()) => {
|
||||
let event = self.events_receiver.borrow();
|
||||
tracing::info!("Received update after cancellation: {event:?}");
|
||||
},
|
||||
Err(err) => {
|
||||
tracing::info!("Sender dropped after cancellation: {err}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
match res {
|
||||
Ok(Ok(())) => debug!("Shutdown success"),
|
||||
Ok(Err(e)) => error!("Shutdown task error: {e:?}"),
|
||||
Err(je) if je.is_cancelled() => unreachable!("not used"),
|
||||
|
||||
@@ -307,6 +307,19 @@ pub(super) async fn handle_walreceiver_connection(
|
||||
} {
|
||||
let replication_message = replication_message?;
|
||||
|
||||
match &replication_message {
|
||||
ReplicationMessage::XLogData(_) => {
|
||||
tracing::info!("Received XLogData replication message")
|
||||
}
|
||||
ReplicationMessage::PrimaryKeepAlive(_) => {
|
||||
tracing::info!("Received PrimaryKeepAlive replication message")
|
||||
}
|
||||
ReplicationMessage::RawInterpretedWalRecords(_) => {
|
||||
tracing::info!("Received RawInterpretedWalRecords replication message")
|
||||
}
|
||||
unknown => tracing::info!("Received unknown replication message: {unknown:?}"),
|
||||
}
|
||||
|
||||
let now = Utc::now().naive_utc();
|
||||
let last_rec_lsn_before_msg = last_rec_lsn;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user