gigascience / gigadb-website

Source code for running GigaDB
http://gigadb.org
GNU General Public License v3.0
9 stars 15 forks source link

It takes a long time to delete a file #2042

Closed rija closed 1 week ago

rija commented 1 month ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://gigadb.org/adminFile/admin
  2. Click on the delete icon for a file
  3. See a spinning wheel
  4. Wait a long time for the file row to disappear and for the spinning wheel to stop

Expected behavior The file entry should be removed promptly

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context this behaviour seem to have appeared with the merge of PR #2017 that fixes #2015.

my intuition tells me it's related to Postgresql indexes and the database transaction that wraps the deletion of the associated entries from the file_attributes table and then of the row in the file table.

alli83 commented 1 month ago

@rija it's something I noticed while fixing the problem. there is definitely some code that needs to be reworked. On this ticket, no substantial changes on the old code. Given that a new ticket should be assigned, I didn't fix it in this #2017 PR. the different for loop should be avoided because a a delete is triggered for each relation atm (n+1).

I have another PR with deleteAll executing a single SQL delete instead of the foreach.

rija commented 1 week ago

Fixed in PR #2043