Project

General

Profile

Actions

Bug #21290

closed

sync_past_versions is too slow

Added by Peter Amstutz about 1 year ago. Updated 12 months ago.

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

Description

If a collection has a very large number of past versions (in this case, 2000), operations involving sync_past_versions (moving, trashing) will time out.

The current implementation loads each record, updates attributes, and saves it back.

We probably want to update the fields directly with SQL UPDATE.

The fields that get synchronized are:

['uuid', 'owner_uuid', 'delete_at', 'trash_at', 'is_trashed', 'replication_desired', 'storage_classes_desired']

Subtasks 1 (0 open1 closed)

Task #21337: Review 21290-sync-past-versionsResolvedPeter Amstutz01/03/2024Actions
Actions #1

Updated by Peter Amstutz about 1 year ago

  • Description updated (diff)
Actions #2

Updated by Peter Amstutz 12 months ago

  • Assigned To set to Peter Amstutz
Actions #4

Updated by Peter Amstutz 12 months ago

21290-sync-past-versions @ f7434a49187a0e429b77c45fadcbaa5413434cfc

developer-run-tests: #3986

  • All agreed upon points are implemented / addressed.
    • yes
  • Anything not implemented (discovered or discussed during work) has a follow-up story.
    • n/a
  • Code is tested and passing, both automated and manual, what manual testing was done is described
    • passes tests
  • Documentation has been updated.
    • n/a
  • Behaves appropriately at the intended scale (describe intended scale).
    • Should greatly improve performance of operations that require synchronizing changes to old versions of a collection, as this is now a single UPDATE operation instead of loading, updating, and saving each record individually.
  • Considered backwards and forwards compatibility issues between client and server.
    • n/a
  • Follows our coding standards and GUI style guidelines.
    • yes

Turns out there's an ActiveRecord method called update_all that does exactly what we want, so this is a very simple fix.

Actions #5

Updated by Peter Amstutz 12 months ago

  • Status changed from New to In Progress
Actions #6

Updated by Tom Clegg 12 months ago

LGTM

Actions #7

Updated by Peter Amstutz 12 months ago

  • Status changed from In Progress to Resolved
Actions #8

Updated by Peter Amstutz 12 months ago

  • Release set to 69
Actions

Also available in: Atom PDF