Stop recursing now that derivation deletion selection is smarter
As this probably won't help with performance.
This commit is contained in:
parent
47af6c9661
commit
d844b325e2
1 changed files with 9 additions and 32 deletions
|
|
@ -389,42 +389,19 @@ DELETE FROM derivation_output_details_sets
|
||||||
WHERE id = $1"
|
WHERE id = $1"
|
||||||
(list derivation-output-details-set-id)))))))
|
(list derivation-output-details-set-id)))))))
|
||||||
|
|
||||||
(let ((input-derivations
|
(exec-query
|
||||||
(map car
|
conn
|
||||||
(exec-query
|
"
|
||||||
conn
|
|
||||||
"
|
|
||||||
SELECT DISTINCT derivations.id
|
|
||||||
FROM derivations
|
|
||||||
WHERE derivations.id IN (
|
|
||||||
SELECT derivation_outputs.derivation_id
|
|
||||||
FROM derivation_outputs
|
|
||||||
INNER JOIN derivation_inputs
|
|
||||||
ON derivation_outputs.id = derivation_inputs.derivation_output_id
|
|
||||||
WHERE derivation_inputs.derivation_id = $1
|
|
||||||
)"
|
|
||||||
(list id)))))
|
|
||||||
|
|
||||||
(exec-query
|
|
||||||
conn
|
|
||||||
"
|
|
||||||
DELETE FROM derivation_inputs WHERE derivation_id = $1"
|
DELETE FROM derivation_inputs WHERE derivation_id = $1"
|
||||||
(list id))
|
(list id))
|
||||||
|
|
||||||
(exec-query
|
(exec-query
|
||||||
conn
|
conn
|
||||||
"
|
"
|
||||||
DELETE FROM derivations WHERE id = $1"
|
DELETE FROM derivations WHERE id = $1"
|
||||||
(list id))
|
(list id))
|
||||||
|
|
||||||
;; Look at the inputs to see if they can be deleted too, as one of
|
1)))
|
||||||
;; the derivations that was using them has now been deleted.
|
|
||||||
(fold
|
|
||||||
(lambda (id result)
|
|
||||||
(+ result
|
|
||||||
(maybe-delete-derivation conn id)))
|
|
||||||
1
|
|
||||||
input-derivations)))))
|
|
||||||
|
|
||||||
(with-postgresql-connection
|
(with-postgresql-connection
|
||||||
"data-deletion"
|
"data-deletion"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue