| author | |
| committer | |
| log | 627a292a1139c96f5de80084ab5ce8b852db5132 |
| tree | 581042caea1a1957a8df5f2b85a8662b32c3cdaf |
| parent | 1a15fbe9607c74096c875f6d871213c7d4db1483 |
fsync blocks until the contents have been actually written to disk,
which would be useful if we didn't want to report success until having
achieved durability. But the OS will ensure coherency; i.e. if one
process writes stuff without calling fsync, then another process reads
that stuff, the writes will be seen even if they didn't get flushed to
disk yet.
Since this code deals with ephemeral cache data, it's not worth trying
to achieve this kind of durability guarantee. This is consistent with
all the other tooling on the system.
Certainly, if we wanted to change our stance on this, it would not be
something that affects only the git fetching logic.2 files changed, 0 insertions(+), 4 deletions(-)
src/Package/Fetch.zig-2| ... | ... | @@ -1386,7 +1386,6 @@ fn unpackGitPack(f: *Fetch, out_dir: fs.Dir, resource: *Resource.Git) anyerror!U |
| 1386 | 1386 | defer pack_file.close(); |
| 1387 | 1387 | var fifo = std.fifo.LinearFifo(u8, .{ .Static = 4096 }).init(); |
| 1388 | 1388 | try fifo.pump(resource.fetch_stream.reader(), pack_file.deprecatedWriter()); |
| 1389 | try pack_file.sync(); | |
| 1390 | 1389 | |
| 1391 | 1390 | var index_file = try pack_dir.createFile("pkg.idx", .{ .read = true }); |
| 1392 | 1391 | defer index_file.close(); |
| ... | ... | @@ -1396,7 +1395,6 @@ fn unpackGitPack(f: *Fetch, out_dir: fs.Dir, resource: *Resource.Git) anyerror!U |
| 1396 | 1395 | var index_buffered_writer = std.io.bufferedWriter(index_file.deprecatedWriter()); |
| 1397 | 1396 | try git.indexPack(gpa, object_format, pack_file, index_buffered_writer.writer()); |
| 1398 | 1397 | try index_buffered_writer.flush(); |
| 1399 | try index_file.sync(); | |
| 1400 | 1398 | } |
| 1401 | 1399 | |
| 1402 | 1400 | { |
src/Package/Fetch/git.zig-2| ... | ... | @@ -238,7 +238,6 @@ pub const Repository = struct { |
| 238 | 238 | }; |
| 239 | 239 | defer file.close(); |
| 240 | 240 | try file.writeAll(file_object.data); |
| 241 | try file.sync(); | |
| 242 | 241 | }, |
| 243 | 242 | .symlink => { |
| 244 | 243 | try repository.odb.seekOid(entry.oid); |
| ... | ... | @@ -1690,7 +1689,6 @@ pub fn main() !void { |
| 1690 | 1689 | var index_buffered_writer = std.io.bufferedWriter(index_file.deprecatedWriter()); |
| 1691 | 1690 | try indexPack(allocator, format, pack_file, index_buffered_writer.writer()); |
| 1692 | 1691 | try index_buffered_writer.flush(); |
| 1693 | try index_file.sync(); | |
| 1694 | 1692 | |
| 1695 | 1693 | std.debug.print("Starting checkout...\n", .{}); |
| 1696 | 1694 | var repository = try Repository.init(allocator, format, pack_file, index_file); |