Project

General

Profile

Actions

Patch #25590

closed

prevent deadlocks in attachment deduplication

Added by Jens Krämer about 7 years ago. Updated about 7 years ago.

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

0%

Estimated time:

Description

At Planio we encountered occasional deadlocks caused by the inner lock statement on the query selecting a potentially already existing identical attachment. Running the query without lock first and locking the found record second solved the problem for us.

To account for the possible failure of the inner lock (i.e. when existing was found but cannot be locked) this patch also adds a rescue clause that silently ignores such errors. Deduplication did not happen in this case either because the duplicate was removed (then a retry would be useless) or the database aborted the transaction (deadlock or waited too long for the lock, a retry might work but I'm not sure it's worth it).


Files


Related issues

Blocks Redmine - Patch #25215: Re-use existing identical disk files for new attachmentsClosedJean-Philippe Lang

Actions
Actions

Also available in: Atom PDF