HomeSoftware Heritage

objstorage: fix predictable tempfile race when adding objects

Description

objstorage: fix predictable tempfile race when adding objects

Before this change, two workers adding the same object will end up
racing to write <SHA1>.tmp. That should not lead to corruption, because
they are (in principle) going to write the exact same content, but it
made the one of the two that arrives last fail the final rename.

With this fix they will write in different <SHA1>.RANDOM_STUFF.tmp, and
then rename their own file into place.

Note that this change slightly increases the chances of having garbage
in the object store, so we will need to look for this during GC passes.

Details

Provenance
zackAuthored on
zackPushed on Sep 30 2015, 2:54 PM
Parents
rDSTOe4feb0511258: upgrades/17.sql: add recent changes
Branches
Unknown
Tags
Unknown