Skip to content

Commit

Permalink
Optionally handle "repo not found" megarepo errors by panicing
Browse files Browse the repository at this point in the history
Summary:
## This stack

S460221 followups to fix bugs around sharding as well as general brittleness.

## This diff

We've had multiple SEVs where we reported "repo not found 2135" to grepo sync after releasing changes. Panicking helps by causing Conveyor to revert immediately. These errors are retried by the client, meaning a rollback would stay below the SEV threshold.

Reviewed By: mzr

Differential Revision: D64702687

fbshipit-source-id: 247fd12f9c8cdaea1c6737c35248d8ffadfb2440
  • Loading branch information
andreacampi authored and facebook-github-bot committed Oct 23, 2024
1 parent 0788e00 commit 406e3f8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion eden/mononoke/megarepo_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,20 @@ impl<R: MononokeRepo> MegarepoApi<R> {
.repo_by_id(ctx.clone(), repo_id)
.await
.map_err(MegarepoError::internal)?
.ok_or_else(|| MegarepoError::request(anyhow!("repo not found {}", repo_id)))?
.ok_or_else(|| {
if repo_id.id() != 0 // special case for some tests
&& justknobs::eval(
"scm/mononoke:megarepo_panic_on_repo_not_found_error",
None,
Some(&repo_id.to_string()),
)
.unwrap_or(false)
{
panic!("repo not found {}", repo_id)
} else {
MegarepoError::request(anyhow!("repo not found {}", repo_id))
}
})?
.with_authorization_context(AuthorizationContext::new_bypass_access_control())
.build()
.await?;
Expand Down

0 comments on commit 406e3f8

Please sign in to comment.