@@ -976,6 +976,7 @@ restore_data_file_new(parray *parent_chain, pgFile *dest_file, FILE *out, const
976
976
{
977
977
int i ;
978
978
size_t total_write_len = 0 ;
979
+ char buffer [65536 ];
979
980
980
981
for (i = parray_num (parent_chain ) - 1 ; i >= 0 ; i -- )
981
982
{
@@ -1018,6 +1019,8 @@ restore_data_file_new(parray *parent_chain, pgFile *dest_file, FILE *out, const
1018
1019
elog (INFO , "Cannot open backup file \"%s\": %s" , from_fullpath ,
1019
1020
strerror (errno ));
1020
1021
1022
+ setbuf (in , buffer );
1023
+
1021
1024
/*
1022
1025
* Restore the file.
1023
1026
* 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,
1195
1198
{
1196
1199
size_t read_len = 0 ;
1197
1200
int errno_tmp ;
1198
- char buf [BLCKSZ ];
1201
+ char buf [65536 ]; /* 64kB buffer */
1199
1202
1200
1203
/* copy content */
1201
1204
for (;;)
@@ -1257,6 +1260,7 @@ restore_non_data_file(parray *parent_chain, pgBackup *dest_backup,
1257
1260
1258
1261
pgFile * tmp_file = NULL ;
1259
1262
pgBackup * tmp_backup = NULL ;
1263
+ char buffer [65536 ];
1260
1264
1261
1265
/* Check if full copy of destination file is available in destination backup */
1262
1266
if (dest_file -> write_size > 0 )
@@ -1329,6 +1333,8 @@ restore_non_data_file(parray *parent_chain, pgBackup *dest_backup,
1329
1333
elog (ERROR , "Cannot open backup file \"%s\": %s" , from_fullpath ,
1330
1334
strerror (errno ));
1331
1335
1336
+ setbuf (in , buffer );
1337
+
1332
1338
/* do actual work */
1333
1339
restore_non_data_file_internal (in , out , tmp_file , from_fullpath , to_fullpath );
1334
1340
0 commit comments