mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-07 13:32:57 +00:00
Pass stripe size during shard map updates
This commit is contained in:
@@ -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<ShardStripeSize>,
|
||||
|
||||
/*** 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<utils::shard::ShardIndex, String>,
|
||||
stripe_size: Option<ShardStripeSize>,
|
||||
) {
|
||||
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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user