Pass stripe size during shard map updates

This commit is contained in:
Erik Grinaker
2025-07-23 16:32:26 +02:00
parent c7761b689d
commit 6c8a144e25
3 changed files with 7 additions and 10 deletions

View File

@@ -53,11 +53,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<ShardStripeSize>,
/*** Metrics ***/
pub(crate) lfc_metrics: LfcMetricsCollector,
@@ -157,7 +152,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,
@@ -199,10 +193,10 @@ impl<'t> CommunicatorWorkerProcessStruct<'t> {
pub(super) fn update_shard_map(
&self,
new_shard_map: HashMap<utils::shard::ShardIndex, String>,
stripe_size: Option<ShardStripeSize>,
) {
let client = self.client.as_ref().unwrap();
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();

View File

@@ -141,9 +141,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);
}

View File

@@ -224,7 +224,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);
}