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?

plexus 2020-12-04T10:48:29.061700Z

this is for a multi-tenant system where one tenant = one db. We are setting up analytics and still figuring out what our setup will look like. It's appealing to have a single peer server = single catalog, but then we would have to restart it when adding a tenant.

2020-12-04T10:54:50.061900Z

Ah, we were shadowing our own databases apparently on both storage and Datomic level. It turns out, this is possible btw ๐Ÿ™‚

favila 2020-12-04T12:30:41.064900Z

Itโ€™s possible if your storage backups are atomic, consistent backups (no read-uncommitted or other read anomalies). Not all can (dynamo) or do by default (MySQL?) so just be careful

1๐Ÿ‘
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. ๐Ÿ˜„