Report write errors when scrubbing

Summary: When we're scrubbing blobstores, it's not actually a success state if a scrub fails to write. Report this back to the caller - no-one will usually be scrubbing unless they expect repair writes to succeed, and a failure is a sign that we need to investigate further

Reviewed By: mitrandir77

Differential Revision: D23601541

fbshipit-source-id: d328935af9999c944719a6b863d0c86b28c54f59
This commit is contained in:
Simon Farnsworth 2020-09-10 02:26:49 -07:00 committed by Facebook GitHub Bot
parent c044f1669a
commit 89e30973ff

View File

@ -18,7 +18,7 @@ use cloned::cloned;
use context::CoreContext;
use futures::{
future::{BoxFuture, FutureExt},
stream::{FuturesUnordered, StreamExt},
stream::{FuturesUnordered, TryStreamExt},
};
use metaconfig_types::{BlobstoreId, MultiplexId, ScrubAction};
use mononoke_types::{BlobstoreBytes, DateTime};
@ -145,7 +145,7 @@ async fn put_and_mark_repaired(
key: &String,
value: &BlobstoreGetData,
scrub_handler: &dyn ScrubHandler,
) {
) -> Result<(), Error> {
let (_, res) = inner_put(
ctx,
scuba.clone(),
@ -157,6 +157,7 @@ async fn put_and_mark_repaired(
)
.await;
scrub_handler.on_repair(&ctx, id, &key, res.is_ok(), value.as_meta());
res
}
// Workaround for Blobstore returning a static lifetime future
@ -239,7 +240,7 @@ async fn blobstore_get(
})
.collect();
repair_puts.for_each(|_| async {}).await;
repair_puts.try_for_each(|_| async { Ok(()) }).await?;
}
Ok(Some(value))
}