Skip to content

implement atomic bulk delete using observed keys - #523

Merged
milt merged 3 commits into
etag_casfrom
etag_cas_bulk_delete_obs_pk
Aug 13, 2026
Merged

implement atomic bulk delete using observed keys#523
milt merged 3 commits into
etag_casfrom
etag_cas_bulk_delete_obs_pk

Conversation

@milt

@milt milt commented Aug 12, 2026

Copy link
Copy Markdown
Member

This approach to bulk document delete uses the observed keys of listed documents to delete them. Compare to the serializable tx approach here: #522

AND activity_iri = :activity-iri
AND agent_ifi = :agent-ifi
--~ (if (:registration params) "AND registration = :registration" "AND registration IS NULL")
AND id IN (:v*:primary-keys)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the :v* make it count at 1 param??

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep that's a hug "value list"

(includes? msg "ERROR: could not serialize access due to read/write dependencies among transactions")))))
(contains? #{"40001" ; serialization_failure
"40P01"} ; deadlock_detected
(.getSQLState ^PSQLException ex))))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd sleep better at night with something like:

(and (instance? PSQLException ex)
         (let [msg (.getMessage ^PSQLException ex)
               state (.getSQLState ^PSQLException ex)]
           (or (contains? #{"40001" ; serialization_failure
                            "40P01"} ; deadlock_detected
                          state))
               (includes? msg "ERROR: deadlock detected")
               (includes? msg "ERROR: could not serialize access due to concurrent update")
               (includes? msg "ERROR: could not serialize access due to read/write dependencies among transactions")))))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@milt
milt requested a review from cliffcaseyyet August 12, 2026 21:03
@milt
milt merged commit ec61148 into etag_cas Aug 13, 2026
23 of 37 checks passed
@milt
milt deleted the etag_cas_bulk_delete_obs_pk branch August 13, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants