Project

General

Profile

Actions

Patch #25590

closed

prevent deadlocks in attachment deduplication

Added by Jens Krämer over 7 years ago. Updated over 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 #1

Updated by Go MAEDA over 7 years ago

  • Related to Patch #25215: Re-use existing identical disk files for new attachments added
Actions #2

Updated by Go MAEDA over 7 years ago

  • Related to deleted (Patch #25215: Re-use existing identical disk files for new attachments)
Actions #3

Updated by Go MAEDA over 7 years ago

  • Blocks Patch #25215: Re-use existing identical disk files for new attachments added
Actions #4

Updated by Go MAEDA over 7 years ago

I reopened #25215. Thank you for sharing the patch.

Actions #5

Updated by Jean-Philippe Lang over 7 years ago

  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang

Committed.

Actions

Also available in: Atom PDF