[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Git][snapshot-team/snapshot][master] Try to sync data to disk when we import files into the farm



Title: GitLab

Peter Palfrader pushed to branch master at snapshot / snapshot

Commits:

  • fec4bfc7
    by Peter Palfrader at 2025-04-12T15:02:29+02:00
    Try to sync data to disk when we import files into the farm
    

1 changed file:

Changes:

  • snapshot
    ... ... @@ -92,7 +92,14 @@ class FileBackend < StorageBackend
    92 92
     			fn = File.basename(target)
    
    93 93
     
    
    94 94
     			tmptarget = dir+"/.tmp."+randstring()+"."+(Process.pid.to_s)+"."+fn
    
    95
    -			FileUtils.cp(source, tmptarget)
    
    95
    +			# copy with fdatasync
    
    96
    +			File.open(source) do |s|
    
    97
    +				File.open(tmptarget, 'wb') do |f|
    
    98
    +					IO.copy_stream(s, f)
    
    99
    +					f.fdatasync()
    
    100
    +				end
    
    101
    +			end
    
    102
    +
    
    96 103
     			begin
    
    97 104
     				File.link(tmptarget, target)
    
    98 105
     				add_to_journal(digest)
    


  • Reply to: