mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-04 12:02:55 +00:00
Pass stripe size during shard map updates
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user