diff options
author | Alex Auvolat <lx@deuxfleurs.fr> | 2025-02-14 16:14:59 +0100 |
---|---|---|
committer | Alex Auvolat <lx@deuxfleurs.fr> | 2025-02-14 16:45:55 +0100 |
commit | d0104b9f9bd96e008fe3fbe8e5658cae605525b1 (patch) | |
tree | 485a4a46e24af2e2fd14a4c034dc60c03d1c3ef6 /src | |
parent | 3fe8db9e52bf7fd069d8fa11d6a0c90a7d2944b6 (diff) | |
download | garage-d0104b9f9bd96e008fe3fbe8e5658cae605525b1.tar.gz garage-d0104b9f9bd96e008fe3fbe8e5658cae605525b1.zip |
block manager: write blocks only to currently active layout version (fix #815)
avoid wastefully writing blocks to nodes that will discard them as soon
as the layout migration is finished
Diffstat (limited to 'src')
-rw-r--r-- | src/block/manager.rs | 4 | ||||
-rw-r--r-- | src/rpc/layout/helper.rs | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/block/manager.rs b/src/block/manager.rs index 537e1fc1..572bdadd 100644 --- a/src/block/manager.rs +++ b/src/block/manager.rs @@ -370,7 +370,7 @@ impl BlockManager { prevent_compression: bool, order_tag: Option<OrderTag>, ) -> Result<(), Error> { - let who = self.replication.write_sets(&hash); + let who = self.system.cluster_layout().current_storage_nodes_of(&hash); let compression_level = self.compression_level.filter(|_| !prevent_compression); let (header, bytes) = DataBlock::from_buffer(data, compression_level) @@ -396,7 +396,7 @@ impl BlockManager { .rpc_helper() .try_write_many_sets( &self.endpoint, - who.as_ref(), + &[who], put_block_rpc, RequestStrategy::with_priority(PRIO_NORMAL | PRIO_SECONDARY) .with_drop_on_completion(permit) diff --git a/src/rpc/layout/helper.rs b/src/rpc/layout/helper.rs index 44c826f9..c08a5629 100644 --- a/src/rpc/layout/helper.rs +++ b/src/rpc/layout/helper.rs @@ -219,6 +219,11 @@ impl LayoutHelper { ret } + pub fn current_storage_nodes_of(&self, position: &Hash) -> Vec<Uuid> { + let ver = self.current(); + ver.nodes_of(position, ver.replication_factor).collect() + } + pub fn trackers_hash(&self) -> Hash { self.trackers_hash } |