Skip to content

Commit

Permalink
[Backport release-labrador] Clean up some noisy logging (#2460)
Browse files Browse the repository at this point in the history
Clean up some noisy logging (#2459)

Don't log warning when a requested object is simply not found

(cherry picked from commit 9e69a39)

Co-authored-by: Jeb Bearer <[email protected]>
  • Loading branch information
github-actions[bot] and jbearer authored Jan 16, 2025
1 parent 2bb102e commit 44017e4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 21 additions & 13 deletions sequencer/src/persistence/sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1362,10 +1362,11 @@ impl Provider<SeqTypes, VidCommonRequest> for Persistence {
"SELECT data FROM vid_share WHERE payload_hash = $1 LIMIT 1",
)
.bind(req.0.to_string())
.fetch_one(tx.as_mut())
.fetch_optional(tx.as_mut())
.await
{
Ok((bytes,)) => bytes,
Ok(Some((bytes,))) => bytes,
Ok(None) => return None,
Err(err) => {
tracing::warn!("error loading VID share: {err:#}");
return None;
Expand Down Expand Up @@ -1401,10 +1402,11 @@ impl Provider<SeqTypes, PayloadRequest> for Persistence {
"SELECT data FROM da_proposal WHERE payload_hash = $1 LIMIT 1",
)
.bind(req.0.to_string())
.fetch_one(tx.as_mut())
.fetch_optional(tx.as_mut())
.await
{
Ok((bytes,)) => bytes,
Ok(Some((bytes,))) => bytes,
Ok(None) => return None,
Err(err) => {
tracing::warn!("error loading DA proposal: {err:#}");
return None;
Expand Down Expand Up @@ -1440,7 +1442,7 @@ impl Provider<SeqTypes, LeafRequest<SeqTypes>> for Persistence {
};

let (leaf, qc) = match fetch_leaf_from_proposals(&mut tx, req).await {
Ok(res) => res,
Ok(res) => res?,
Err(err) => {
tracing::info!("requested leaf not found in undecided proposals: {err:#}");
return None;
Expand All @@ -1460,30 +1462,36 @@ impl Provider<SeqTypes, LeafRequest<SeqTypes>> for Persistence {
async fn fetch_leaf_from_proposals<Mode: TransactionMode>(
tx: &mut Transaction<Mode>,
req: LeafRequest<SeqTypes>,
) -> anyhow::Result<(Leaf, QuorumCertificate<SeqTypes>)> {
) -> anyhow::Result<Option<(Leaf, QuorumCertificate<SeqTypes>)>> {
// Look for a quorum proposal corresponding to this leaf.
let (proposal_bytes,) =
let Some((proposal_bytes,)) =
query_as::<(Vec<u8>,)>("SELECT data FROM quorum_proposals WHERE leaf_hash = $1 LIMIT 1")
.bind(req.expected_leaf.to_string())
.fetch_one(tx.as_mut())
.fetch_optional(tx.as_mut())
.await
.context("fetching proposal")?;
.context("fetching proposal")?
else {
return Ok(None);
};

// Look for a QC corresponding to this leaf.
let (qc_bytes,) =
let Some((qc_bytes,)) =
query_as::<(Vec<u8>,)>("SELECT data FROM quorum_certificate WHERE leaf_hash = $1 LIMIT 1")
.bind(req.expected_leaf.to_string())
.fetch_one(tx.as_mut())
.fetch_optional(tx.as_mut())
.await
.context("fetching QC")?;
.context("fetching QC")?
else {
return Ok(None);
};

let proposal: Proposal<SeqTypes, QuorumProposal<SeqTypes>> =
bincode::deserialize(&proposal_bytes).context("deserializing quorum proposal")?;
let qc: QuorumCertificate<SeqTypes> =
bincode::deserialize(&qc_bytes).context("deserializing quorum certificate")?;

let leaf = Leaf::from_quorum_proposal(&proposal.data);
Ok((leaf, qc))
Ok(Some((leaf, qc)))
}

#[cfg(test)]
Expand Down

0 comments on commit 44017e4

Please sign in to comment.