Skip to content

Commit f111bfb

Browse files
authored
fix(config): bring back system params to config file (risingwavelabs#8623)
1 parent 3789023 commit f111bfb

File tree

16 files changed

+216
-92
lines changed

16 files changed

+216
-92
lines changed

ci/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ steps:
104104
files: "*-junit.xml"
105105
format: "junit"
106106
- ./ci/plugins/upload-failure-logs
107-
timeout_in_minutes: 15
107+
timeout_in_minutes: 10
108108
retry: *auto-retry
109109

110110
- label: "end-to-end test (release mode)"

src/common/src/config.rs

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use std::collections::HashMap;
2121
use std::fs;
2222

2323
use clap::ValueEnum;
24+
use risingwave_pb::meta::SystemParams;
2425
use serde::{Deserialize, Serialize};
2526
use serde_json::Value;
2627

@@ -112,6 +113,9 @@ pub struct RwConfig {
112113
#[serde(default)]
113114
pub storage: StorageConfig,
114115

116+
#[serde(default)]
117+
pub system: SystemConfig,
118+
115119
#[serde(flatten)]
116120
pub unrecognized: HashMap<String, Value>,
117121
}
@@ -451,6 +455,67 @@ impl Default for DeveloperConfig {
451455
}
452456
}
453457

458+
/// The section `[system]` in `risingwave.toml`.
459+
#[derive(Clone, Debug, Serialize, Deserialize)]
460+
pub struct SystemConfig {
461+
/// The interval of periodic barrier.
462+
#[serde(default = "default::system::barrier_interval_ms")]
463+
pub barrier_interval_ms: u32,
464+
465+
/// There will be a checkpoint for every n barriers
466+
#[serde(default = "default::system::checkpoint_frequency")]
467+
pub checkpoint_frequency: u64,
468+
469+
/// Target size of the Sstable.
470+
#[serde(default = "default::system::sstable_size_mb")]
471+
pub sstable_size_mb: u32,
472+
473+
/// Size of each block in bytes in SST.
474+
#[serde(default = "default::system::block_size_kb")]
475+
pub block_size_kb: u32,
476+
477+
/// False positive probability of bloom filter.
478+
#[serde(default = "default::system::bloom_false_positive")]
479+
pub bloom_false_positive: f64,
480+
481+
#[serde(default = "default::system::state_store")]
482+
pub state_store: String,
483+
484+
/// Remote directory for storing data and metadata objects.
485+
#[serde(default = "default::system::data_directory")]
486+
pub data_directory: String,
487+
488+
/// Remote storage url for storing snapshots.
489+
#[serde(default = "default::system::backup_storage_url")]
490+
pub backup_storage_url: String,
491+
492+
/// Remote directory for storing snapshots.
493+
#[serde(default = "default::system::backup_storage_directory")]
494+
pub backup_storage_directory: String,
495+
}
496+
497+
impl Default for SystemConfig {
498+
fn default() -> Self {
499+
toml::from_str("").unwrap()
500+
}
501+
}
502+
503+
impl SystemConfig {
504+
pub fn into_init_system_params(self) -> SystemParams {
505+
SystemParams {
506+
barrier_interval_ms: Some(self.barrier_interval_ms),
507+
checkpoint_frequency: Some(self.checkpoint_frequency),
508+
sstable_size_mb: Some(self.sstable_size_mb),
509+
block_size_kb: Some(self.block_size_kb),
510+
bloom_false_positive: Some(self.bloom_false_positive),
511+
state_store: Some(self.state_store),
512+
data_directory: Some(self.data_directory),
513+
backup_storage_url: Some(self.backup_storage_url),
514+
backup_storage_directory: Some(self.backup_storage_directory),
515+
}
516+
}
517+
}
518+
454519
mod default {
455520
pub mod meta {
456521
use crate::config::MetaBackend;
@@ -662,4 +727,44 @@ mod default {
662727
1024
663728
}
664729
}
730+
731+
pub mod system {
732+
use crate::system_param;
733+
734+
pub fn barrier_interval_ms() -> u32 {
735+
system_param::default::barrier_interval_ms()
736+
}
737+
738+
pub fn checkpoint_frequency() -> u64 {
739+
system_param::default::checkpoint_frequency()
740+
}
741+
742+
pub fn sstable_size_mb() -> u32 {
743+
system_param::default::sstable_size_mb()
744+
}
745+
746+
pub fn block_size_kb() -> u32 {
747+
system_param::default::block_size_kb()
748+
}
749+
750+
pub fn bloom_false_positive() -> f64 {
751+
system_param::default::bloom_false_positive()
752+
}
753+
754+
pub fn state_store() -> String {
755+
system_param::default::state_store()
756+
}
757+
758+
pub fn data_directory() -> String {
759+
system_param::default::data_directory()
760+
}
761+
762+
pub fn backup_storage_url() -> String {
763+
system_param::default::backup_storage_url()
764+
}
765+
766+
pub fn backup_storage_directory() -> String {
767+
system_param::default::backup_storage_directory()
768+
}
769+
}
665770
}

