Skip to content

Commit

Permalink
Merge branch 'main' into branching_test
Browse files Browse the repository at this point in the history
  • Loading branch information
aome510 committed Jul 12, 2022
2 parents 9114620 + 5cf5970 commit cb2d408
Show file tree
Hide file tree
Showing 8 changed files with 291 additions and 107 deletions.
15 changes: 13 additions & 2 deletions pageserver/src/basebackup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ where
write: W,
timeline: &'a Arc<DatadirTimelineImpl>,
req_lsn: Option<Lsn>,
prev_lsn: Option<Lsn>,
full_backup: bool,
) -> Result<Basebackup<'a, W>> {
// Compute postgres doesn't have any previous WAL files, but the first
Expand Down Expand Up @@ -96,16 +97,26 @@ where
(end_of_timeline.prev, end_of_timeline.last)
};

// Consolidate the derived and the provided prev_lsn values
let prev_lsn = if let Some(provided_prev_lsn) = prev_lsn {
if backup_prev != Lsn(0) {
ensure!(backup_prev == provided_prev_lsn)
}
provided_prev_lsn
} else {
backup_prev
};

info!(
"taking basebackup lsn={}, prev_lsn={} (full_backup={})",
backup_lsn, backup_prev, full_backup
backup_lsn, prev_lsn, full_backup
);

Ok(Basebackup {
ar: Builder::new(AbortableWrite::new(write)),
timeline,
lsn: backup_lsn,
prev_record_lsn: backup_prev,
prev_record_lsn: prev_lsn,
full_backup,
finished: false,
})
Expand Down
2 changes: 2 additions & 0 deletions pageserver/src/import_datadir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pub fn import_timeline_from_postgres_datadir<R: Repository>(
if let Some(control_file) = import_file(&mut modification, relative_path, file, len)? {
pg_control = Some(control_file);
}
modification.flush()?;
}
}

Expand Down Expand Up @@ -317,6 +318,7 @@ pub fn import_basebackup_from_tar<R: Repository, Reader: Read>(
// We found the pg_control file.
pg_control = Some(res);
}
modification.flush()?;
}
tar::EntryType::Directory => {
debug!("directory {:?}", file_path);
Expand Down
Loading

0 comments on commit cb2d408

Please sign in to comment.