swift/swift/obj
Alistair Coles aad02ad30d Fix race when consolidating new partition
Suffix hash invalidations in hashes.invalid can be lost when two
concurrent calls to get_hashes consolidate the hashes of a new
partition with no hashes.pkl:

- suffix S has been invalidated and is listed in hashes.invalid
- process X calls get_hashes when there is no existing hashes.pkl
- process X removes hashes.invalids file in consolidate_hashes
- process X calculates the hash of suffix S (note, process X has
  not yet written hashes.pkl)
- process Y invalidates suffix S, appends S to hashes.invalid, so the
  hash of suffix S *should* be recalculated at some point
- process Z calls get_hashes->consolidate_hashes, deletes hashes.invalid
  because there is still no hashes.pkl
- process Z fails
- process X writes hashes.pkl with stale hash value for suffix S
- the invalidation of S that was made by process Y is lost

The solution is to never remove hashes.invalid during consolidate_hashes
without first recording any invalid suffixes in hashes and writing hashes
to disk in hashes.pkl. This is already the behaviour when hashes.pkl
exists. The cost of an additional write to hashes.pkl, introduced by this
patch, is only incurred once, when get_hashes first encounters a
partition with no hashes.pkl.

Related-Change: Ia43ec2cf7ab715ec37f0044625a10aeb6420f6e3

Change-Id: I08c8cf09282f737103e580c1f57923b399abe58c
2017-05-15 12:24:01 -07:00
..
__init__.py Initial commit of Swift code 2010-07-12 17:03:45 -05:00
auditor.py Fix KeyError when auditor finds an expired object 2016-11-03 11:51:47 -07:00
diskfile.py Fix race when consolidating new partition 2017-05-15 12:24:01 -07:00
expirer.py Fix ValueError information in obj/expirer 2016-08-25 15:37:42 +08:00
mem_diskfile.py Merge "Follow up mem_server diskfile fixes" 2016-03-07 15:31:20 +00:00
mem_server.py Per-policy DiskFile classes 2015-04-14 00:52:16 -07:00
reconstructor.py Prevent ssync writing bad fragment data to diskfile 2016-10-17 10:44:13 +01:00
replicator.py Fix non-deterministic suffix updates in hashes.pkl 2016-12-02 13:43:01 +01:00
server.py Merge "Include object sysmeta in POST responses" 2016-09-21 18:24:43 +00:00
ssync_receiver.py Prevent ssync writing bad fragment data to diskfile 2016-10-17 10:44:13 +01:00
ssync_sender.py Prevent ssync writing bad fragment data to diskfile 2016-10-17 10:44:13 +01:00
updater.py Ensure update of the container by object-updater 2017-03-12 15:10:26 +01:00