Project

General

Profile

Actions

Patch #25215

closed

Re-use existing identical disk files for new attachments

Added by Jens Krämer almost 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Category:
Attachments
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

Uploaded files can already be associated with multiple attachment records through Attachment#copy. This patch adds an after_create hook to change the disk_filename and disk_directory attributes of a newly created attachment to point to an already existing, identical (filesize and digest) diskfile if one exists.

Database locks are used to guard against the deletion of the older attachment while the reference of the new attachment is changed.

Usefulness of this feature (i.e. how much space is saved) will vary a lot depending on external circumstances of course (one large scale setup we maintain at Planio saved around 15% / 60GB). Since the possiblity to have 1:n relationships of disk files to attachments already exists it just seems logical to make use of it for new attachments as well.


Files


Related issues

Related to Redmine - Feature #19289: Exclude attachments from incoming emails based on file content or file hashNew

Actions
Related to Redmine - Feature #23510: Reuse an exist attachmentClosed

Actions
Has duplicate Redmine - Feature #15257: Attachment deduplicationClosed

Actions
Blocked by Redmine - Patch #25240: Use SHA256 for attachment digest computationClosedJean-Philippe Lang

Actions
Blocked by Redmine - Patch #25590: prevent deadlocks in attachment deduplicationClosedJean-Philippe Lang

Actions
Actions

Also available in: Atom PDF