@@ -976,6 +976,7 @@ restore_data_file_new(parray *parent_chain, pgFile *dest_file, FILE *out, const
976976{
977977 int i ;
978978 size_t total_write_len = 0 ;
979+ char buffer [65536 ];
979980
980981 for (i = parray_num (parent_chain ) - 1 ; i >= 0 ; i -- )
981982 {
@@ -1018,6 +1019,8 @@ restore_data_file_new(parray *parent_chain, pgFile *dest_file, FILE *out, const
10181019 elog (INFO , "Cannot open backup file \"%s\": %s" , from_fullpath ,
10191020 strerror (errno ));
10201021
1022+ setbuf (in , buffer );
1023+
10211024 /*
10221025 * Restore the file.
10231026 * Datafiles are backed up block by block and every block
@@ -1195,7 +1198,7 @@ restore_non_data_file_internal(FILE *in, FILE *out, pgFile *file,
11951198{
11961199 size_t read_len = 0 ;
11971200 int errno_tmp ;
1198- char buf [BLCKSZ ];
1201+ char buf [65536 ]; /* 64kB buffer */
11991202
12001203 /* copy content */
12011204 for (;;)
@@ -1257,6 +1260,7 @@ restore_non_data_file(parray *parent_chain, pgBackup *dest_backup,
12571260
12581261 pgFile * tmp_file = NULL ;
12591262 pgBackup * tmp_backup = NULL ;
1263+ char buffer [65536 ];
12601264
12611265 /* Check if full copy of destination file is available in destination backup */
12621266 if (dest_file -> write_size > 0 )
@@ -1329,6 +1333,8 @@ restore_non_data_file(parray *parent_chain, pgBackup *dest_backup,
13291333 elog (ERROR , "Cannot open backup file \"%s\": %s" , from_fullpath ,
13301334 strerror (errno ));
13311335
1336+ setbuf (in , buffer );
1337+
13321338 /* do actual work */
13331339 restore_non_data_file_internal (in , out , tmp_file , from_fullpath , to_fullpath );
13341340
0 commit comments