Skip to content

Commit

Permalink
feat: remove sleep for repeated cluster runs
Browse files Browse the repository at this point in the history
If we sleep in repeated cluster runs (after first cluster
initialization), then instances can not get quorum and they can not
start.
  • Loading branch information
lowitea committed Jan 30, 2025
1 parent e3d521a commit 64340fe
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ pub fn cluster(params: &Params) -> Result<Vec<PicodataInstance>> {

info!("Running the cluster...");

let is_clean_run = !params.data_dir.join("cluster").exists();

let mut picodata_processes = vec![];

let first_instance_bin_port = 3001;
Expand All @@ -404,8 +406,10 @@ pub fn cluster(params: &Params) -> Result<Vec<PicodataInstance>> {

picodata_processes.push(pico_instance);

// TODO: check is started by logs or iproto
thread::sleep(Duration::from_secs(5));
if is_clean_run {
// TODO: check is started by logs or iproto
thread::sleep(Duration::from_secs(5));
}

info!("i{instance_id} - started");
}
Expand All @@ -414,6 +418,11 @@ pub fn cluster(params: &Params) -> Result<Vec<PicodataInstance>> {
if !params.disable_plugin_install {
info!("Enabling plugins...");

if !is_clean_run {
// TODO: check is started by logs or iproto
thread::sleep(Duration::from_secs(5));
}

let result = enable_plugins(&topology, &params.data_dir, &params.picodata_path);
if let Err(e) = result {
for process in &mut picodata_processes {
Expand Down

0 comments on commit 64340fe

Please sign in to comment.