src/common/src/system_param/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ macro_rules! for_all_undeprecated_params {
3838
{ sstable_size_mb, u32, 256_u32 },
3939
{ block_size_kb, u32, 64_u32 },
4040
{ bloom_false_positive, f64, 0.001_f64 },
41-
{ state_store, String, "hummock+memory".to_string() },
41+
{ state_store, String, "".to_string() },
4242
{ data_directory, String, "hummock_001".to_string() },
4343
{ backup_storage_url, String, "memory".to_string() },
4444
{ backup_storage_directory, String, "backup".to_string() },

src/config/ci-compaction-test-meta.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,9 @@ total_buffer_capacity_mb = 128
2121
cache_file_fallocate_unit_mb = 512
2222
cache_meta_fallocate_unit_mb = 16
2323
cache_file_max_write_size_mb = 4
24+
25+
[system]
26+
sstable_size_mb = 256
27+
block_size_kb = 1024
28+
bloom_false_positive = 0.001
29+
data_directory = "hummock_001"

src/config/ci-compaction-test.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,9 @@ total_buffer_capacity_mb = 128
1919
cache_file_fallocate_unit_mb = 512
2020
cache_meta_fallocate_unit_mb = 16
2121
cache_file_max_write_size_mb = 4
22+
23+
[system]
24+
sstable_size_mb = 256
25+
block_size_kb = 1024
26+
bloom_false_positive = 0.001
27+
data_directory = "hummock_001"

src/config/ci-iceberg-test.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ enable_committed_sst_sanity_check = true
44
max_heartbeat_interval_secs = 600
55

66
[streaming]
7-
barrier_interval_ms = 5000
87
in_flight_barrier_nums = 10
8+
9+
[system]
10+
barrier_interval_ms = 5000
911
checkpoint_frequency = 1

src/config/ci-meta-backup-test.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22
min_sst_retention_time_sec = 0
33
collect_gc_watermark_spin_interval_sec = 1
44
vacuum_interval_sec = 10
5+
6+
[system]
7+
backup_storage_url = "minio://hummockadmin:[email protected]:9301/hummock001"
8+
backup_storage_directory = "backup"

src/config/ci-recovery.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ enable_committed_sst_sanity_check = true
44
max_heartbeat_interval_secs = 600
55

66
[streaming]
7-
barrier_interval_ms = 250
87
in_flight_barrier_nums = 10
9-
checkpoint_frequency = 5
8+
9+
[system]
10+
barrier_interval_ms = 250
11+
checkpoint_frequency = 5

src/config/ci.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ enable_committed_sst_sanity_check = true
44
max_heartbeat_interval_secs = 600
55

66
[streaming]
7-
barrier_interval_ms = 250
87
in_flight_barrier_nums = 10
9-
checkpoint_frequency = 5
8+
9+
[system]
10+
barrier_interval_ms = 250
11+
checkpoint_frequency = 5

src/config/example.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,9 @@ stream_enable_executor_row_count = false
3737
stream_connector_message_buffer_size = 16
3838
unsafe_stream_extreme_cache_size = 1024
3939
stream_chunk_size = 1024
40+
41+
[system]
42+
sstable_size_mb = 256
43+
block_size_kb = 1024
44+
bloom_false_positive = 0.001
45+
data_directory = "hummock_001"

src/meta/src/lib.rs

Lines changed: 41 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,8 @@ use std::time::Duration;
5151

5252
use clap::Parser;
5353
pub use error::{MetaError, MetaResult};
54-
use risingwave_common::system_param::default;
5554
use risingwave_common::{GIT_SHA, RW_VERSION};
5655
use risingwave_common_proc_macro::OverrideConfig;
57-
use risingwave_pb::meta::SystemParams;
5856

5957
use crate::manager::MetaOpts;
6058
use crate::rpc::server::{rpc_serve, AddressInfo, MetaStoreBackend};
@@ -107,42 +105,6 @@ pub struct MetaNodeOpts {
107105
#[clap(long, env = "RW_PROMETHEUS_ENDPOINT")]
108106
prometheus_endpoint: Option<String>,
109107

110-
/// State store url.
111-
#[clap(long, env = "RW_STATE_STORE")]
112-
state_store: Option<String>,
113-
114-
/// The interval of periodic barrier.
115-
#[clap(long, env = "RW_BARRIER_INTERVAL_MS", default_value_t = default::barrier_interval_ms())]
116-
barrier_interval_ms: u32,
117-
118-
/// There will be a checkpoint for every n barriers
119-
#[clap(long, env = "RW_CHECKPOINT_FREQUENCY", default_value_t = default::checkpoint_frequency())]
120-
pub checkpoint_frequency: u64,
121-
122-
/// Target size of the Sstable.
123-
#[clap(long, env = "RW_SSTABLE_SIZE_MB", default_value_t = default::sstable_size_mb())]
124-
sstable_size_mb: u32,
125-
126-
/// Size of each block in bytes in SST.
127-
#[clap(long, env = "RW_BLOCK_SIZE_KB", default_value_t = default::block_size_kb())]
128-
block_size_kb: u32,
129-
130-
/// False positive probability of bloom filter.
131-
#[clap(long, env = "RW_BLOOM_FALSE_POSITIVE", default_value_t = default::bloom_false_positive())]
132-
bloom_false_positive: f64,
133-
134-
/// Remote directory for storing data and metadata objects.
135-
#[clap(long, env = "RW_DATA_DIRECTORY", default_value_t = default::data_directory())]
136-
data_directory: String,
137-
138-
/// Remote storage url for storing snapshots.
139-
#[clap(long, env = "RW_BACKUP_STORAGE_URL", default_value_t = default::backup_storage_url())]
140-
backup_storage_url: String,
141-
142-
/// Remote directory for storing snapshots.
143-
#[clap(long, env = "RW_STORAGE_DIRECTORY", default_value_t = default::backup_storage_directory())]
144-
backup_storage_directory: String,
145-
146108
/// Endpoint of the connector node, there will be a sidecar connector node
147109
/// colocated with Meta node in the cloud environment
148110
#[clap(long, env = "RW_CONNECTOR_RPC_ENDPOINT")]
@@ -164,6 +126,46 @@ pub struct OverrideConfigOpts {
164126
#[clap(long, env = "RW_BACKEND", value_enum)]
165127
#[override_opts(path = meta.backend)]
166128
backend: Option<MetaBackend>,
129+
130+
/// The interval of periodic barrier.
131+
#[clap(long, env = "RW_BARRIER_INTERVAL_MS")]
132+
#[override_opts(path = system.barrier_interval_ms)]
133+
barrier_interval_ms: Option<u32>,
134+
135+
/// Target size of the Sstable.
136+
#[clap(long, env = "RW_SSTABLE_SIZE_MB")]
137+
#[override_opts(path = system.sstable_size_mb)]
138+
sstable_size_mb: Option<u32>,
139+
140+
/// Size of each block in bytes in SST.
141+
#[clap(long, env = "RW_BLOCK_SIZE_KB")]
142+
#[override_opts(path = system.block_size_kb)]
143+
block_size_kb: Option<u32>,
144+
145+
/// False positive probability of bloom filter.
146+
#[clap(long, env = "RW_BLOOM_FALSE_POSITIVE")]
147+
#[override_opts(path = system.bloom_false_positive)]
148+
bloom_false_positive: Option<f64>,
149+
150+
/// State store url
151+
#[clap(long, env = "RW_STATE_STORE")]
152+
#[override_opts(path = system.state_store)]
153+
state_store: Option<String>,
154+
155+
/// Remote directory for storing data and metadata objects.
156+
#[clap(long, env = "RW_DATA_DIRECTORY")]
157+
#[override_opts(path = system.data_directory)]
158+
data_directory: Option<String>,
159+
160+
/// Remote storage url for storing snapshots.
161+
#[clap(long, env = "RW_BACKUP_STORAGE_URL")]
162+
#[override_opts(path = system.backup_storage_url)]
163+
backup_storage_url: Option<String>,
164+
165+
/// Remote directory for storing snapshots.
166+
#[clap(long, env = "RW_BACKUP_STORAGE_DIRECTORY")]
167+
#[override_opts(path = system.backup_storage_directory)]
168+
backup_storage_directory: Option<String>,
167169
}
168170

169171
use std::future::Future;
@@ -244,17 +246,7 @@ pub fn start(opts: MetaNodeOpts) -> Pin<Box<dyn Future<Output = ()> + Send>> {
244246
.meta
245247
.periodic_ttl_reclaim_compaction_interval_sec,
246248
},
247-
SystemParams {
248-
barrier_interval_ms: Some(opts.barrier_interval_ms),
249-
checkpoint_frequency: Some(opts.checkpoint_frequency),
250-
sstable_size_mb: Some(opts.sstable_size_mb),
251-
block_size_kb: Some(opts.block_size_kb),
252-
bloom_false_positive: Some(opts.bloom_false_positive),
253-
state_store: Some(opts.state_store.unwrap_or_default()),
254-
data_directory: Some(opts.data_directory),
255-
backup_storage_url: Some(opts.backup_storage_url),
256-
backup_storage_directory: Some(opts.backup_storage_directory),
257-
},
249+
config.system.into_init_system_params(),
258250
)
259251
.await
260252
.unwrap();

src/storage/backup/integration_tests/common.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ function clean_etcd_data() {
1919

2020
function start_cluster() {
2121
cargo make d ci-meta-backup-test 1>/dev/null 2>&1
22-
execute_sql_and_expect \
23-
"alter system set backup_storage_url to \"minio://hummockadmin:[email protected]:9301/hummock001\";" \
24-
"ALTER_SYSTEM"
2522
sleep 5
2623
}
2724

src/tests/compaction_test/src/compaction_test_runner.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,16 @@ pub async fn start_meta_node(listen_addr: String, config_path: String) {
138138
"--config-path",
139139
&config_path,
140140
]);
141-
// We set a large checkpoint frequency to prevent the embedded meta node
142-
// to commit new epochs to avoid bumping the hummock version during version log replay.
143-
assert_eq!(CHECKPOINT_FREQ_FOR_REPLAY, meta_opts.checkpoint_frequency);
144141
let config = load_config(
145142
&meta_opts.config_path,
146143
Some(meta_opts.override_opts.clone()),
147144
);
145+
// We set a large checkpoint frequency to prevent the embedded meta node
146+
// to commit new epochs to avoid bumping the hummock version during version log replay.
147+
assert_eq!(
148+
CHECKPOINT_FREQ_FOR_REPLAY,
149+
config.system.checkpoint_frequency
150+
);
148151
assert!(
149152
config.meta.enable_compaction_deterministic,
150153
"enable_compaction_deterministic should be set"

0 commit comments

Comments
 (0)