Homec4science

Fix an issue where migrating files could prematurely destroy duplicates

Authored by epriestley <git@epriestley.com> on Aug 21 2014, 00:32.

Description

Fix an issue where migrating files could prematurely destroy duplicates

Summary:
Fixes T5912. When migrating files, we try to clean up the old data. However, this code isn't aware of reference counting, and unconditionally destroys the old data.

For example, if you migrate files F1 and F2 and they have the same data, we'll delete the shared data when we migrate F1. Then you'll get an error when you migrate F2.

Since this only affects duplicate files, it primarily hits default profile pictures, which are the most numerous duplicate files on most installs.

Test Plan:

  • Verified that the theory was correct by uploading two copies of a file and migrating the first one, before applying the patch. The second one's data was nuked and it couldn't be migrated.
  • Applied patch.
  • Uploaded two copies of a new file, migrated the first one (no data deletion), migrated the second one (data correctly deleted).
  • Uploaded two copies of another new file, bin/remove destory'd the first one (no data deletion), then did it to the second one (data correctly deleted).

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5912

Differential Revision: https://secure.phabricator.com/D10312

Details

Committed
epriestley <git@epriestley.com>Aug 21 2014, 00:32
Pushed
aubortJan 31 2017, 17:16
Parents
rPHe5acdd85e681: When destroying an object, destroy its Herald transcripts too
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPH66fa59d04d7c: Fix an issue where migrating files could prematurely destroy duplicates (authored by epriestley <git@epriestley.com>).Aug 21 2014, 00:32