613613do_catchup (const char * source_pgdata , const char * dest_pgdata , int num_threads , bool sync_dest_files ,
614614 parray * exclude_absolute_paths_list , parray * exclude_relative_paths_list )
615615{
616+ pioDrive_i local_location = pioDriveForLocation (FIO_LOCAL_HOST );
616617 PGconn * source_conn = NULL ;
617618 PGNodeInfo source_node_info ;
618619 bool backup_logs = false;
@@ -632,6 +633,8 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
632633 ssize_t transfered_datafiles_bytes = 0 ;
633634 ssize_t transfered_walfiles_bytes = 0 ;
634635 char pretty_source_bytes [20 ];
636+ err_i err = $noerr ();
637+
635638
636639 source_conn = catchup_init_state (& source_node_info , source_pgdata , dest_pgdata );
637640 catchup_preflight_checks (& source_node_info , source_conn , source_pgdata , dest_pgdata );
@@ -704,7 +707,12 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
704707 join_path_components (dest_xlog_path , dest_pgdata , PG_XLOG_DIR );
705708 if (!dry_run )
706709 {
707- fio_mkdir (FIO_LOCAL_HOST , dest_xlog_path , DIR_PERMISSION , false);
710+ err = $i (pioMakeDir , local_location , .path = dest_xlog_path ,
711+ .mode = DIR_PERMISSION , .strict = false);
712+ if ($haserr (err ))
713+ {
714+ elog (ERROR , "Can not create WAL directory: %s" , $errmsg (err ));
715+ }
708716 start_WAL_streaming (source_conn , dest_xlog_path , & instance_config .conn_opt ,
709717 current .start_lsn , current .tli , false);
710718 }
@@ -820,7 +828,14 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
820828
821829 elog (LOG , "Create directory '%s'" , dirpath );
822830 if (!dry_run )
823- fio_mkdir (FIO_LOCAL_HOST , dirpath , DIR_PERMISSION , false);
831+ {
832+ err = $i (pioMakeDir , local_location , .path = dirpath ,
833+ .mode = DIR_PERMISSION , .strict = false);
834+ if ($haserr (err ))
835+ {
836+ elog (ERROR , "Can not create directory: %s" , $errmsg (err ));
837+ }
838+ }
824839 }
825840 else
826841 {
@@ -854,9 +869,13 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
854869 if (!dry_run )
855870 {
856871 /* create tablespace directory */
857- if (fio_mkdir (FIO_LOCAL_HOST , linked_path , file -> mode , false) != 0 )
858- elog (ERROR , "Could not create tablespace directory \"%s\": %s" ,
859- linked_path , strerror (errno ));
872+ err = $i (pioMakeDir , local_location , .path = linked_path ,
873+ .mode = file -> mode , .strict = false);
874+ if ($haserr (err ))
875+ {
876+ elog (ERROR , "Could not create tablespace directory \"%s\": \"%s\"" ,
877+ linked_path , $errmsg (err ));
878+ }
860879
861880 /* create link to linked_path */
862881 if (fio_symlink (FIO_LOCAL_HOST , linked_path , to_path , true) < 0 )
0 commit comments