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

0 votes
in Cloud by
edited by

Hi, when we perform these steps:

  1. delete-database
  2. create-database
  3. transact schema

...the transact fails with a cognitect.anomaly/forbidden citing a 403.

{:msg "YADA ! yada.components.user.handlers CreateUserTx:STEP MSG", :outcome " FAILURE: Datomic Client Exception", :lvl "⚠️ WARN", :loc "yada/components/user/handlers.clj:134"}
; Execution error (ExceptionInfo) at datomic.client.api.async/ares (async.clj:58).
; Datomic Client Exception
clj꞉yada.core꞉> 
*e
#error {
 :cause "Datomic Client Exception"
 :data {:cognitect.anomalies/category :cognitect.anomalies/forbidden, :http-result {:status 403, :headers {"server" "Jetty(9.4.36.v20210114)", "content-length" "19", "date" "Wed, 23 Jun 2021 17:38:56 GMT", "content-type" "application/transit+msgpack"}, :body nil}}
 :via
 [{:type clojure.lang.ExceptionInfo
   :message "Datomic Client Exception"
   :data {:cognitect.anomalies/category :cognitect.anomalies/forbidden, :http-result {:status 403, :headers {"server" "Jetty(9.4.36.v20210114)", "content-length" "19", "date" "Wed, 23 Jun 2021 17:38:56 GMT", "content-type" "application/transit+msgpack"}, :body nil}}
   :at [datomic.client.api.async$ares invokeStatic "async.clj" 58]}]
 :trace
 [[datomic.client.api.async$ares invokeStatic "async.clj" 58]
  [datomic.client.api.async$ares invoke "async.clj" 54]
  [datomic.client.api.sync$eval37636$fn__37641 invoke "sync.clj" 104]
  [datomic.client.api.protocols$fn__11841$G__11795__11848 invoke "protocols.clj" 72]
  [datomic.client.api$transact invokeStatic "api.clj" 200]
  [datomic.client.api$transact invoke "api.clj" 183]
  [datomic.cloud.client.local.Connection transact "local.clj" 97]
  [datomic.client.api$transact invokeStatic "api.clj" 200]
  [datomic.client.api$transact invoke "api.clj" 183]
  [yada.util.datomic$transact$fn__7133 invoke "datomic.clj" 428]
  [yada.util.anom$with_retry$fn__7039 invoke "anom.clj" 25]
  [yada.util.anom$with_retry invokeStatic "anom.clj" 25]
  [yada.util.anom$with_retry doInvoke "anom.clj" 13]
  [clojure.lang.RestFn invoke "RestFn.java" 410]
  [yada.util.datomic$transact invokeStatic "datomic.clj" 427]
  [yada.util.datomic$transact invoke "datomic.clj" 407]
  [yada.components.user.handlers$create_user_tx invokeStatic "handlers.clj" 142]
  [yada.components.user.handlers$create_user_tx invoke "handlers.clj" 131]
  [clojure.core.reducers$map$fn__26594$fn__26595 invoke "reducers.clj" 134]
  [clojure.lang.ArrayChunk reduce "ArrayChunk.java" 58]
  [clojure.core.protocols$fn__8178 invokeStatic "protocols.clj" 136]
  [clojure.core.protocols$fn__8178 invoke "protocols.clj" 124]
  [clojure.core.protocols$fn__8138$G__8133__8147 invoke "protocols.clj" 19]
  [clojure.core.protocols$seq_reduce invokeStatic "protocols.clj" 31]
  [clojure.core.protocols$fn__8174 invokeStatic "protocols.clj" 75]
  [clojure.core.protocols$fn__8174 invoke "protocols.clj" 75]
  [clojure.core.protocols$fn__8112$G__8107__8125 invoke "protocols.clj" 13]
  [clojure.core.reducers$folder$reify__26569 coll_reduce "reducers.clj" 93]
  [clojure.core$reduce invokeStatic "core.clj" 6833]
  [clojure.core$into invokeStatic "core.clj" 6900]
  [clojure.core$into invoke "core.clj" 6892]
  [yada.db.seed.app_seed.app_data.user$seed invokeStatic "user.clj" 56]
  [yada.db.seed.app_seed.app_data.user$seed invoke "user.clj" 52]
  [yada.db.seed.app_seed.core$seed invokeStatic "core.clj" 12]
  [yada.db.seed.app_seed.core$seed invoke "core.clj" 9]
  [yada.core$eval38738 invokeStatic "NO_SOURCE_FILE" 51]
  [yada.core$eval38738 invoke "NO_SOURCE_FILE" 51]
  [clojure.lang.Compiler eval "Compiler.java" 7181]
  [clojure.lang.Compiler eval "Compiler.java" 7136]
  [clojure.core$eval invokeStatic "core.clj" 3202]
  [clojure.core$eval invoke "core.clj" 3198]
  [nrepl.middleware.interruptible_eval$evaluate$fn__36286$fn__36287 invoke "interruptible_eval.clj" 87]
  [clojure.lang.AFn applyToHelper "AFn.java" 152]
  [clojure.lang.AFn applyTo "AFn.java" 144]
  [clojure.core$apply invokeStatic "core.clj" 667]
  [clojure.core$with_bindings_STAR_ invokeStatic "core.clj" 1977]
  [clojure.core$with_bindings_STAR_ doInvoke "core.clj" 1977]
  [clojure.lang.RestFn invoke "RestFn.java" 425]
  [nrepl.middleware.interruptible_eval$evaluate$fn__36286 invoke "interruptible_eval.clj" 87]
  [clojure.main$repl$read_eval_print__9112$fn__9115 invoke "main.clj" 437]
  [clojure.main$repl$read_eval_print__9112 invoke "main.clj" 437]
  [clojure.main$repl$fn__9121 invoke "main.clj" 458]
  [clojure.main$repl invokeStatic "main.clj" 458]
  [clojure.main$repl doInvoke "main.clj" 368]
  [clojure.lang.RestFn invoke "RestFn.java" 1523]
  [nrepl.middleware.interruptible_eval$evaluate invokeStatic "interruptible_eval.clj" 84]
  [nrepl.middleware.interruptible_eval$evaluate invoke "interruptible_eval.clj" 56]
  [nrepl.middleware.interruptible_eval$interruptible_eval$fn__36317$fn__36321 invoke "interruptible_eval.clj" 152]
  [clojure.lang.AFn run "AFn.java" 22]
  [nrepl.middleware.session$session_exec$main_loop__36385$fn__36389 invoke "session.clj" 202]
  [nrepl.middleware.session$session_exec$main_loop__36385 invoke "session.clj" 201]
  [clojure.lang.AFn run "AFn.java" 22]
  [java.lang.Thread run "Thread.java" 748]]}

If we instead:

  1. delete-database
  2. redeploy app using Ion's tools for this
  3. create-database
  4. transact schema

...then all goes fine.

So it seems that cycling the Datomic server helps somehow.

We looked to see if we were caching the client or the connection and this doesn't seem to be the case. Is there some operational characteristics we should be aware of that would be in play after deleting a DB?

1 Answer

+1 vote
by
selected by
 
Best answer

Prefer generating or appending unique (e.g., UUID) names to databases that are intended to be short-lived. Deleting and creating a database of the same name in a tight cycle is not a behavior that Datomic makes guarantees for or is designed around.

My guess is the deployment step is helpful only because it takes time which is allowing proper cleanup of the previous database to occur.

...