• Sean McGivern's avatar
    Only fetch repo once on secondary after push · 2aef8c6e
    Sean McGivern authored
    Currently, after a push we trigger the 'push' system hook on the
    secondary for every ref. This hook performs `git fetch primary
    --force`. When a repository with a large number of local refs is pushed
    for the first time, git will then try to fetch the entire repository
    once for every ref, generating a large amount of network and disk usage
    for the temporary packfiles used during the fetch process.
    
    In addition to this, if a fetch fails in the
    `GeoRepositoryUpdateWorker`, its temporary packfile will remain present
    until the next GC run.
    
    To work around this, define a new 'fetch' hook type. Fake the system
    hooks so that this is only called for secondary Geo nodes. Then remove
    the fetching from the per-ref update step, and explicitly call the hook
    once per push instead.
    
    This means that there is a risk the update step will happen before the
    fetch is finished, but it does stop the disk usage problem.
    2aef8c6e
post_receive.rb 2.5 KB