[RTFACT-14083] During repository removal, remove repository entries from the database before removing the repo from the config descriptor Created: 13/Apr/17  Updated: 10/Feb/19  Resolved: 25/Apr/18

Status: Resolved
Project: Artifactory Binary Repository
Component/s: Artifact Storage, Configuration
Affects Version/s: 5.2.1
Fix Version/s: 6.2.0

Type: Improvement Priority: High
Reporter: Uriah Levy Assignee: Lior Gur (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relationship
relates to RTFACT-17216 Repository is not cleanly deleted is ... Open
relates to RTFACT-14106 Reverse the handling order of lock en... Resolved
relates to RTFACT-14102 Use more robust way to sync configura... Open
Assigned QA: Alex Dvorkin
Sprint: Leap 30, Leap 32, Leap 33, Leap 34

 Description   

Currently our repository removal process can be broken into two steps:

1.Remove the repository and the references of the repo from the config descriptor
2.Remove all the related entries from the database for the corresponding repo

This process is sometimes problematic. Occasionally, customers will attempt to delete a repo and the deletion will error out, leaving the repo references in the database (as if it wasn't removed), but the repo will not show in the repositories list (or on the config descriptor) since step #1 did actually complete.
The problem with this is that it is step #2 that is most prone to errors (i.e database errors, lock problems etc), and the one that usually fails.
Due to that, when a error occurs during the deletion, the server will be left in an inconsistent state with repos that will never be cleaned. The only way to complete the removal process is to remove the entries from the database directly.

If the step order was different, than the user could re-attempt to delete the repo following an error.



 Comments   
Comment by Alex Dvorkin [ 18/Jul/18 ]

Reopening the task.

Locked row for deletion

use artdb;
CREATE TABLE preserve_nodes (
  node_id BIGINT PRIMARY KEY,
  FOREIGN KEY (node_id) REFERENCES nodes (node_id)
);
INSERT INTO preserve_nodes (node_id) VALUES (10);

As a result, after delete in UI, the error popped, row remained in DB (artdb.nodes) but not in web UI grid

Generated at Tue Oct 22 19:01:42 UTC 2019 using JIRA 7.6.16#76018-sha1:9ed376192612a49536ac834c64177a0fed6290f5.