Project

General

Profile

Actions

Bug #18339

closed

SweepTrashedObjects scaling issues

Added by Peter Amstutz about 3 years ago. Updated about 3 years ago.

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

Description

Customer reported problem in which a large number of projects, which had been trashed two weeks previously, became eligible for deletion all at once, and the resulting sweep processes crushed the database.

  1. If the last sweep hasn't finished, currently it starts a new, overlapping sweep operation. Instead, it should probably do something like try to take a lock (perhaps by on a empty, special-purpose table), and then if it can't acquire the lock, don't do anything (it checks the sweep task periodically, so it'll eventually run again when lock is no longer held).
  2. The default value for TrashSweepInterval is 60s. Deleting trashed projects is a very low priority process, so the default interval could be much lower (eg 5m or 15m or 60m)
  3. The delete operations should run in a transaction, to reduce overhead from auto-commit. Although, if it takes any locks they will be held for the duration of the transaction.
  4. Destroying a group also destroys any permission links pointing to it. Ruby on Rails is running the before_destroy hook for the permission link, which does an update_permissions operation, which takes the table lock on materialized_permissions. We can set Thread.current[:suppress_update_permissions] = true to prevent permissions from being recomputed, we just need to be confident that direct updates to the permission table are correct.

Subtasks 1 (0 open1 closed)

Task #18357: Review 18339-sweep-trash-lockResolvedTom Clegg11/16/2021Actions

Related issues 1 (1 open0 closed)

Related to Arvados - Bug #18762: rails background tasks scaling issuesNewActions
Actions

Also available in: Atom PDF