@@ -76,7 +76,7 @@ pub async fn import_timeline_from_postgres_datadir(
76
76
let mut file = tokio:: fs:: File :: open ( absolute_path) . await ?;
77
77
let len = metadata. len ( ) as usize ;
78
78
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 ?
80
80
{
81
81
pg_control = Some ( control_file) ;
82
82
}
@@ -364,8 +364,15 @@ pub async fn import_basebackup_from_tar(
364
364
365
365
match header. entry_type ( ) {
366
366
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 ?
369
376
{
370
377
// We found the pg_control file.
371
378
pg_control = Some ( res) ;
@@ -489,6 +496,7 @@ async fn import_file(
489
496
file_path : & Path ,
490
497
reader : & mut ( impl AsyncRead + Send + Sync + Unpin ) ,
491
498
len : usize ,
499
+ import_aux_files : bool ,
492
500
ctx : & RequestContext ,
493
501
) -> Result < Option < ControlFileData > > {
494
502
let file_name = match file_path. file_name ( ) {
@@ -614,9 +622,10 @@ async fn import_file(
614
622
// TODO Backups exported from neon won't have pg_tblspc, but we will need
615
623
// this to import arbitrary postgres databases.
616
624
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/" ) )
620
629
{
621
630
let bytes = read_all_bytes ( reader) . await ?;
622
631
modification
0 commit comments