mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-04 12:02:55 +00:00
another fix
This commit is contained in:
@@ -4674,6 +4674,7 @@ impl Timeline {
|
||||
};
|
||||
|
||||
info!("started flush loop");
|
||||
|
||||
loop {
|
||||
tokio::select! {
|
||||
_ = self.cancel.cancelled() => {
|
||||
@@ -4688,13 +4689,12 @@ impl Timeline {
|
||||
// The highest LSN to which we flushed in the loop over frozen layers
|
||||
let mut flushed_to_lsn = Lsn(0);
|
||||
|
||||
let result = loop {
|
||||
// Force not bailing early by wrapping the code into a closure.
|
||||
#[allow(clippy::redundant_closure_call)]
|
||||
let result = (async || { loop {
|
||||
if self.cancel.is_cancelled() {
|
||||
info!("dropping out of flush loop for timeline shutdown");
|
||||
// Note: we do not bother transmitting into [`layer_flush_done_tx`], because
|
||||
// anyone waiting on that will respect self.cancel as well: they will stop
|
||||
// waiting at the same time we as drop out of this loop.
|
||||
return;
|
||||
break Err(FlushLayerError::Cancelled);
|
||||
}
|
||||
|
||||
// Break to notify potential waiters as soon as we've flushed the requested LSN. If
|
||||
@@ -4707,16 +4707,8 @@ impl Timeline {
|
||||
let (layer, l0_count, frozen_count, frozen_size) = {
|
||||
let layers = self.layers.read(LayerManagerLockHolder::FlushLoop).await;
|
||||
let Ok(lm) = layers.layer_map() else {
|
||||
if self.cancel.is_cancelled() {
|
||||
info!("dropping out of flush loop for timeline shutdown");
|
||||
} else {
|
||||
info!("dropping out of flush loop for layer map shutdown");
|
||||
let _ = self
|
||||
.layer_flush_done_tx
|
||||
.send_replace((flush_counter, Err(FlushLayerError::Cancelled)));
|
||||
}
|
||||
|
||||
return;
|
||||
info!("dropping out of flush loop for layer map shutdown");
|
||||
break Err(FlushLayerError::Cancelled);
|
||||
};
|
||||
let l0_count = lm.level0_deltas().len();
|
||||
let frozen_count = lm.frozen_layers.len();
|
||||
@@ -4764,16 +4756,8 @@ impl Timeline {
|
||||
match self.flush_frozen_layer(layer, ctx).await {
|
||||
Ok(layer_lsn) => flushed_to_lsn = max(flushed_to_lsn, layer_lsn),
|
||||
Err(FlushLayerError::Cancelled) => {
|
||||
if self.cancel.is_cancelled() {
|
||||
info!("dropping out of flush loop for timeline shutdown");
|
||||
} else {
|
||||
info!("dropping out of flush loop for remote client shutdown");
|
||||
let _ = self
|
||||
.layer_flush_done_tx
|
||||
.send_replace((flush_counter, Err(FlushLayerError::Cancelled)));
|
||||
}
|
||||
|
||||
return;
|
||||
info!("dropping out of flush loop for remote client shutdown");
|
||||
break Err(FlushLayerError::Cancelled);
|
||||
}
|
||||
err @ Err(
|
||||
FlushLayerError::NotRunning(_)
|
||||
@@ -4814,7 +4798,7 @@ impl Timeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}})().await;
|
||||
|
||||
// Unsharded tenants should never advance their LSN beyond the end of the
|
||||
// highest layer they write: such gaps between layer data and the frozen LSN
|
||||
|
||||
Reference in New Issue
Block a user