From dc780c9e1ea341af46508deaf3309007fab168ff Mon Sep 17 00:00:00 2001 From: Konstantin Knizhnik Date: Tue, 25 Jun 2024 19:07:39 +0300 Subject: [PATCH] Fix bug in including AUX files in basebacklup --- pageserver/ctl/src/key.rs | 1 + pageserver/src/import_datadir.rs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/pageserver/ctl/src/key.rs b/pageserver/ctl/src/key.rs index af4b5a21ab..c7f0719c41 100644 --- a/pageserver/ctl/src/key.rs +++ b/pageserver/ctl/src/key.rs @@ -345,6 +345,7 @@ impl AuxFileV2 { AuxFileV2::Recognized("pg_logical/replorigin_checkpoint", hash) } (2, 1) => AuxFileV2::Recognized("pg_replslot/", hash), + (3, 1) => AuxFileV2::Recognized("pg_stat/pgstat.stat", hash), (1, 0xff) => AuxFileV2::OtherWithPrefix("pg_logical/", hash), (0xff, 0xff) => AuxFileV2::Other(hash), _ => return None, diff --git a/pageserver/src/import_datadir.rs b/pageserver/src/import_datadir.rs index c061714010..270b1a8889 100644 --- a/pageserver/src/import_datadir.rs +++ b/pageserver/src/import_datadir.rs @@ -634,6 +634,15 @@ async fn import_file( // TODO Backups exported from neon won't have pg_tblspc, but we will need // this to import arbitrary postgres databases. bail!("Importing pg_tblspc is not implemented"); + } else if file_path.starts_with("pg_logical/") + || file_path.starts_with("pg_replslot/") + || file_path.starts_with("pg_stat/") + { + let bytes = read_all_bytes(reader).await?; + modification + .put_file(&file_path.to_str().unwrap(), &bytes, ctx) + .await?; + debug!("imported aux file \"{}\"", file_path.display()); } else { debug!( "ignoring unrecognized file \"{}\" in tar archive",