Fork me on GitHub
#datomic
<
2016-10-05
>
wotbrew13:10:32

If I wanted to implement a retry loop for failing cas operations, what aspect of the thrown exception could I rely on to identify unambiguously a cas failure?

pesterhazy14:10:29

@danstone, I'd be interested in this as well

marshall14:10:17

@danstone The string :db.error/cas-failed Compare failed indicates the failure is in the comparison

marshall14:10:40

and the “Compare failed” part only gets thrown when the failure is in the comparison itself

wotbrew14:10:11

hmm, it feels a bit like relying on undocumented details to me - it may be better to implement a generic transaction fn that throws a known type on not=

wotbrew14:10:22

I was hoping there was some ex-info meta or something

wotbrew14:10:25

I guess with these sort of remote CAS spin loops, a rather short time out is appropriate anyway, in which case I can just catch and if I get false positives it doesn't really matter too much

wotbrew14:10:56

The data I would use this on would obviously have very low (read non-existent in normal usage) contention anyway

wotbrew14:10:41

thanks for the info though @marshall 🙂

cap10morgan15:10:56

for a cardinality-many keyword attribute, can I write a query that says "the attribute should have all of these values"? (versus one that just says "this value should be among them")

pesterhazy16:10:40

can't you just add multiple where clauses?

pesterhazy16:10:34

[e :attr v1] [e :attr v2] ...

cap10morgan16:10:24

@pesterhazy yeah, but I was hoping there was a way to do it where I could bind a set w/o knowing its size first or having to dynamically build where and in clauses based on it

pesterhazy16:10:40

you could work around it by adding, say, 3 where clauses and then adding a filter you don't over-count results

pesterhazy16:10:55

just a thought 🙂

cap10morgan16:10:42

in theory datalog is just data and that's great, in practice it is data that is much simpler to write as literals in a text editor than it is to manipulate programmatically 🙂

pesterhazy16:10:42

often you can just filter results in clojure, rather than trying to express everything in datalog

pesterhazy16:10:54

which is much more straightforward

pesterhazy16:10:18

but obviously this has performance implications, depending on the result set

djjolicoeur16:10:29

perhaps someone might be able to help me out here, I just migrated a datomic DB from one dynamoDB table to another, restoring it to a differently named URL in the process, e.g. datomic:ddb://<zone>/foo/name1 -> datomic:ddb://<zone>/bar/name2 . I seem to be able to connect to the DB but I am getting invalid-entity on attempting to transact against it. and I can query the value given in the exception just fine. could the renaming via URL be the cause of this behavior?

djjolicoeur16:10:21

the :db-id in the connection still reflects name1

robert-stuttaford16:10:44

is it on the same transactor, @djjolicoeur ?

djjolicoeur16:10:49

new transactor

djjolicoeur16:10:03

@robert-stuttaford is the fact that it is not on the same transactor an issue? we are in the process of restoring to the original name on the new table

tony.kay17:10:27

Our local Datomic expert @rwtnorton wrote a great command-line operations tool for people to do simple queries and data fixes against Datomic using an SQL 92 syntax. Think psql for Datomic. We just open-sourced that at https://github.com/untangled-web/sql-datomic

djjolicoeur17:10:11

it would appear that the renaming via new URL was the culprit. restore to the original DB name on the new table seems to have fixed the issue.