mirror of
https://github.com/neondatabase/neon.git
synced 2026-10-19 10:13:08 +00:00
Add xlogoff
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
use std::fs::File;
|
||||
use anyhow::Result;
|
||||
use postgres_ffi::waldecoder::WalStreamDecoder;
|
||||
use postgres_ffi::{pg_constants::WAL_SEGMENT_SIZE, waldecoder::WalStreamDecoder};
|
||||
use utils::lsn::Lsn;
|
||||
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
let partial_path = "/home/bojan/tmp/pg_wal/000000010000000000000017";
|
||||
let startpos = Lsn(0);
|
||||
let bytes = std::fs::read(partial_path)?;
|
||||
let partial_path = "/home/bojan/tmp/sk_wal";
|
||||
let startpos = Lsn(23761464); // I got this by grepping sk log for "restart decoder"
|
||||
let xlogoff: usize = startpos.segment_offset(WAL_SEGMENT_SIZE);
|
||||
|
||||
let mut decoder = WalStreamDecoder::new(startpos);
|
||||
decoder.feed_bytes(&bytes);
|
||||
let bytes = std::fs::read(partial_path)?;
|
||||
decoder.feed_bytes(&bytes[xlogoff..]);
|
||||
|
||||
while let Some((lsn, rec)) = decoder.poll_decode()? {
|
||||
println!("lsn: {}", lsn);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user