Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

uses current local timestamp when recording purged values #16573

Merged
merged 1 commit into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions core/src/cluster_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1890,14 +1890,12 @@ impl ClusterInfo {
error!("crds table trim failed: {:?}", err);
}
Ok(purged_values) => {
let now = timestamp();
self.stats
.trim_crds_table_purged_values_count
.add_relaxed(purged_values.len() as u64);
gossip.pull.purged_values.extend(
purged_values
.into_iter()
.map(|v| (v.value_hash, v.local_timestamp)),
);
let purged_values = purged_values.into_iter().map(|v| (v.value_hash, now));
gossip.pull.purged_values.extend(purged_values);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/crds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub struct VersionedCrdsValue {
/// local time when inserted
pub insert_timestamp: u64,
/// local time when updated
pub local_timestamp: u64,
pub(crate) local_timestamp: u64,
/// value hash
pub value_hash: Hash,
}
Expand Down
3 changes: 1 addition & 2 deletions core/src/crds_gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ impl CrdsGossip {
.push
.process_push_message(&mut self.crds, from, val, now);
if let Ok(Some(val)) = res {
self.pull
.record_old_hash(val.value_hash, val.local_timestamp);
self.pull.record_old_hash(val.value_hash, now);
Some(val)
} else {
None
Expand Down
10 changes: 4 additions & 6 deletions core/src/crds_gossip_pull.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,7 @@ impl CrdsGossipPull {
for caller in callers {
let key = caller.label().pubkey();
if let Ok(Some(val)) = crds.insert(caller, now) {
self.purged_values
.push_back((val.value_hash, val.local_timestamp));
self.purged_values.push_back((val.value_hash, now));
}
crds.update_record_timestamp(&key, now);
}
Expand Down Expand Up @@ -399,8 +398,7 @@ impl CrdsGossipPull {
owners.insert(label.pubkey());
success.push((label, hash, wc));
if let Some(val) = old {
self.purged_values
.push_back((val.value_hash, val.local_timestamp))
self.purged_values.push_back((val.value_hash, now))
}
}
}
Expand Down Expand Up @@ -555,7 +553,7 @@ impl CrdsGossipPull {
.into_iter()
.filter_map(|label| {
let val = crds.remove(&label)?;
Some((val.value_hash, val.local_timestamp))
Some((val.value_hash, now))
}),
);
self.purged_values.len() - num_purged_values
Expand Down Expand Up @@ -1335,7 +1333,7 @@ mod test {
}

// purge the value
node.purge_purged(1);
node.purge_purged(3);
assert_eq!(node.purged_values.len(), 0);
}
#[test]
Expand Down