Fork me on GitHub

Hello, I am using write-bulk-tx-datoms task. The segment that is being written was modeled with an ident named “:segment/id”, this segment/id has the {:db/unique :db.unique/value} attribute. Everything works fine until the segment is replayed (when a crash occurred, for example). The returned exception data :db.error/unique-conflict is thrown as expected and the segment is sent again to the transactor. I believe that it is correct to ignore this segment, but I can’t do that since I can only return :kill, restart and :defer for my handle-exception function. Can I ignore just the :db.error/unique-conflict errors? If not, what do you suggest?


Hmm, yeah, that’s a little tough with respect to unique values


@lboliveira Ahh, that is a tricky one. I’d think we need a patch to write-bulk-tx-datoms to handle that.


I’m not even sure how you would change it because the whole batch will fail and you may want the other segments to transact


One approach might be to return :restart and then also check whether those unique values already exist and filter them out. Another approach might be to stick the unique values in a transactor fn which just ignores that exception when it occurs/or does a similar ignore.


You should use transactor fns sparingly but it might be worth it here for simplicity.


thanks for the reply. You gave me a lot to think about.