HomeSoftware Heritage

objstorage: fix predictable tempfile race when adding objects
64a783216c1eUnpublished

Unpublished Commit · Learn More

Repository Importing: This repository is still importing.

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 Sep 30 2015, 2:51 PM
olasdPushed on Apr 19 2016, 4:59 PM
Parents
R65:e4feb0511258: upgrades/17.sql: add recent changes
Branches
Unknown
Tags
Unknown