Welcome! Please see the About page for a little more info on how this works.

+3 votes
in Cloud by

The recent release of version 1.0.277 of datomic-local allowed me to run import-cloud to completion successfully. Unfortunately, the resulting database is unusable. When I try to connect, I get this error message:

{:type java.lang.RuntimeException
:message "No reader function for tag object"
:at [clojure.lang.EdnReader$TaggedReader readTagged "EdnReader.java" 801]}]
:trace
[[clojure.lang.EdnReader$TaggedReader readTagged "EdnReader.java" 801]
[clojure.lang.EdnReader$TaggedReader invoke "EdnReader.java" 783]
[clojure.lang.EdnReader$DispatchReader invoke "EdnReader.java" 549]
[clojure.lang.EdnReader readDelimitedList "EdnReader.java" 757]
[clojure.lang.EdnReader$MapReader invoke "EdnReader.java" 680]
[clojure.lang.EdnReader readDelimitedList "EdnReader.java" 757]
[clojure.lang.EdnReader$MapReader invoke "EdnReader.java" 680]
[clojure.lang.EdnReader readDelimitedList "EdnReader.java" 757]
[clojure.lang.EdnReader$VectorReader invoke "EdnReader.java" 672]
[clojure.lang.EdnReader readDelimitedList "EdnReader.java" 757]
[clojure.lang.EdnReader$MapReader invoke "EdnReader.java" 680]
[clojure.lang.EdnReader read "EdnReader.java" 145]
[clojure.lang.EdnReader read "EdnReader.java" 111]
[clojure.lang.EdnReader readString "EdnReader.java" 67]
[clojure.edn$read_string invokeStatic "edn.clj" 46]
[clojure.edn$read_string invokeStatic "edn.clj" 37]
[clojure.edn$read_string invoke "edn.clj" 37]
[datomic.dev_local.btindex_set$read_latest_root invokeStatic "btindex_set.clj" 99]
[datomic.dev_local.btindex_set$read_latest_root invoke "btindex_set.clj" 95]
[datomic.dev_local.btindex_set$current_index_files invokeStatic "btindex_set.clj" 149]
[datomic.dev_local.btindex_set$current_index_files invoke "btindex_set.clj" 146]
[datomic.dev_local.btindex_set$old_index_files invokeStatic "btindex_set.clj" 159]
[datomic.dev_local.btindex_set$old_index_files invoke "btindex_set.clj" 156]
[datomic.dev_local.btindex_set$delete_old_index_files invokeStatic "btindex_set.clj" 176]
[datomic.dev_local.btindex_set$delete_old_index_files invoke "btindex_set.clj" 169]
[datomic.dev_local.btindex_db$delete_unused_files invokeStatic "btindex_db.clj" 604]
[datomic.dev_local.btindex_db$delete_unused_files invoke "btindex_db.clj" 602]
[datomic.dev_local.impl$create_durable_connection invokeStatic "impl.clj" 189]
[datomic.dev_local.impl$create_durable_connection invoke "impl.clj" 187]
[datomic.dev_local.impl$create_connection invokeStatic "impl.clj" 205]
[datomic.dev_local.impl$create_connection invoke "impl.clj" 201]
[datomic.dev_local.impl.DurableClient connect "impl.clj" 271]
[datomic.client.api$connect invokeStatic "api.clj" 151]
[datomic.client.api$connect invoke "api.clj" 138]
[st.system$ensure_db_BANG_ invokeStatic "system.clj" 117]
[st.system$ensure_db_BANG_ invoke "system.clj" 114]
[st.system$eval57307$fn__57309$fn__57311 invoke "system.clj" 122]
[clojure.core$mapv$fn__8535 invoke "core.clj" 6979]
...

Note that I use a custom credentials provider and it appears as an opaque java object in the resulting db-root-00000000 file.

2 Answers

+2 votes
by

I also ran into this issue and am using the following workaround for the moment:

(def client ...)

;; mostly ripped straight from clojure source
(defn read-string
  ([s] (read-string {:eof nil} s))
  ([opts s]
   (let [opts (update opts :readers #(assoc % 'object (constantly {}))]
     (when s (clojure.langEdnReader/readString s opts))))

(with-redefs [clojure.edn/read-string read-string]
  (d/connect client {:db-name "foo"}))

Since it's the :credentials-provider which is getting serialized with this reader tag, I think this should be okay given the credentials provider shouldn't be needed after the import. But, please do let me know if there's something terribly wrong with this. Thanks.

by
;; Fixed typo:
(defn read-string
  ([s] (read-string {:eof nil} s))
  ([opts s]
   (let [opts (update opts :readers #(assoc % 'object (constantly {})))]
     (when s (clojure.lang.EdnReader/readString s opts)))))

;; foo = DB Name
(with-redefs [clojure.edn/read-string read-string]
  (d/connect client {:db-name "foo"}))

(def conn (d/connect client {:db-name "foo"}))
0 votes
by

One hack I tried to get around this bug is to remove the key-value pair that irreversibly encodes the credentials provider in the db-local files. The relevant file appears to be

./datomic/<system>/<db>/db-root-0000000000

This file seems to be a simple EDN file.

But even if I remove the :creds-provider key (which should not be required after the db is imported), I still can't connect to the imported db. The d/connect process gets much further along after a log of Loading....., but still ultimately fails with the same error.

Maybe the creds providers is encoded somewhere else ...

...