mirror of
https://git.deuxfleurs.fr/Deuxfleurs/garage.git
synced 2024-11-22 08:01:02 +00:00
whoops
This commit is contained in:
parent
3f7a496355
commit
1ec49980ec
2 changed files with 11 additions and 2 deletions
|
@ -50,7 +50,7 @@ pub(crate) struct MerkleUpdater {
|
|||
empty_node_hash: Hash,
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct MerkleNodeKey {
|
||||
// partition: first 16 bits (two bytes) of the partition_key's hash
|
||||
pub partition: MerklePartition,
|
||||
|
@ -283,6 +283,7 @@ impl MerkleUpdater {
|
|||
k: &MerkleNodeKey,
|
||||
v: &MerkleNode,
|
||||
) -> ConflictableTransactionResult<Hash, Error> {
|
||||
trace!("Put Merkle node: {:?} => {:?}", k, v);
|
||||
if *v == MerkleNode::Empty {
|
||||
tx.remove(k.encode())?;
|
||||
Ok(self.empty_node_hash)
|
||||
|
|
|
@ -370,6 +370,14 @@ where
|
|||
must_exit: watch::Receiver<bool>,
|
||||
) -> Result<(), Error> {
|
||||
let root_ck = self.get_root_ck(partition.range)?;
|
||||
if root_ck.is_empty() {
|
||||
debug!(
|
||||
"({}) Sync {:?} with {:?}: partition is empty.",
|
||||
self.data.name, partition, who
|
||||
);
|
||||
return Ok(())
|
||||
}
|
||||
|
||||
let root_ck_hash = hash_of(&root_ck)?;
|
||||
|
||||
// If their root checksum has level > than us, use that as a reference
|
||||
|
@ -637,7 +645,7 @@ fn join_ordered<'a, K: Ord + Eq, V1, V2>(
|
|||
ret.push((&x[i].0, Some(&x[i].1), None));
|
||||
i += 1;
|
||||
} else if j < y.len() && (i == x.len() || x[i].0 > y[j].0) {
|
||||
ret.push((&x[i].0, None, Some(&y[j].1)));
|
||||
ret.push((&y[j].0, None, Some(&y[j].1)));
|
||||
j += 1;
|
||||
} else {
|
||||
unreachable!();
|
||||
|
|
Loading…
Reference in a new issue