Skip to content

Commit

Permalink
add paradedb config engine (#1000)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChuckHend authored Oct 4, 2024
1 parent 867808a commit 16335bf
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tembo-stacks/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tembo-stacks/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "tembo-stacks"
description = "Tembo Stacks for Postgres"
version = "0.16.7"
version = "0.17.0"
authors = ["tembo.io"]
edition = "2021"
license = "Apache-2.0"
Expand Down
33 changes: 33 additions & 0 deletions tembo-stacks/src/stacks/config_engines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub enum ConfigEngine {
Standard,
OLAP,
MQ,
ParadeDB,
}

// The standard configuration engine
Expand Down Expand Up @@ -154,6 +155,12 @@ pub fn mq_config_engine(stack: &Stack) -> Vec<PgConfig> {
configs
}

pub fn paradedb_config_engine(stack: &Stack) -> Vec<PgConfig> {
let mut configs = olap_config_engine(stack);
configs.retain(|cfg| cfg.name != "columnar.min_parallel_processes");
configs
}

// olap formula for max_parallel_workers_per_gather
fn olap_max_parallel_workers_per_gather(cpu: f32) -> i32 {
// higher of default (2) or 0.5 * cpu. PGTune uses ceiling; we will, too
Expand Down Expand Up @@ -530,6 +537,8 @@ mod tests {
};
let configs = olap_config_engine(&stack);

assert_eq!(configs.len(), 11);

assert_eq!(configs[0].name, "effective_cache_size");
assert_eq!(configs[0].value.to_string(), "11468MB");
assert_eq!(configs[1].name, "maintenance_work_mem");
Expand Down Expand Up @@ -582,4 +591,28 @@ mod tests {
assert_eq!(configs[8].name, "work_mem");
assert_eq!(configs[8].value.to_string(), "45MB");
}

#[test]
fn test_paradedb_config_engine() {
let stack: Stack = Stack {
name: "test".to_owned(),
infrastructure: Some(Infrastructure {
cpu: "4".to_string(),
memory: "16Gi".to_string(),
storage: "10Gi".to_string(),
}),
postgres_config_engine: Some(ConfigEngine::Standard),
..Stack::default()
};
let olap_configs = olap_config_engine(&stack);
assert_eq!(olap_configs.len(), 11);
assert!(olap_configs
.iter()
.any(|item| item.name == "columnar.min_parallel_processes"));
let paradedb_configs = paradedb_config_engine(&stack);
assert_eq!(paradedb_configs.len(), 10);
assert!(!paradedb_configs
.iter()
.any(|item| item.name == "columnar.min_parallel_processes"));
}
}
2 changes: 1 addition & 1 deletion tembo-stacks/src/stacks/specs/paradedb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ images:
15: "standard-cnpg:15-5120dd1"
16: "standard-cnpg:16-5120dd1"
stack_version: 0.1.0
postgres_config_engine: olap
postgres_config_engine: paradedb
postgres_config:
- name: autovacuum_vacuum_scale_factor
value: 0.05
Expand Down
4 changes: 3 additions & 1 deletion tembo-stacks/src/stacks/types.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::stacks::config_engines::{
mq_config_engine, olap_config_engine, standard_config_engine, ConfigEngine,
mq_config_engine, olap_config_engine, paradedb_config_engine, standard_config_engine,
ConfigEngine,
};
use k8s_openapi::apimachinery::pkg::api::resource::Quantity;
use schemars::JsonSchema;
Expand Down Expand Up @@ -180,6 +181,7 @@ impl Stack {
Some(ConfigEngine::Standard) => Some(standard_config_engine(self)),
Some(ConfigEngine::OLAP) => Some(olap_config_engine(self)),
Some(ConfigEngine::MQ) => Some(mq_config_engine(self)),
Some(ConfigEngine::ParadeDB) => Some(paradedb_config_engine(self)),
None => Some(standard_config_engine(self)),
}
}
Expand Down

0 comments on commit 16335bf

Please sign in to comment.