Patch #25590
closedprevent deadlocks in attachment deduplication
0%
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
Updated by Go MAEDA over 7 years ago
- Related to Patch #25215: Re-use existing identical disk files for new attachments added
Updated by Go MAEDA over 7 years ago
- Related to deleted (Patch #25215: Re-use existing identical disk files for new attachments)
Updated by Go MAEDA over 7 years ago
- Blocks Patch #25215: Re-use existing identical disk files for new attachments added
Updated by Go MAEDA over 7 years ago
I reopened #25215. Thank you for sharing the patch.
Updated by Jean-Philippe Lang over 7 years ago
- Status changed from New to Closed
- Assignee set to Jean-Philippe Lang
Committed.