mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-01-07 13:40:17 +02:00
[Issue #169] Set stdio buffers to 64KB when running "restore"
This commit is contained in:
parent
7d78d501a5
commit
d6567a2d67
@ -976,6 +976,7 @@ restore_data_file_new(parray *parent_chain, pgFile *dest_file, FILE *out, const
|
||||
{
|
||||
int i;
|
||||
size_t total_write_len = 0;
|
||||
char buffer[65536];
|
||||
|
||||
for (i = parray_num(parent_chain) - 1; i >= 0; i--)
|
||||
{
|
||||
@ -1018,6 +1019,8 @@ restore_data_file_new(parray *parent_chain, pgFile *dest_file, FILE *out, const
|
||||
elog(INFO, "Cannot open backup file \"%s\": %s", from_fullpath,
|
||||
strerror(errno));
|
||||
|
||||
setbuf(in, buffer);
|
||||
|
||||
/*
|
||||
* Restore the file.
|
||||
* 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,
|
||||
{
|
||||
size_t read_len = 0;
|
||||
int errno_tmp;
|
||||
char buf[BLCKSZ];
|
||||
char buf[65536]; /* 64kB buffer */
|
||||
|
||||
/* copy content */
|
||||
for (;;)
|
||||
@ -1257,6 +1260,7 @@ restore_non_data_file(parray *parent_chain, pgBackup *dest_backup,
|
||||
|
||||
pgFile *tmp_file = NULL;
|
||||
pgBackup *tmp_backup = NULL;
|
||||
char buffer[65536];
|
||||
|
||||
/* Check if full copy of destination file is available in destination backup */
|
||||
if (dest_file->write_size > 0)
|
||||
@ -1329,6 +1333,8 @@ restore_non_data_file(parray *parent_chain, pgBackup *dest_backup,
|
||||
elog(ERROR, "Cannot open backup file \"%s\": %s", from_fullpath,
|
||||
strerror(errno));
|
||||
|
||||
setbuf(in, buffer);
|
||||
|
||||
/* do actual work */
|
||||
restore_non_data_file_internal(in, out, tmp_file, from_fullpath, to_fullpath);
|
||||
|
||||
|
@ -775,6 +775,7 @@ restore_files_new(void *arg)
|
||||
int i;
|
||||
char to_fullpath[MAXPGPATH];
|
||||
FILE *out = NULL;
|
||||
char buffer[65536];
|
||||
|
||||
restore_files_arg_new *arguments = (restore_files_arg_new *) arg;
|
||||
|
||||
@ -857,6 +858,9 @@ restore_files_new(void *arg)
|
||||
to_fullpath, strerror(errno_tmp));
|
||||
}
|
||||
|
||||
if (!fio_is_remote_file(out))
|
||||
setbuf(out, buffer);
|
||||
|
||||
if (!dest_file->is_datafile || dest_file->is_cfs)
|
||||
elog(VERBOSE, "Restoring non-data file: \"%s\"", to_fullpath);
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user