From b51bc2f97596b429e9a22ff3466c0a516ef36ab5 Mon Sep 17 00:00:00 2001 From: qima Date: Thu, 14 Nov 2024 00:01:01 +0800 Subject: [PATCH 1/2] fix(node): populate records_by_bucket cache during restart --- sn_networking/src/record_store.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sn_networking/src/record_store.rs b/sn_networking/src/record_store.rs index ce1ef5b5f2..e9dc6dabe6 100644 --- a/sn_networking/src/record_store.rs +++ b/sn_networking/src/record_store.rs @@ -371,13 +371,25 @@ impl NodeRecordStore { }; let records = Self::update_records_from_an_existing_store(&config, &encryption_details); + let local_address = NetworkAddress::from_peer(local_id); + + // Initialize records_by_bucket + let mut records_by_bucket: HashMap> = HashMap::new(); + for (key, (addr, _record_type)) in records.iter() { + let distance = local_address.distance(addr); + let bucket = distance.ilog2().unwrap_or_default(); + records_by_bucket + .entry(bucket) + .or_default() + .insert(key.clone()); + } let cache_size = config.records_cache_size; let mut record_store = NodeRecordStore { - local_address: NetworkAddress::from_peer(local_id), + local_address, config, records, - records_by_bucket: HashMap::new(), + records_by_bucket, records_cache: RecordCache::new(cache_size), network_event_sender, local_swarm_cmd_sender: swarm_cmd_sender, From 3145bc2e9f44af5c5bee7687a019f770f807ddcf Mon Sep 17 00:00:00 2001 From: qima Date: Thu, 14 Nov 2024 00:13:36 +0800 Subject: [PATCH 2/2] chore(release): stable release 2024.11.1.5 --- CHANGELOG.md | 11 +++++++++++ Cargo.lock | 2 +- autonomi/Cargo.toml | 2 +- nat-detection/Cargo.toml | 2 +- release-cycle-info | 2 +- sn_build_info/src/release_info.rs | 2 +- sn_networking/Cargo.toml | 2 +- sn_node/Cargo.toml | 2 +- 8 files changed, 18 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2a5f8b0af..08f425f819 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 *When editing this file, please respect a line length of 100.* +## 2024-11-13 + +### Network + +#### Fixed + +- During a restart, the node builds a cache of locally restored records, + which is used to improve the speed of the relevant records calculation. + The restored records were not being added to the cache. + This has now been corrected. + ## 2024-11-12 ### Network diff --git a/Cargo.lock b/Cargo.lock index 40ae0a8133..2ecbb63d2e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8664,7 +8664,7 @@ dependencies = [ [[package]] name = "sn_networking" -version = "0.19.3" +version = "0.19.4" dependencies = [ "aes-gcm-siv", "assert_fs", diff --git a/autonomi/Cargo.toml b/autonomi/Cargo.toml index 64e8a620b4..27b1439bda 100644 --- a/autonomi/Cargo.toml +++ b/autonomi/Cargo.toml @@ -40,7 +40,7 @@ rand = "0.8.5" rmp-serde = "1.1.1" self_encryption = "~0.30.0" serde = { version = "1.0.133", features = ["derive", "rc"] } -sn_networking = { path = "../sn_networking", version = "0.19.3" } +sn_networking = { path = "../sn_networking", version = "0.19.4" } sn_peers_acquisition = { path = "../sn_peers_acquisition", version = "0.5.7" } sn_protocol = { version = "0.17.15", path = "../sn_protocol" } sn_registers = { path = "../sn_registers", version = "0.4.3" } diff --git a/nat-detection/Cargo.toml b/nat-detection/Cargo.toml index bec7a41943..182fb0c053 100644 --- a/nat-detection/Cargo.toml +++ b/nat-detection/Cargo.toml @@ -32,7 +32,7 @@ libp2p = { version = "0.54.1", features = [ "upnp", ] } sn_build_info = { path = "../sn_build_info", version = "0.1.19" } -sn_networking = { path = "../sn_networking", version = "0.19.3" } +sn_networking = { path = "../sn_networking", version = "0.19.4" } sn_protocol = { path = "../sn_protocol", version = "0.17.15" } tokio = { version = "1.32.0", features = ["full"] } tracing = { version = "~0.1.26" } diff --git a/release-cycle-info b/release-cycle-info index 3d68391e5c..b272dbda85 100644 --- a/release-cycle-info +++ b/release-cycle-info @@ -15,4 +15,4 @@ release-year: 2024 release-month: 11 release-cycle: 1 -release-cycle-counter: 4 +release-cycle-counter: 5 diff --git a/sn_build_info/src/release_info.rs b/sn_build_info/src/release_info.rs index efccc77282..23ddb6c755 100644 --- a/sn_build_info/src/release_info.rs +++ b/sn_build_info/src/release_info.rs @@ -1,4 +1,4 @@ pub const RELEASE_YEAR: &str = "2024"; pub const RELEASE_MONTH: &str = "11"; pub const RELEASE_CYCLE: &str = "1"; -pub const RELEASE_CYCLE_COUNTER: &str = "4"; +pub const RELEASE_CYCLE_COUNTER: &str = "5"; diff --git a/sn_networking/Cargo.toml b/sn_networking/Cargo.toml index 1aa74058c6..15af991d0c 100644 --- a/sn_networking/Cargo.toml +++ b/sn_networking/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0" name = "sn_networking" readme = "README.md" repository = "https://github.com/maidsafe/safe_network" -version = "0.19.3" +version = "0.19.4" [features] default = [] diff --git a/sn_node/Cargo.toml b/sn_node/Cargo.toml index ca2e7cfad0..1b650a623f 100644 --- a/sn_node/Cargo.toml +++ b/sn_node/Cargo.toml @@ -56,7 +56,7 @@ serde = { version = "1.0.133", features = ["derive", "rc"] } sn_build_info = { path = "../sn_build_info", version = "0.1.19" } sn_peers_acquisition = { path = "../sn_peers_acquisition", version = "0.5.7" } sn_logging = { path = "../sn_logging", version = "0.2.40" } -sn_networking = { path = "../sn_networking", version = "0.19.3" } +sn_networking = { path = "../sn_networking", version = "0.19.4" } sn_protocol = { path = "../sn_protocol", version = "0.17.15" } sn_registers = { path = "../sn_registers", version = "0.4.3" } sn_transfers = { path = "../sn_transfers", version = "0.20.3" }