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)
| 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`]. |
no test coverage detected