On Fri, Aug 30, 2013 at 7:17 PM, Duy Nguyen <pclouds@xxxxxxxxx> wrote: > OK how about a new capability "resume" to upload-pack. fetch-pack can > then send capability "resume[=<SHA-1>,<skip>]" to upload-pack. The > first time it sends "resume" without parameters, and upload-pack will > send back an SHA-1 to identify the pack being transferred together > with a full pack as usual. When early disconnection happens, it sends > the received SHA-1 and the received pack's size so far. It either > receives the remaining part, or a full pack. > > When upload-pack gets "resume", it calculates a checksum of all input > that may impact pack generation. If the checksum matches the SHA-1 > from fetch-pack, it'll continue to generate the pack as usual, but > will skip sending the first <skip> bytes (maybe with a fake header so > that fetch-pack realizes this is a partial pack). If the checksum does > not match, it sends full pack again. I count on index-pack to spot > corrupt resumed pack due to bugs. > > The input to calculate SHA-1 checksum includes: > > - the result SHA-1 list from rev-list > - git version string > - .git/shallow > - replace object database > - pack.* config > - maybe some other variables (I haven't checked pack-objects) should have tested something first before I wrote. --threads adds some randomness to pack generation so it has to be --threads=1. Not sure if git repository hosts are happy with it.. > Another Git implementation can generate this SHA-1 in a totally > different way and may even cache the generated pack. > > If at resume time, the load balancer directs the request to another > upload-pack that generates this SHA-1 differently, ok this won't work > (i.e. full pack is returned). In a busy repository, some refs may have > moved so rev-list result at the resume time won't match any more, but > we can deal with that later by relaxing to allow "want " lines with > SHA-1 that are reachable from current refs, not just one of the refs > (pack v4 or reachability bitmaps help). > -- > Duy -- Duy -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html