diff --git a/risedev.yml b/risedev.yml index 477e37856ba9e..da567f9180ae2 100644 --- a/risedev.yml +++ b/risedev.yml @@ -1658,7 +1658,7 @@ template: application: "metastore" # The docker image. Can be overridden to use a different version. - image: "postgres:15-alpine" + image: "postgres:17-alpine" # If set to true, data will be persisted at data/{id}. persist-data: true diff --git a/src/risedevtool/src/bin/risedev-dev.rs b/src/risedevtool/src/bin/risedev-dev.rs index 80415e321d805..63dbf11fdb178 100644 --- a/src/risedevtool/src/bin/risedev-dev.rs +++ b/src/risedevtool/src/bin/risedev-dev.rs @@ -348,7 +348,10 @@ fn task_main( risedev::TcpReadyCheckTask::new(c.address.clone(), c.port, c.user_managed)?; task.execute(&mut ctx)?; } else { - let mut task = risedev::LogReadyCheckTask::new("ready to accept connections")?; + let mut task = risedev::LogReadyCheckTask::new_all([ + "ready to accept connections", // also appears in init process + "listening on IPv4 address", // only appears when ready + ])?; task.execute(&mut ctx)?; } ctx.pb diff --git a/src/risedevtool/src/task/task_log_ready_check.rs b/src/risedevtool/src/task/task_log_ready_check.rs index a81d6961e491c..cc55c6142b47a 100644 --- a/src/risedevtool/src/task/task_log_ready_check.rs +++ b/src/risedevtool/src/task/task_log_ready_check.rs @@ -21,15 +21,21 @@ use fs_err::File; use super::{ExecuteContext, Task}; use crate::wait::wait; -/// Check if a log pattern is found in the log output indicating the service is ready. +/// Check if all log patterns are found in the log output indicating the service is ready. pub struct LogReadyCheckTask { - pattern: String, + patterns: Vec, } impl LogReadyCheckTask { pub fn new(pattern: impl Into) -> Result { Ok(Self { - pattern: pattern.into(), + patterns: vec![pattern.into()], + }) + } + + pub fn new_all(patterns: impl IntoIterator>) -> Result { + Ok(Self { + patterns: patterns.into_iter().map(Into::into).collect(), }) } } @@ -41,7 +47,7 @@ impl Task for LogReadyCheckTask { }; ctx.pb.set_message("waiting for ready..."); - ctx.wait_log_contains(&self.pattern) + ctx.wait_log_contains(&self.patterns) .with_context(|| format!("failed to wait for service `{id}` to be ready"))?; ctx.complete_spin(); @@ -54,8 +60,7 @@ impl ExecuteContext where W: std::io::Write, { - fn wait_log_contains(&mut self, pattern: impl AsRef) -> anyhow::Result<()> { - let pattern = pattern.as_ref(); + fn wait_log_contains(&mut self, patterns: &[String]) -> anyhow::Result<()> { let log_path = self.log_path().to_path_buf(); let mut content = String::new(); @@ -68,11 +73,13 @@ where offset += file.read_to_string(&mut content)?; // Always going through the whole log file could be stupid, but it's reliable. - if content.contains(pattern) { - Ok(()) - } else { - bail!("pattern \"{}\" not found in log", pattern) + for pattern in patterns { + if !content.contains(pattern) { + bail!("pattern \"{}\" not found in log", pattern) + } } + + Ok(()) }, &mut self.log, self.status_file.as_ref().unwrap(),