Log storage sync and etcd events a bit better

This commit is contained in:
Kirill Bulatov
2022-06-02 12:31:04 +03:00
committed by Kirill Bulatov
parent 90e2c9ee1f
commit b0c4ec0594
3 changed files with 14 additions and 8 deletions

View File

@@ -258,7 +258,7 @@ pub async fn subscribe_to_safekeeper_timeline_updates(
}
}
}
Ok(None) => {}
Ok(None) => warn!("Ignoring etcd KV with unexpected key {:?} that does not match required regex {}", new_etcd_kv.key_str(), regex),
Err(e) => error!("Failed to parse timeline update: {e}"),
};
}
@@ -272,7 +272,7 @@ pub async fn subscribe_to_safekeeper_timeline_updates(
}
Ok(())
});
}.instrument(info_span!("etcd_broker")));
Ok(SkTimelineSubscription {
kind: subscription,

View File

@@ -892,7 +892,7 @@ fn storage_sync_loop<P, S>(
REMAINING_SYNC_ITEMS.set(remaining_queue_length as i64);
if remaining_queue_length > 0 || !batched_tasks.is_empty() {
info!("Processing tasks for {} timelines in batch, more tasks left to process: {remaining_queue_length}", batched_tasks.len());
debug!("Processing tasks for {} timelines in batch, more tasks left to process: {remaining_queue_length}", batched_tasks.len());
} else {
debug!("No tasks to process");
continue;
@@ -1186,7 +1186,7 @@ async fn update_local_metadata(
let remote_metadata = match remote_timeline {
Some(timeline) => &timeline.metadata,
None => {
info!("No remote timeline to update local metadata from, skipping the update");
debug!("No remote timeline to update local metadata from, skipping the update");
return Ok(());
}
};

View File

@@ -468,11 +468,17 @@ async fn timeline_wal_broker_loop_step(
// finally, if no other tasks are completed, get another broker update and possibly reconnect
updates = broker_subscription.fetch_data() => match updates {
Some(mut all_timeline_updates) => {
if let Some(subscribed_timeline_updates) = all_timeline_updates.remove(&id) {
if let Some(candidate) = wal_connection_manager.select_connection_candidate(subscribed_timeline_updates) {
info!("Switching to different safekeeper {} for timeline {id}, reason: {:?}", candidate.safekeeper_id, candidate.reason);
wal_connection_manager.change_connection(candidate.safekeeper_id, candidate.wal_producer_connstr).await;
match all_timeline_updates.remove(&id) {
Some(subscribed_timeline_updates) => {
match wal_connection_manager.select_connection_candidate(subscribed_timeline_updates) {
Some(candidate) => {
info!("Switching to different safekeeper {} for timeline {id}, reason: {:?}", candidate.safekeeper_id, candidate.reason);
wal_connection_manager.change_connection(candidate.safekeeper_id, candidate.wal_producer_connstr).await;
},
None => debug!("No connection candidate was selected for timeline"),
}
}
None => warn!("Timeline has an active broker subscription, but got no updates. Other data length: {}", all_timeline_updates.len()),
}
},
None => {