Task #13239

Improve deletion of nested set hierarchies (specially terms)

Added by José Raddaoui Marín 9 months ago. Updated 5 months ago.

Status:VerifiedStart date:01/13/2020
Priority:MediumDue date:
Assignee:-% Done:

0%

Category:Data model / ORM
Target version:Release 2.6.0
Google Code Legacy ID: Tested version:
Sponsored:No Requires documentation:

Description

Similar to the fix added for archival descriptions on #13211, we could avoid several nested set updates while deleting a resource with multiple descendants. For example, on term deletions:

https://github.com/artefactual/atom/blob/stable/2.5.x/apps/qubit/modules/term/actions/deleteAction.class.php#L48-L54

Ideally, we would add the fix from #13211 to the model objects builder for objects with a nested set implementation. In addition to that, we should run those deletions inside a database transaction, which is already the case in a web request but not in places like the delete description task:

https://github.com/artefactual/atom/blob/stable/2.5.x/lib/task/tools/deleteDescriptionTask.class.php#L145


Related issues

Related to Access to Memory (AtoM) - Bug #13211: The deletion of archival descriptions with a lot of desce... Verified 11/13/2019
Related to Access to Memory (AtoM) - Task #13224: Improve hierarchy management queries Verified 12/09/2019
Related to Access to Memory (AtoM) - Task #10306: Improve foreign key declarations in database schema Verified 09/14/2016

History

#1 Updated by José Raddaoui Marín 9 months ago

  • Related to Bug #13211: The deletion of archival descriptions with a lot of descendants is prone to web server timeouts added

#2 Updated by José Raddaoui Marín 9 months ago

  • Related to Task #13224: Improve hierarchy management queries added

#3 Updated by José Raddaoui Marín 6 months ago

See notes about parent_id and ON DELETE CASCADE in description of #10306 for better improvements.

#4 Updated by José Raddaoui Marín 6 months ago

  • Related to Task #10306: Improve foreign key declarations in database schema added

#5 Updated by José Raddaoui Marín 5 months ago

  • Status changed from New to Code Review
  • Assignee set to Steve Breker
  • Target version set to Release 2.6.0

Ready for code review in https://github.com/artefactual/atom/pull/1102.

In the end, to trust the ON DELETE action for this deletions we would need to change a lot of the deletion code (related resources updates, assets removal) and the benefits of using deleting by query in ES are not that high considering we use batch requests and that they are quite fast.

So this changes only normalize de deletion of terms and information objects, following the fix implemented in #13211.

#6 Updated by José Raddaoui Marín 5 months ago

To test this changes, we should check the deletion of terms and descriptions with descendants, from the GUI and also using the delete description task. Additionally, the term's delete page will only show a few descendants now (it was showing links for all before), like the description page does, based on the items per page setting value.

#7 Updated by José Raddaoui Marín 5 months ago

  • Status changed from Code Review to QA/Review
  • Assignee changed from Steve Breker to Dan Gillean

Merged in qa/2.6.x.

#8 Updated by Dan Gillean 5 months ago

  • Status changed from QA/Review to Verified
  • Assignee deleted (Dan Gillean)

Term deletion is definitely faster! Deleted a deep hierarchy of places that used to time out my browser in 21 seconds :D

Also available in: Atom PDF