Fork me on GitHub
#onyx
<
2018-05-25
>
lboliveira17:05:14

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?

lucasbradstreet18:05:33

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

michaeldrogalis18:05:02

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

lucasbradstreet18:05:29

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

lucasbradstreet18:05:00

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.

lucasbradstreet18:05:15

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

lboliveira18:05:21

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