datomic

Ask questions on the official Q&A site at https://ask.datomic.com!
2020-12-04T07:45:33.061300Z

On-prem, of course 😉

2020-12-04T07:51:13.061500Z

We did copy the Postgres data with pgdump & psql -f, but now we seem to end up with partial data, with entries that consist of :datomic-replication/source-eid. Is that expected, or are we expecting something that cannot work?

jcf 2020-12-04T17:08:36.070300Z

Hi all! I'm swapping out on-disk storage with dev-local for an in-memory database (I don't need durability for CI/tests) and I've followed the docs here by adding :storage-dir :mem to my client config… https://docs.datomic.com/cloud/dev-local.html#memdb That call is blowing up with this trace however:

1. Caused by java.lang.IllegalArgumentException
   No implementation of method: :as-file of protocol:
   #'<http://clojure.java.io/Coercions|clojure.java.io/Coercions> found for class: clojure.lang.Keyword

          core_deftype.clj:  583  clojure.core/-cache-protocol-fn
                    io.clj:   35  <http://clojure.java.io/fn/G|clojure.java.io/fn/G>
                    io.clj:  424  <http://clojure.java.io/file|clojure.java.io/file>
                    io.clj:  418  <http://clojure.java.io/file|clojure.java.io/file>
                  impl.clj:  331  datomic.dev-local.impl/require-storage-dir!
                  impl.clj:  328  datomic.dev-local.impl/require-storage-dir!
                  impl.clj:  340  datomic.dev-local.impl/create-client
                  impl.clj:  337  datomic.dev-local.impl/create-client
                  impl.clj:  373  datomic.dev-local.impl.DevLocal/fn
                 Atom.java:   37  clojure.lang.Atom/swap
                  core.clj: 2352  clojure.core/swap!
                  core.clj: 2345  clojure.core/swap!
                  impl.clj:  361  datomic.dev-local.impl.DevLocal/_impl_configure_system
                  impl.clj:  433  datomic.dev-local.impl/ensure-client
                  impl.clj:  423  datomic.dev-local.impl/ensure-client
                  Var.java:  384  clojure.lang.Var/invoke
                  impl.clj:   24  datomic.client.api.impl/dynarun
                  impl.clj:   21  datomic.client.api.impl/dynarun
                  impl.clj:   31  datomic.client.api.impl/dynacall
                  impl.clj:   28  datomic.client.api.impl/dynacall
                   api.clj:  100  datomic.client.api/client
                   api.clj:   48  datomic.client.api/client
That looks to me like I should have a :storage-dir that's resolvable to a file but the docs say this keyword :mem is supported. Given it's gone 5pm here and it's been a long week I'm guessing this is me missing something obvious but it's not jumping out at me… I'll try jacking in and see if I can jump to the source to see how this works. Clojure is so awesome! 😄

jcf 2020-12-04T17:09:19.070400Z

My client config looks like this:

{:server-type :dev-local
 :storage-dir :mem
 :system      "ci"}

kenny 2020-12-04T17:24:56.070600Z

Can you provide the code you're using to get this stacktrace?

jcf 2020-12-04T17:26:06.070800Z

@kenny it's the call to datomic.client.api/client in this component:

(defrecord Datomic [client-config conn db-name]
  component/Lifecycle
  (start [c]
    (let [client  (d/client client-config)
          _       (d/create-database client {:db-name db-name})
          conn    (d/connect client {:db-name db-name})
          tx-data (schema c)]
      (d/transact conn {:tx-data tx-data})
      (assoc c :client client :conn conn)))
  (stop [c]
    #_(some-&gt; c :client (d/delete-database {:db-name db-name}))
    (dl/release-db client-config)
    (dissoc c :client :conn)))

jcf 2020-12-04T17:26:49.071Z

The next line in the trace would be the (let [client (d/client ... line above.

kenny 2020-12-04T17:27:23.071200Z

Thanks. What version of dev-local are you running?

jcf 2020-12-04T17:29:51.071400Z

I've tapped the client-config just to be safe, and can see this in REBL:

jcf 2020-12-04T17:30:00.071800Z

Versions coming right up! 🙂

jcf 2020-12-04T17:30:22.072Z

com.datomic/dev-local {:mvn/version "0.9.203"}

kenny 2020-12-04T17:31:50.072200Z

Can you try updating to the latest 0.9.229? Also ensure you're on the latest client version 0.8.102.

jcf 2020-12-04T17:31:58.072400Z

Will do!

jcf 2020-12-04T17:32:38.072600Z

Client is up to date. Bumping dev-local now and restart my JVM.

jcf 2020-12-04T17:41:06.072800Z

Progress! Looks like updating the dev-local dep has gotten me the :mem support I need. Now I just need to pass in :system and :db-name to release-db. I wonder if I can merge the client config and the arg-map passed to release-db et al… :thinking_face:

jcf 2020-12-04T17:41:12.073Z

Probably not a good idea.

kenny 2020-12-04T17:42:12.073200Z

I could be mistaken but I believe release-db has always needed a :db-name.

kenny 2020-12-04T17:42:38.073500Z

If you'd like to release all dbs, you can call d/list-databases and loop over that.

jcf 2020-12-04T17:44:40.073700Z

Makes sense. Thanks for the pointers, @kenny!

jcf 2020-12-04T17:45:10.073900Z

I wonder if there's a footnote to add to spec-ulation about acretion not helping people like me with old code and newer docs. 😄