MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / wait_for_ready

Method wait_for_ready

src/sql-server-util/src/cdc.rs:420–430  ·  view source on GitHub ↗

If CDC was recently enabled on an instance of SQL Server then it will report `NULL` for the minimum LSN of a capture instance and/or the maximum LSN of the entire database. This method runs a retry loop that waits for the upstream DB to report good values. It should be called before taking the initial [`CdcStream::snapshot`] to ensure the system is ready to proceed with CDC.

(&mut self)

Source from the content-addressed store, hash-verified

418 /// values. It should be called before taking the initial [`CdcStream::snapshot`]
419 /// to ensure the system is ready to proceed with CDC.
420 pub async fn wait_for_ready(&mut self) -> Result<(), SqlServerError> {
421 // Ensure all of the capture instances are reporting an LSN.
422 for instance in self.capture_instances.keys() {
423 crate::inspect::get_min_lsn_retry(self.client, instance, self.max_lsn_wait).await?;
424 }
425
426 // Ensure the database is reporting a max LSN.
427 crate::inspect::get_max_lsn_retry(self.client, self.max_lsn_wait).await?;
428
429 Ok(())
430 }
431}
432
433/// A change event from a [`CdcStream`].

Callers 2

mainFunction · 0.80
renderFunction · 0.80

Calls 3

get_min_lsn_retryFunction · 0.85
get_max_lsn_retryFunction · 0.85
keysMethod · 0.45

Tested by

no test coverage detected