This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-11
Channels
- # aleph (7)
- # announcements (5)
- # beginners (58)
- # calva (20)
- # cider (10)
- # clj-kondo (4)
- # cljfx (5)
- # cljsrn (7)
- # clojure (29)
- # clojure-europe (11)
- # clojure-mexico (1)
- # clojure-norway (26)
- # clojure-uk (9)
- # clojurescript (1)
- # cursive (31)
- # datahike (22)
- # datomic (12)
- # duct (3)
- # fulcro (28)
- # helix (35)
- # hyperfiddle (28)
- # lsp (4)
- # malli (8)
- # midje (3)
- # music (2)
- # nbb (9)
- # nrepl (20)
- # off-topic (36)
- # polylith (3)
- # shadow-cljs (47)
- # sql (2)
- # testing (7)
- # vim (17)
- # xtdb (7)
I'm following the Max Datom tutorial - level 10: https://max-datom.com/#/DB612D03-9AF7-49B7-98B5-4C77ADE029D2 I have troubles making a proper query. They basically want to count posts of given user. I tried the following query but it only returns 1 as a count - it should return 3 because this user has 3 posts associated with them.
(d/q '[:find ?user-name (count ?post-author)
:where
[?user :user/id #uuid "1B341635-BE22-4ACC-AE5B-D81D8B1B7678"]
[?user :user/first+last-name ?user-name]
[?post :post/author ?user]
[?post :post/author ?post-author]
]
db)
;; => [[["E. L." "Mainframe"] 1]]
I'm wondering whether I should simply count :post/id
instead of :post/author
- but they say :post/author
in the tutorial, which is confusing...
(d/q '[:find ?user-name (count ?post-id)
:where
[?user :user/id #uuid "1B341635-BE22-4ACC-AE5B-D81D8B1B7678"]
[?user :user/first+last-name ?user-name]
[?post :post/author ?user]
[?post :post/id ?post-id]
]
(db))
;; => [[["E. L." "Mainframe"] 3]]
Here's my code: https://github.com/jumarko/datomic-starter-sample/pull/8/files#diff-73408bf9944a77167caf09f14d0b5955af225631aed9696e3fad48d6cd0972e0R120-R155
[?post :post/author ?user]
is already making the connection between user and posts - you don't need to go into the post entity like that to pull out a field value.
@U0V0HQWAE I'm not sure I understand. How do I count the posts then?
We just ran into a production issue with pedestal/lacinia/datomic service. it worked fine until a few days ago and now we see a lot of the following errors:
ERROR: Transactor not available {:cognitect.anomalies/category :cognitect.anomalies/unavailable, :cognitect.anomalies/message Transactor not available}
#error {
:cause Transactor not available
:data {:cognitect.anomalies/category :cognitect.anomalies/unavailable, :cognitect.anomalies/message Transactor not available}
:via
[{:type clojure.lang.ExceptionInfo
:message Transactor not available
:data {:cognitect.anomalies/category :cognitect.anomalies/unavailable, :cognitect.anomalies/message Transactor not available}
:at [datomic.peer$transactor_unavailable invokeStatic peer.clj 167]}]
:trace
[[datomic.peer$transactor_unavailable invokeStatic peer.clj 167]
[datomic.peer$transactor_unavailable invoke peer.clj 164]
[datomic.peer.Connection transactAsync peer.clj 328]
[datomic.peer.Connection transact peer.clj 311]
[datomic.api$transact invokeStatic api.clj 107]
[datomic.api$transact invoke api.clj 105]
...
[java.lang.Thread run Thread.java 829]]}
2022-08-10 13:49:37,916 [ERROR] org.apache.activemq.artemis.core.client - AMQ214016: Failed to create netty connection
java.nio.channels.ClosedChannelException: null
at io.netty.handler.ssl.SslHandler.channelInactive(SslHandler.java:1063)
...
at java.base/java.lang.Thread.run(Thread.java:829)
2022-08-10 13:49:38,310 [INFO ] datomic.common - {:event :common/retry, :backoff 1000, :attempts 4, :max-retries 9223372036854775807, :pid 2528, :tid 143}
clojure.lang.ExceptionInfo: Error communicating with HOST on PORT 4334
at datomic.connector$endpoint_error.invokeStatic(connector.clj:53)
...
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException: AMQ119007: Cannot connect to server(s). Tried with all available servers.
at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:787)
at datomic.artemis_client$create_session_factory.invokeStatic(artemis_client.clj:114)
at datomic.artemis_client$create_session_factory.invoke(artemis_client.clj:104)
at datomic.connector$try_hornet_connect.invokeStatic(connector.clj:96)
at datomic.connector$try_hornet_connect.invoke(connector.clj:81)
at datomic.connector$create_hornet_factory.invokeStatic(connector.clj:128)
... 21 common frames omitted
2022-08-10 13:49:38,311 [WARN ] datomic.common - ... caused by ...
org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException: AMQ119007: Cannot connect to server(s). Tried with all available servers.
at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:787)
at datomic.artemis_client$create_session_factory.invokeStatic(artemis_client.clj:114)
...
at java.base/java.lang.Thread.run(Thread.java:829)
...
2022-08-10 13:50:33,608 [INFO ] datomic.common - {:event :common/retry, :backoff 1000, :attempts 1, :max-retries 9223372036854775807, :pid 2528, :tid 143}
clojure.lang.ExceptionInfo: Error communicating with HOST transactor.host.name.removed on PORT 4334
at datomic.connector$endpoint_error.invokeStatic(connector.clj:53)
...
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException: AMQ119010: Connection is destroyed
at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:335)
...
at clojure.lang.RestFn.invoke(RestFn.java:464)
at datomic.connector.TransactorHornetConnector$fn__10264.invoke(connector.clj:214)
... 17 common frames omitted
Any ideas what’s going on here?This is an Datomic on-prem and management has decided to not renew the license because everything is running fine :face_with_rolling_eyes:
I’m going to convince them to get proper support and bugfixes by renewing the license but meanwhile some help would be greatly appreciated.
The the pedestal-based server, datomic-transactor and the postgres-db are all running on separate virtual machines.
I’m not a very good resource for datomic debugging, but we’ve had some Transactor Not Available issues earlier in the summer and I can pass on what I’ve overheard. Check for out-of-memory issues and out-of-disk-space issues. Also check the network connections between the transactor and the backend store — we finally tracked our issues down to a bad network switch.