Project

General

Profile

Actions

Bug #14405

open

[API] Avoid long-running transactions when sweeping trashed objects

Added by Tom Clegg about 6 years ago. Updated 10 months ago.

Status:
New
Priority:
Normal
Assigned To:
-
Category:
API
Target version:
Story points:
-
Release:
Release relationship:
Auto

Description

The trash-sweep code in source:services/api/lib/sweep_trashed_objects.rb can land in a state where the database spends a lot of time/memory trying, but no progress is made.

Contributing factors:
  • sweep_if_stale calls sweep_now approximately every trash_sweep_interval seconds, even if the last call to sweep_now is still running. (This should be fixed: only one sweep should run at a time.)
  • sweep_now runs queries that can affect an unbounded number of rows because there is no batch size limit. (There should be a configurable batch size.)
  • sweep_now runs 5 of these queries each time. It's not clear from the code whether these all share a single transaction, but if they do, it's a big transaction, and the transaction isolation isn't needed. (These statements are independent of one another and should be done with autocommit on to avoid unnecessary transaction overhead.)
Actions #1

Updated by Tom Clegg about 6 years ago

  • Category set to API
  • Target version set to To Be Groomed
Actions #2

Updated by Peter Amstutz over 3 years ago

  • Target version deleted (To Be Groomed)
Actions #3

Updated by Peter Amstutz almost 2 years ago

  • Release set to 60
Actions #4

Updated by Peter Amstutz 10 months ago

  • Target version set to Future
Actions

Also available in: Atom PDF