This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-11-25
Channels
- # bangalore-clj (5)
- # beginners (225)
- # boot (36)
- # cider (1)
- # clara (2)
- # cljsjs (1)
- # clojure (76)
- # clojure-belgium (1)
- # clojure-conj (1)
- # clojure-india (4)
- # clojure-italy (5)
- # clojure-korea (1)
- # clojure-russia (22)
- # clojure-spec (35)
- # clojure-uk (52)
- # clojurescript (67)
- # community-development (17)
- # core-logic (2)
- # cursive (2)
- # datascript (28)
- # datomic (44)
- # emacs (1)
- # funcool (3)
- # hoplon (14)
- # lein-figwheel (2)
- # leiningen (2)
- # luminus (3)
- # midje (3)
- # mount (2)
- # nyc (2)
- # om (54)
- # om-next (1)
- # onyx (30)
- # re-frame (57)
- # reagent (19)
- # ring-swagger (23)
- # slack-help (10)
- # spacemacs (2)
- # specter (1)
- # vim (23)
@zane, why isn’t it performant? i can also think of a way to combine d/datom
scans of eavt
+ vaet
for an e
, looking for the highest t
How does the Memcached setup work - can peers have their own memcached instances that would become warmed up to their needs, or is it a secondary level distributed cache that all peers would use the same way?
Are there any people here who have some experience with saving money values in datomic? I am leaning towards bigint and then simply saving dollar values
@mitchelkuijpers i went with using long/bigint and saving cents. Then for display just divide by 100 and attach currency symbol.
Yeah that was also my plan, Not sure is a long is alway big enough that is the reason I am leaning towards bigint
but i did what i did because of javascript compatibility. I would use decimal otherwise
@jonpither memcached as you need it. we connect everything to one cluster right now, but eventually backend webservers would have their own vs end-user webservers
advantage of one is that transactor pushes live index into the one it’s connected to
ok - let's say you did that, does the transactor still need to be aware of all the various memcacheds out there?
which turns memcached into the primary datastore and ddb the near-line backup 🙂
i know you can only give txor one. i presume that any other url given to a peer but not txor would essentially be a private 2nd tier for all who share it. e.g. @stuarthalloway mentioned having a memcached on his computer for a production transactor (so remote repl queries are faster)
yes. you can give different memcached to different peers
transactor uses it as its own 2nd-tier cache (for the queries it does) and also writes live-index segments there. all other peers will use which ever they connect to as 2nd-tier cache. if it’s the same one for everyone, you obviously get leverage
I'm working with a cardinality many ref. Does anyone have a transaction fn at hand that replaces all current refs with a new set?
@pesterhazy haha, i had the same days ago
in general i turned away from that solution
and i do a built in fn for that :db.fn/retractEntity
the function i tried to use before had issues ;/ but here it is:
;;DB function that allows to replace collection with a new (or empty ) colection
{:db/id #db/id [:db.part/user]
:db/ident :assertWithRetracts
:db/fn #db/fn {:lang "clojure"
:params [db e a vs]
:code "(vals (into (into {} (map (comp #(vector % [:db/retract e a %]) first) (datomic.api/q [:find '?v :where [e a '?v]] db))) (into {} (map #(vector % [:db/add e a %]) vs))))"}}
credit to google groups user….
@jonpither you can give the transactor multiple memcached instances and it will push segments to all of them
@karol.adamiec interesting
my use case is I want to re-create all dependent entities and remove old ones in a single tx
ideally the caller shouldn't need to know the entids of the dependent entities
but obv not sure that this is the right approach
if you mark dependants as isComponent they will be retracted
well I don't want to delete the original entity, only update it!
well, i compromised on that 🙂. the origianl entity in my use case is not linked to anything other than owner, so it is ok for me
try the fn i pasted, it works if you pass ID . I had problems with it working with tempids or lookup refs
@rauh, that looks great
code looks a bit scary
@rauh, could you give an example of how to use it?
the negative numbers in the gist refer to tempids?
and why do you have to supply a tempid and actual id for each value?
here's a simpler version:
(defn replace-refs [db e attr vs]
(->> e
(d/q [:find '[?v ...] :in '$ '?e :where ['?e attr '?v]] db)
(map (fn [v] [:db/retract e attr v]))
(concat (map (fn [v] [:db/add e attr v]) vs))))
@pesterhazy There is an example in the doc string and just right afterwards is another one as a #_
comment
If you already have all entities in your db, then you can nil the tempids, they won't be touched
managed to crash DT on a load-test - Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "hornetq-expiry-reaper-thread"
@rauh, thanks for the explanation
@pesterhazy I've seen the simpler version of this too but decided to go with my own one. It'll properly work even if you specify idents, lookup-refs or entity ids. It'll also work when you :db/add an already existing entity (the above version would fail). And in addition if you add some new entity (with a tempid) you can ref that in the same transaction and assert it. It'll just work. With the simpler version you'd have to transact twice, making your transaction history less transparent on what happened. I did just simplify my gist a little bit.