This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-10-26
Channels
- # admin-announcements (1)
- # beginners (167)
- # boot (117)
- # boulder-clojurians (1)
- # cbus (1)
- # clara (3)
- # clojure (87)
- # clojure-conj (2)
- # clojure-japan (2)
- # clojure-russia (23)
- # clojure-spain (3)
- # clojure-za (2)
- # clojurescript (184)
- # community-development (8)
- # core-async (7)
- # core-matrix (4)
- # cursive (36)
- # data-science (74)
- # datascript (3)
- # datomic (171)
- # events (6)
- # hoplon (83)
- # ldnclj (5)
- # ldnproclodo (1)
- # lein-figwheel (2)
- # leiningen (19)
- # liberator (2)
- # off-topic (5)
- # om (227)
- # onyx (5)
- # re-frame (142)
- # reagent (4)
- # yada (5)
Question for the Cognitects out there: I noticed that there is a :db.install/function
ident. Its docstring says that it is used to install functions but it is not documented on http://docs.datomic.com. Could you shed some light on :db.install/function
?
why does the client need to provide the JDBC url when making a connection to the transactor?
@raymcdermott The client get's the transactor url from the database, this means that if you for example start a new transactor or one crashes and another on comes up it get's the new transactor url from the database. This also means that you data fetching keeps working when the transactor is down. It is actually pretty nifty
@raymcdermott: it rocks that peers talk to storage directly. transactor doesnāt have to be involved for reads at all. means scaling reads is independent of scaling writes.
also failover process uses storage; so peers know when failover is happening even while primary transactor is dead
@raymcdermott: You can suppress the printing of the login information by passing:
-Ddatomic.printConnectionInfo=false
as a parameter to the transactor launchMorninā @robert-stuttaford . Well, I guess not for you
hah, no
so whenās the Next Big Thing coming for Datomic, @marshall? i just canāt imagine that you guys are ādoneā
Nope, definitely not done, but I donāt have any visibility into when/what is coming; at least not until itās essentially release-ready
ok, cool good to know thereās still stuff cooking!
Hi. Does anyone have a solution for partial backups of a datomic db?
The use case: I'f like to extract a set of "fixtures" from an existing production db. With mysqldump
(for example) I'd just exclude ceratain tables from the dump.
But a normal Datomic dump will typically include all facts (whereas I'd like to exclude, say, all events or all payment information).
hah ā is that you, @bkamphaus ?
pesterhazy: we wrote custom code for this that exports to a transit file, zips it, and puts it on S3
that sounds like a good solution
takes a database and a configuration of attrs to export, and exports all the schema (whether in the config or not), enums, and data for those attrs
our prod db backup is 9gb. this exports the ācontrolā information which comes to 12mb gzipped
or 55mb unzipped. itās super useful
lemme see if i can gist it
that would be PERFECT
I tried https://groups.google.com/d/msg/datomic/eQQnnqYl67Y/z-Ib60NCJAAJ but it doesn't seem to cope well with 100s of MB of data
@marshall: I noticed that password data does get leaked out when things go wrong (it dumps the properties) ā¦ maybe something more complete is needed?
@pesterhazy: not a simple cut and paste job, iām afraid. iāve put a note on my list to get it done this week. are you on twitter?
same handle
would be useful for lots of users, I think
totally. iād share it as a public gist and tweet it, and cc you
cool thanks!
š was super fun to write with transducers
everything is better with some transducers thrown in
theyāre the sriracha of clojure
this code actually builds transducers dynamically based on the config, and memoizes them
for teh speedz
sriracha +1
(had to look that up)
@raymcdermott: taking over from @marshall here - if you can email me ā bkamphaus @ cognitect ā we definitely donāt want the creds to leak anywhere if theyāre printing has been disabled by the command line arg. If you can pass along your transactor launch command, logs or console output that shows the leaked creds (redact/replace the actual creds), and the type of failure required to repro (or steps to take to induce that failure), Iāll investigate as a bug.
thanks @bkamphaus - I will double check the issue on this side first
@raymcdermott: cool, feel free to ping me here whenever you send it along - also would be helpful to have the txor properties file (again w/any creds or sensitive info redacted from it).
hey, does anyone have any experience with this error? Our transactor is currently unresponsive:
2015-10-26 16:35:07.170 INFO default datomic.update - {:tid 133, :pid 1947, :message "Update failed"}
java.lang.NullPointerException: null
at datomic.db$next_valid_inst.invoke(db.clj:2412) ~[datomic-transactor-pro-0.9.5206.jar:na]
at datomic.db.ProcessExpander.getData(db.clj:2468) ~[datomic-transactor-pro-0.9.5206.jar:na]
at datomic.update$processor$fn__10171$fn__10172$fn__10173$fn__10177$fn__10180$fn__10181.invoke(update.clj:246) ~[datomic-transactor-pro-0.9.5206.jar:na]
at clojure.lang.Atom.swap(Atom.java:37) ~[clojure-1.6.0.jar:na]
at clojure.core$swap_BANG_.invoke(core.clj:2232) ~[clojure-1.6.0.jar:na]
at datomic.update$processor$fn__10171$fn__10172$fn__10173$fn__10177$fn__10180.invoke(update.clj:240) ~[datomic-transactor-pro-0.9.5206.jar:na]
at datomic.update$processor$fn__10171$fn__10172$fn__10173$fn__10177.invoke(update.clj:238) ~[datomic-transactor-pro-0.9.5206.jar:na]
at datomic.update$processor$fn__10171$fn__10172$fn__10173.invoke(update.clj:235) [datomic-transactor-pro-0.9.5206.jar:na]
at datomic.update$processor$fn__10171$fn__10172.invoke(update.clj:216) [datomic-transactor-pro-0.9.5206.jar:na]
at datomic.update$processor$fn__10171.invoke(update.clj:216) [datomic-transactor-pro-0.9.5206.jar:na]
at datomic.update$processor.doInvoke(update.clj:216) [datomic-transactor-pro-0.9.5206.jar:na]
at clojure.lang.RestFn.applyTo(RestFn.java:139) [clojure-1.6.0.jar:na]
at clojure.core$apply.invoke(core.clj:626) [clojure-1.6.0.jar:na]
at datomic.update$background$proc__10093.invoke(update.clj:58) [datomic-transactor-pro-0.9.5206.jar:na]
at clojure.lang.AFn.run(AFn.java:22) [clojure-1.6.0.jar:na]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_55]
we're seeing timeouts every time we try to issue a transaction. the above error comes from the transactor log. we suspect the transactor is basically paused because of that error.
@kbaribeau: two quick questions (1) does the problem persist across transactor restart (2) do you have the logs from when the error first started occurring?
there's :txid in these logs entries, can we use that to find out what was in the transaction that was failing?
If you can get first log (just grep or something) that has āUpdate failedā in it w/the accompanying ānext_valid_instā in stack trace, can you email it to me at bkamphaus @ cognitect ?
@kbaribeau have you backed up your database? Two pieces (1) back up right away to be safe, maybe to a new location in file store/s3 or w/e you back up to if your latest db backup does/did not show this issue, (2) verify backup will complete successfully
wait a minute, I may be misreading the error
@kbaribeau: whatās the most recent instant in the database? Is it possible a transaction was incorrectly written future dated? w/explicit db/txInstant as specified here http://docs.datomic.com/transactions.html#reified-transactions
I doubt we've ever set a T value explicitly. d/basis-t
tells me our most recent T value is 4053248. should that show up in the log?
d/next-t
seems to work. but I suppose that's different from datomic.db$next_valid_inst
Datoms about transaction entity from last successful transaction, replace safely-before-inst
with date prior to issue occurring:
(let [log (d/log conn)
safely-before-inst #inst "2015-10-01" ;example date, replace
txes (d/tx-range log safely-before-inst nil)
last-tx-data (:data (last txes))]
(filter #(= 3 (d/part (:e %))) last-tx-data))
if you annotate transactions with domain specific info, verify youāre ok sharing prior to pasting, or pm me w/tx datoms from last successful transaction.
(let [log (d/log @connection/conn)
safely-before-inst #inst "2015-09-25T00:00:00.000-00:00" ;example date, replace
txes (d/tx-range log safely-before-inst nil)
last-tx-data (:data (last txes))]
(filter #(= 3 (d/part (:e %))) last-tx-data))
; (#datom[13194143586558 50 #inst "2015-10-23T21:30:09.200-00:00" 13194143586558 true])
(d/touch (d/entity (d/db @connection/conn) 13194143586558))
; {:db/id 13194143586558, :db/txInstant #inst "2015-10-23T21:30:09.200-00:00"}
@kbaribeau: are you able to upgrade to latest? 0.9.5327 - on transactor
@kbaribeau: preferably upgrade both transactor and peer lib dep to latest, 0.9.5327 - we think thereās a possibility it stems from an issue corrected in that version.
does upgrading from 5206 to 5327 require that we also upgrade the peer? seeing some errors that might be indicating that
@kbaribeau: yeah, push dep upgrade for peer apps as well
new error?
#object[datomic.promise$settable_future$reify__6305 0x262beb24 {:status :failed, :val #error {
:cause "java.lang.NullPointerException"
:via
[{:type java.util.concurrent.ExecutionException
:message "java.lang.NullPointerException: java.lang.NullPointerException"
:at [datomic.promise$throw_executionexception_if_throwable invoke "promise.clj" 10]}
{:type java.lang.NullPointerException
:message "java.lang.NullPointerException"
:at [clojure.core$eval329$fn__330 invoke "NO_SOURCE_FILE" -1]}]
:trace
[[clojure.core$eval329$fn__330 invoke "NO_SOURCE_FILE" -1]
[datomic.error$deserialize_exception invoke "error.clj" 135]
[datomic.peer.Connection notify_error "peer.clj" 401]
[datomic.connector$fn__8480 invoke "connector.clj" 169]
[clojure.lang.MultiFn invoke "MultiFn.java" 233]
[datomic.connector$create_hornet_notifier$fn__8486$fn__8487$fn__8490$fn__8491 invoke "connector.clj" 194]
[datomic.connector$create_hornet_notifier$fn__8486$fn__8487$fn__8490 invoke "connector.clj" 189]
[datomic.connector$create_hornet_notifier$fn__8486$fn__8487 invoke "connector.clj" 187]
[clojure.core$binding_conveyor_fn$fn__4444 invoke "core.clj" 1916]
[clojure.lang.AFn call "AFn.java" 18]
[java.util.concurrent.FutureTask run "FutureTask.java" 266]
[java.util.concurrent.ThreadPoolExecutor runWorker "ThreadPoolExecutor.java" 1142]
[java.util.concurrent.ThreadPoolExecutor$Worker run "ThreadPoolExecutor.java" 617]
[java.lang.Thread run "Thread.java" 745]]}}]
@kbaribeau: this is after upgrading both?
this is on transactor or peer on startup?
@kbaribeau: is there an exception being reported on the transactor for that transaction attempt also?
I have āuserā entities and āclubā entities. Users are members of one or more clubs, and clubs have one or more users (as members).
But I want that āmembershipā to be typed, as in, āpresidentā āsecretaryā āmemberā and so on.
So, I can't just associate a user with a club via a cardinality/many because that association itself needs to be annotated.
Do I create a āmembershipā entity which has refs from users to clubs along with a role enum (pres, veep, etc)?
(Of course, what I want is to do a Pull API thing in a user and get a list of all the clubs s/he belongs to, and what the membership role is.)
@zentrope: It depends
Yeah. I donāt have a lack of ideas, just enough lack of experience to choose between them. ;)
For simple case, I would probably use multiple attributes, :club/president
:club/veep
:club/member
ā¦ etc. as card/many and define a rule that says a user is one of these. Of course the Pull API use case with this is less straight forward. I might also try to define the president of relation from the user if a cardinality one constraint should apply to that direction. You could reify the relation, also, as you mention.
Is the Pull API use case you mention above the most common use case you envision, or just something you want to make sure is included?
Doing the pulls in stages works, of course, but Iām hoping Iām not missing something given my past thinking in terms of using Postgres.
I guess it depends on how far your use of this membership idea. You could go so far as to make each āmembershipā a component entity of a person entity that refers to the class of membership and the organization, start date, end date, billed amount, etc.
[:user/id :user/name {:membership/_user [{:membership/role [:db/ident]}]}]
seems to be getting me somewhere.
http://docs.datomic.com/pull.html#component-defaults ā component defaults in pull documentation
I can get from user -> membership -> club but canāt add -> membership -> users ; to get a list of all the members of that club.
that would be assuming a structure like:
{:user/id
:user/name
:user/membership
[{:membership/org ā¦
:membership/role ...
:membership/start .. }]}
Where a membership is isComponent true, not sure if thatās a model that sounds reasonable for your use case.What I want, though, is [user] -> [clubs] -> [members in each club]
but I canāt seem to make the club to a membership lookup to find users. Hm.
[:user/id
:user/name
:user/email
{:membership/_user
[{:membership/role [:db/ident]}
{:membership/club
[:club/id
:club/name
:membership/_user
]}]}]
so from :membership/club
-> (club entity id) -> :membership/_club
(all membership entities that point to club) -> :user/_membership
(back to user ids)
I can map this stuff through a transform that then pulls in, say, a list of all the members of a specific club via separate queries. Iām just wondering if the Pull API can do all that for me.
Should user have a :user/membership (isComponent) and club have a :club/membership (isComponent)?
Right now, I have just a standalone membership set of attributes for an entity, with :one for club and :one for user.
Probably differences of opinion on this ā my quick mental mock up would say have :user/membership as isComponent of a user, points to an organization of which the user is a member.
Iām not sure what you mean be āstandalone membership set of attributes for an entityā precisely.
(attr :membership/role :ref :one "")
(attr :membership/user :ref :one "")
(attr :membership/club :ref :one "")
Well, thatās just my dsl. I mean thereās no :user/memberships attribute of any type. Nor :club/membership.
yeah, I would make membership entities that are components of users and have similar attributes. So no :membership/_user backref, but still role (points to an enum?), :club (points to a club org), and you can go from club org by back ref to all membership that apply to that club, and from those membership to their user parent entities.
Iām much more interested in being able to walk from a user through to all the information they can see vs starting with a club.
How do you āgo from club org by back ref to all membershipā in a Pull API starting with a user?
I think :user/memberships :many
shouldnāt be a component such that you can have a :club/memberships :many
also pointing to the same membership entity as the :user/memberships
attribute does.
@zentrope: why :club/membership also pointing to it?
Because otherwise I can get a list of the members of the club via a Pull API pattern.
I saw :user/memberships card many pointing to a membership entity which has :membership/club as a cardinality one
:membership/_club being the reverse ref you would follow from club entity to get all memberships
and you can use :user/_memberships for all users with a membership to that club
but I havenāt thrown in the toy schema/data yet
my reasoning being that it makes sense to constrain a membership to only be for one club
so thereās a direction of the relationship to which you could apply a cardinality/one constraint (have to try to enforce that via some other logic if you model the ref in the other direction)
(def club-pattern
[:user/id
:user/name
:user/email
{:user/memberships
[{:membership/role [:db/ident]}
{:membership/club
[:club/id
:club/name
{:membership/_club '[*]}]}]}])
Caused by: java.util.concurrent.ExecutionException: org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "52.22.208.29", user "dyno", database "dd7fmhk85j9m9d&ssl=true", SSL off
(def club-pattern
[:user/id
:user/name
:user/email
{:user/memberships
[{:membership/role [:db/ident]}
{:membership/club
[:club/id
:club/name
{:membership/_club
[{:user/_memberships
[:user/name {:user/memberships [{:membership/role [:db/ident]}]}]}]}]}]}])
@zentrope: it looks like you figured it out. I did end up doing a gist of a quick example of what I was talking about: https://gist.github.com/benkamphaus/4f991901b2fe8d00e20b
@raymcdermott: youāre following the Heroku PostgreSQL instructions here? http://docs.datomic.com/storage.html#sql-database
@bkamphaus: Thanks!
@raymcdermott is it possible that there are issues with creds in the connection URL that need to be percent encoded?
Another option to try would be to use the map form for the URI described here http://docs.datomic.com/clojure/#datomic.api/connect
Connects to the specified database, returing a Connection.
URI syntax ({} indicate place holders to fill in, [] indicate optional):
@bkamphaus: Another version of the many-to-many thing: https://gist.github.com/vaughnd/3705861