Add assertion

This commit is contained in:
Bojan Serafimov
2022-06-12 10:05:28 -04:00
parent 938100058d
commit 2283eb871a
2 changed files with 6 additions and 1 deletions

View File

@@ -495,7 +495,10 @@ pub fn import_wal_from_tar<R: Repository, Reader: Read>(
match header.entry_type() {
tar::EntryType::Regular => {
// TODO assert filename matches segno
// FIXME: assume postgresql tli 1 for now
let expected_filename = XLogFileName(1, segno, pg_constants::WAL_SEGMENT_SIZE);
let file_name = file_path.file_name().unwrap().to_string_lossy();
ensure!(expected_filename == file_name);
info!("processing wal file {:?}", file_path);
read_all_bytes(entry)?

View File

@@ -577,6 +577,8 @@ impl PageServerHandler {
let mut datadir_timeline = DatadirTimeline::<LayeredRepository>::new(
timeline, repartition_distance);
// TODO ensure start_lsn matches current lsn
// Import wal provided via CopyData
info!("importing wal");
pgb.write_message(&BeMessage::CopyInResponse)?;