diff --git a/src/cmd_all/src/standalone.rs b/src/cmd_all/src/standalone.rs index 954eeb13657f..6af96d0ea1fa 100644 --- a/src/cmd_all/src/standalone.rs +++ b/src/cmd_all/src/standalone.rs @@ -278,7 +278,7 @@ pub async fn standalone( let compute = if let Some(opts) = compute_opts { tracing::info!("starting compute-node thread with cli args: {:?}", opts); let service = Service::spawn("compute", |shutdown| { - risingwave_compute::start(opts, shutdown) + risingwave_compute::start_standalone(opts, shutdown) }); Some(service) } else { diff --git a/src/compute/src/lib.rs b/src/compute/src/lib.rs index 1336a84980ce..431fe773c0b1 100644 --- a/src/compute/src/lib.rs +++ b/src/compute/src/lib.rs @@ -206,10 +206,25 @@ fn validate_opts(opts: &ComputeNodeOpts) { use crate::server::compute_node_serve; -/// Start compute node pub fn start( opts: ComputeNodeOpts, shutdown: CancellationToken, +) -> Pin + Send>> { + start_impl(opts, false, shutdown) +} + +pub fn start_standalone( + opts: ComputeNodeOpts, + shutdown: CancellationToken, +) -> Pin + Send>> { + start_impl(opts, true, shutdown) +} + +/// Start compute node +fn start_impl( + opts: ComputeNodeOpts, + is_standalone: bool, + shutdown: CancellationToken, ) -> Pin + Send>> { // WARNING: don't change the function signature. Making it `async fn` will cause // slow compile in release mode. diff --git a/src/compute/src/memory/config.rs b/src/compute/src/memory/config.rs index 82ab2e46677d..ab13aefe0ca5 100644 --- a/src/compute/src/memory/config.rs +++ b/src/compute/src/memory/config.rs @@ -104,11 +104,12 @@ fn gradient_reserve_memory_bytes(total_memory_bytes: usize) -> usize { /// limits are calculated based on the proportions to total `non_reserved_memory_bytes`. pub fn extract_hummock_memory_config( non_reserved_memory_bytes: usize, - embedded_compactor_enabled: bool, + is_compactor_hybird_deplyment: bool, storage_config: &StorageConfig, is_serving: bool, ) -> (StorageMemoryConfig, Option) { - let (storage_memory_proportion, compactor_memory_proportion) = if embedded_compactor_enabled { + let (storage_memory_proportion, compactor_memory_proportion) = if is_compactor_hybird_deplyment + { (STORAGE_MEMORY_PROPORTION, COMPACTOR_MEMORY_PROPORTION) } else { (STORAGE_MEMORY_PROPORTION + COMPACTOR_MEMORY_PROPORTION, 0.0) diff --git a/src/compute/src/server.rs b/src/compute/src/server.rs index dbdc077faa88..94bb23d403a4 100644 --- a/src/compute/src/server.rs +++ b/src/compute/src/server.rs @@ -90,6 +90,7 @@ pub async fn compute_node_serve( listen_addr: SocketAddr, advertise_addr: HostAddr, opts: ComputeNodeOpts, + is_standalone: bool, shutdown: CancellationToken, ) { // Load the configuration. @@ -138,11 +139,12 @@ pub async fn compute_node_serve( let embedded_compactor_enabled = embedded_compactor_enabled(state_store_url, config.storage.disable_remote_compactor); + let is_compactor_hybrid_deployment = embedded_compactor_enabled || is_standalone; let (reserved_memory_bytes, non_reserved_memory_bytes) = reserve_memory_bytes(&opts); let (storage_memory_config, compactor_memory_config) = extract_hummock_memory_config( non_reserved_memory_bytes, - embedded_compactor_enabled, + is_compactor_hybrid_deployment, &config.storage, !opts.role.for_streaming(), );