diff --git a/pgxn/neon/communicator/src/worker_process/main_loop.rs b/pgxn/neon/communicator/src/worker_process/main_loop.rs index cb07e6a592..ec07cf61e5 100644 --- a/pgxn/neon/communicator/src/worker_process/main_loop.rs +++ b/pgxn/neon/communicator/src/worker_process/main_loop.rs @@ -54,11 +54,6 @@ pub struct CommunicatorWorkerProcessStruct<'a> { /// Local File Cache, relation size tracking, last-written LSN tracking pub(crate) cache: IntegratedCacheWriteAccess<'a>, - /*** Static configuration ***/ - /// Stripe size doesn't change after startup. (The shard map is not stored here, it's passed - /// directly to the client) - stripe_size: Option, - /*** Metrics ***/ pub(crate) lfc_metrics: LfcMetricsCollector, @@ -169,7 +164,6 @@ pub(super) fn init( // Note: it's important to not drop the runtime, or all the tasks are dropped // too. Including it in the returned struct is one way to keep it around. runtime, - stripe_size, neon_request_slots: cis.neon_request_slots, client, cache, @@ -211,9 +205,9 @@ impl<'t> CommunicatorWorkerProcessStruct<'t> { pub(super) fn update_shard_map( &self, new_shard_map: HashMap, + stripe_size: Option, ) { - let shard_spec = - ShardSpec::new(new_shard_map, self.stripe_size).expect("invalid shard spec"); + let shard_spec = ShardSpec::new(new_shard_map, stripe_size).expect("invalid shard spec"); { let _in_runtime = self.runtime.enter(); diff --git a/pgxn/neon/communicator/src/worker_process/worker_interface.rs b/pgxn/neon/communicator/src/worker_process/worker_interface.rs index 963f46a5d4..f5607a83fd 100644 --- a/pgxn/neon/communicator/src/worker_process/worker_interface.rs +++ b/pgxn/neon/communicator/src/worker_process/worker_interface.rs @@ -156,9 +156,11 @@ pub extern "C" fn communicator_worker_config_reload( file_cache_size: u64, shard_map: *mut *mut c_char, nshards: u32, + stripe_size: u32, ) { proc_handle.cache.resize_file_cache(file_cache_size as u32); let shard_map = shard_map_to_hash(nshards, shard_map); - proc_handle.update_shard_map(shard_map); + let stripe_size = (nshards > 1).then_some(ShardStripeSize(stripe_size)); + proc_handle.update_shard_map(shard_map, stripe_size); } diff --git a/pgxn/neon/communicator_process.c b/pgxn/neon/communicator_process.c index 4962c43211..af1b4e1497 100644 --- a/pgxn/neon/communicator_process.c +++ b/pgxn/neon/communicator_process.c @@ -234,7 +234,8 @@ communicator_new_bgworker_main(Datum main_arg) communicator_worker_config_reload(proc_handle, file_cache_size, connstrings, - shard_map.num_shards); + shard_map.num_shards, + neon_stripe_size); pfree(connstrings); } }