Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3e8ac28

Browse files
committed
fsync() data and WAL files
1 parent 88b2742 commit 3e8ac28

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/data.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ backup_data_file(const char *from_root, const char *to_root,
357357
strerror(errno_tmp));
358358
}
359359

360+
fsync(fileno(out));
360361
fclose(in);
361362
fclose(out);
362363

@@ -470,6 +471,7 @@ restore_file_partly(const char *from_root,const char *to_root, pgFile *file)
470471
strerror(errno_tmp));
471472
}
472473

474+
fsync(fileno(out));
473475
fclose(in);
474476
fclose(out);
475477
}
@@ -605,6 +607,7 @@ restore_data_file(const char *from_root,
605607
strerror(errno_tmp));
606608
}
607609

610+
fsync(fileno(out));
608611
fclose(in);
609612
fclose(out);
610613
}
@@ -732,6 +735,7 @@ copy_file(const char *from_root, const char *to_root, pgFile *file)
732735
strerror(errno_tmp));
733736
}
734737

738+
fsync(fileno(out));
735739
fclose(in);
736740
fclose(out);
737741

@@ -832,9 +836,9 @@ copy_wal_file(const char *from_path, const char *to_path)
832836
strerror(errno_tmp));
833837
}
834838

839+
fsync(fileno(out));
835840
fclose(in);
836841
fclose(out);
837-
838842
}
839843

840844
/*
@@ -957,6 +961,7 @@ copy_file_partly(const char *from_root, const char *to_root,
957961
/* add meta information needed for recovery */
958962
file->is_partial_copy = true;
959963

964+
fsync(fileno(out));
960965
fclose(in);
961966
fclose(out);
962967

0 commit comments

Comments
 (0)