Skip to content

Commit ddeb08a

Browse files
author
Konstantin Knizhnik
committed
Do not import AUX files while initializing fresh timeline from pgdatadir
1 parent 2773b6c commit ddeb08a

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

pageserver/src/import_datadir.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub async fn import_timeline_from_postgres_datadir(
7676
let mut file = tokio::fs::File::open(absolute_path).await?;
7777
let len = metadata.len() as usize;
7878
if let Some(control_file) =
79-
import_file(&mut modification, relative_path, &mut file, len, ctx).await?
79+
import_file(&mut modification, relative_path, &mut file, len, false, ctx).await?
8080
{
8181
pg_control = Some(control_file);
8282
}
@@ -364,8 +364,15 @@ pub async fn import_basebackup_from_tar(
364364

365365
match header.entry_type() {
366366
tokio_tar::EntryType::Regular => {
367-
if let Some(res) =
368-
import_file(&mut modification, file_path.as_ref(), &mut entry, len, ctx).await?
367+
if let Some(res) = import_file(
368+
&mut modification,
369+
file_path.as_ref(),
370+
&mut entry,
371+
len,
372+
true,
373+
ctx,
374+
)
375+
.await?
369376
{
370377
// We found the pg_control file.
371378
pg_control = Some(res);
@@ -489,6 +496,7 @@ async fn import_file(
489496
file_path: &Path,
490497
reader: &mut (impl AsyncRead + Send + Sync + Unpin),
491498
len: usize,
499+
import_aux_files: bool,
492500
ctx: &RequestContext,
493501
) -> Result<Option<ControlFileData>> {
494502
let file_name = match file_path.file_name() {
@@ -614,9 +622,10 @@ async fn import_file(
614622
// TODO Backups exported from neon won't have pg_tblspc, but we will need
615623
// this to import arbitrary postgres databases.
616624
bail!("Importing pg_tblspc is not implemented");
617-
} else if file_path.starts_with("pg_logical/")
618-
|| file_path.starts_with("pg_replslot/")
619-
|| file_path.starts_with("pg_stat/")
625+
} else if import_aux_files
626+
&& (file_path.starts_with("pg_logical/")
627+
|| file_path.starts_with("pg_replslot/")
628+
|| file_path.starts_with("pg_stat/"))
620629
{
621630
let bytes = read_all_bytes(reader).await?;
622631
modification

vendor/revisions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"v16": ["16.3", "9901875cd3a4b80709653998544215323e13ef2f"],
3-
"v15": ["15.7", "c421378a31ea74c0530e6e0f41af51498913a49b"],
2+
"v16": ["16.3", "d55e0aca104af0b611cf5565f1033b2acd2dcc1c"],
3+
"v15": ["15.7", "0640e6b24a7eb2b626a7432c0e2801840954429e"],
44
"v14": ["14.12", "7845c122d51d3ebb547a984a640ac0310a2fadce"]
55
}

0 commit comments

Comments
 (0)