Skip dropping the log part sequence if there's a lock

So that the job completes. The sequence can be deleted later.
This commit is contained in:
Christopher Baines 2022-02-21 13:02:57 +00:00
parent a0a7d66b1d
commit 4a9d45aa16

View file

@ -300,11 +300,22 @@ WHERE job_id = $1")
(list job-id)))))
(define (drop-log-parts-sequence conn job-id)
(exec-query
(with-postgresql-transaction
conn
(string-append
"DROP SEQUENCE IF EXISTS "
(log-part-sequence-name job-id))))
(lambda (conn)
(exec-query conn
"SET LOCAL lock_timeout = '10s'")
(with-exception-handler
(lambda (exn)
(simple-format (current-error-port)
"error when dropping sequence: ~A"
exn))
(lambda ()
(exec-query conn
(string-append
"DROP SEQUENCE IF EXISTS "
(log-part-sequence-name job-id))))
#:unwind? #t))))
(define (vacuum-log-parts-table conn)
(exec-query