Skip to content

Commit

Permalink
datastore: Panic with message on missing ODB object
Browse files Browse the repository at this point in the history
This condition _should_ be impossible, but has been observed. In case of
future occurrence, print out the hash of the missing object.
  • Loading branch information
kim committed Oct 17, 2023
1 parent 4f901ab commit f9157d8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/core/src/db/datastore/locking_tx_datastore/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1664,7 +1664,9 @@ impl Locking {
panic!("Couldn't decode product value to {:?} from message log", row_type)
}),
DataKey::Hash(hash) => {
let data = odb.lock().unwrap().get(hash).unwrap();
let data = odb.lock().unwrap().get(hash).unwrap_or_else(|| {
panic!("Object {hash} referenced from transaction not present in object DB");
});
ProductValue::decode(&row_type, &mut &data[..]).unwrap_or_else(|_| {
panic!("Couldn't decode product value to {:?} from message log", row_type)
})
Expand Down

0 comments on commit f9157d8

Please sign in to comment.