Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .cargo/audit.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[advisories]
ignore = [
"RUSTSEC-2023-0071",
"RUSTSEC-2026-0001"
"RUSTSEC-2023-0071"
]

62 changes: 31 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ thiserror = "2.0.12"
lazy_static = "1.5"
tracing = "0.1.41"
tracing-subscriber = { version = "0.3.20", features = ["env-filter"] }
pg_walstream = "0.3.0"
tiberius = { version = "0.12", features = ["tds73", "sql-browser-tokio", "bigdecimal", "rust_decimal", "time", "chrono"] }
pg_walstream = "0.4.0"
tiberius = { version = "0.12.3", features = ["tds73", "sql-browser-tokio", "bigdecimal", "rust_decimal", "time", "chrono"] }
sqlx = { version = "0.8.6", features = ["runtime-tokio-rustls", "mysql", "sqlite", "chrono", "uuid"] }
flate2 = "1.1.5"
async-compression = { version = "0.4.37", features = ["tokio", "gzip"] }
Expand Down
8 changes: 7 additions & 1 deletion pg2any-lib/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,11 +514,17 @@ impl TableMapping {
/// Convert from CDC config to replication stream config
impl From<&Config> for pg_walstream::ReplicationStreamConfig {
fn from(config: &Config) -> Self {
let streaming_mode = if config.streaming {
pg_walstream::StreamingMode::On
} else {
pg_walstream::StreamingMode::Off
};

pg_walstream::ReplicationStreamConfig::new(
config.replication_slot_name.clone(),
config.publication_name.clone(),
config.protocol_version,
config.streaming,
streaming_mode,
config.heartbeat_interval,
config.connection_timeout,
Duration::from_secs(30), // Health check interval
Expand Down
17 changes: 12 additions & 5 deletions pg2any-lib/src/monitoring/metrics_abstraction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ mod real_metrics {
use super::*;
use crate::monitoring::metrics::*; // Import the static metrics
use crate::types::EventType;
use std::borrow::Cow;
use std::sync::atomic::{AtomicU64, Ordering};
use std::time::{Duration, Instant};
use tracing::{debug, warn};
Expand Down Expand Up @@ -185,16 +186,22 @@ mod real_metrics {
// Track by event type and table
let event_type = event.event_type_str();
// Extract table name from event type
let table_name = match &event.event_type {
let table_name: Cow<'_, str> = match &event.event_type {
EventType::Insert { table, .. }
| EventType::Update { table, .. }
| EventType::Delete { table, .. } => table.as_str(),
EventType::Truncate(tables) => &tables.join(","),
_ => "unknown",
| EventType::Delete { table, .. } => Cow::Borrowed(table.as_ref()),
EventType::Truncate(tables) => Cow::Owned(
tables
.iter()
.map(|t| t.as_ref())
.collect::<Vec<&str>>()
.join(","),
),
_ => Cow::Borrowed("unknown"),
};

EVENTS_BY_TYPE
.with_label_values(&[event_type, table_name])
.with_label_values(&[event_type, &table_name])
.inc();

// Update LSN
Expand Down
4 changes: 3 additions & 1 deletion pg2any-lib/src/pg_replication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ impl ReplicationStream {
.await
.map_err(|e| crate::error::CdcError::Replication(e))?;

self.logical_stream.state.update_lsn(event.lsn.value());
self.logical_stream
.state
.update_applied_lsn(event.lsn.value());

Ok(event)
}
Expand Down
Loading