From eac04d7f10c7bfef6b1802c2f9f7e5e12ee93c5e Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Tue, 16 Mar 2021 11:26:48 +0200 Subject: [PATCH] Remove leftover duplicated code to start replication connection --- src/main.rs | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/src/main.rs b/src/main.rs index 62f091416e..3f4e54cf38 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,6 +4,8 @@ mod page_cache; mod walreader; mod walreceiver; +use std::io::Error; + fn main() -> Result<(), Error> { @@ -17,31 +19,5 @@ fn main() -> Result<(), Error> { handler.join(); // never returns. - let conninfo = "host=localhost port=65432 user=stas dbname=postgres"; - // form replication connection - let (mut rclient, rconnection) = - connect_replication(conninfo, NoTls, ReplicationMode::Physical).await?; - tokio::spawn(async move { - if let Err(e) = rconnection.await { - eprintln!("connection error: {}", e); - } - }); - let identify_system = rclient.identify_system().await?; - let mut physical_stream = rclient - .start_physical_replication(None, identify_system.xlogpos(), None) - .await?; - while let Some(replication_message) = physical_stream.next().await { - match replication_message? { - ReplicationMessage::XLogData(xlog_data) => { - // eprintln!("received XLogData: {:#?}", xlog_data); - eprintln!("received XLogData:"); - } - ReplicationMessage::PrimaryKeepAlive(keepalive) => { - // eprintln!("received PrimaryKeepAlive: {:#?}", keepalive); - eprintln!("received PrimaryKeepAlive:"); - } - _ => (), - } - } Ok(()) }