Using d/with-db in a query fails on Cloud

Hi, I’m trying to run a query on cloud using a with-db as the data source. The query runs perfectly when I run it locally with using Datomic Access, but it fails when I deploy the ions.

The functionality is similar to this:

(defn find-sub-entities [db entity-id]
  (d/q '[:find ?se
         :in $ ?en-id
         :where
         [?en :entity/id ?en-id]
         [?en :entity/sub-entities ?se]]
       db entity-id))

(defn future-sub-entites [conn tx-data entity-id]
  (let [with-db (d/with-db conn)
        result  (d/with with-db {:tx-data tx-data})
        sub-entities (find-sub-entities (:db-after result) entity-id)]
    sub-entities))

This is the exception I get from ions:

{
  "cognitect.anomalies/category": "cognitect.anomalies/busy",
  "cognitect.anomalies/message": "Database does not yet have t=271",
  "basis": 270,
  "needed-t": 271
}

Any idea what I might be doing wrong? Thanks in advance!

1 Like

What version of Datomic Cloud are you running?
You can find the version in the Outputs tab for the Datomic Compute stack of your CloudFormation dashboard.

Hi Marshall,

I’m running the version 8812. I tried it both before I updated to this version and after the update, still the same result.

Thanks!
Furkan

Hi @marshall,

Any updates on this? If you need any more information, let me know. If it’s easier to have access our Datomic installation, I can provide that as well.

Cheers,
Furkan

Hi Furkan,

I’ve reproduced this behavior and we are investigating.

-Marshall

Thanks for the update!

I’ll wait with my PR until there is a fix for this. I didn’t want to implement an ugly workaround.

Let me know if I can help with anything.

Cheers,
Furkan

Hi again,

I was wondering if there is any update on this. I saw another topic D/with not working inside tx fn with a similar question and Stu replied with saying there will be a fix in the next release. Should I assume that the same fix will also solve this issue?

Cheers,
Furkan

We have determined the cause and a fix for this issue.
It will be shipped in the next release and I will update this issue when it is available.

2 Likes

Today’s release (Datomic Cloud 589-8846) of Datomic Cloud includes a fix for this issue