review adjustments

This commit is contained in:
Dmitry Rodionov
2022-11-03 15:39:15 +02:00
committed by Dmitry Rodionov
parent 15d970f731
commit 99e745a760
2 changed files with 10 additions and 2 deletions

View File

@@ -1364,6 +1364,11 @@ impl Timeline {
// to finish, we know when the flush that we initiated has
// finished, instead of some other flush that was started earlier.
let mut my_flush_request = 0;
if !&*self.flush_loop_started.lock().unwrap() {
anyhow::bail!("cannot flush frozen layers when flush_loop is not running")
}
self.layer_flush_start_tx.send_modify(|counter| {
my_flush_request = *counter + 1;
*counter = my_flush_request;
@@ -1377,7 +1382,10 @@ impl Timeline {
// We already logged the original error in
// flush_loop. We cannot propagate it to the caller
// here, because it might not be Cloneable
bail!("could not flush frozen layer");
anyhow::bail!(
"Could not flush frozen layer. Request id: {}",
my_flush_request
);
} else {
return Ok(());
}

View File

@@ -120,7 +120,7 @@ fn can_apply_in_neon(rec: &NeonWalRecord) -> bool {
/// An error happened in WAL redo
#[derive(Debug, thiserror::Error)]
pub enum WalRedoError {
#[error("encountered io error: {0}")]
#[error(transparent)]
IoError(#[from] std::io::Error),
#[error("cannot perform WAL redo now")]