1
votes

I deployed my Clojure app to AWS and I also have Datomic Transactor(EC2) with DynamoDB when my users started to use my app something happened after a while and Datomic Transactor rebooted(for some reason), my app became unresponsive so I re-started my application server(to re-establish transactor connection) then there were no users data, no data at all!?

I was using same URI("datomic:ddb://us-east-1/my-table/my-db"), also I don't call delete-db or some function like that.

I only call d/create-database and d/connect for connecting to Datomic.

It happened me on development but I did not care that time because I thought I did something wrong or something like that.

How can I restore that old data?

P.S: Also I can see that DynamoDB table has some storage size like 900KB I assume some how my data in there? There were just couple of users tho.

My Datomic Version: "0.9.5561"

Here is my code:

(defn establish-conn
  []
  (try 
      ;conf/get returns DB URI like: "datomic:ddb://us-east-1/my-table/my-db"
      (d/create-database (conf/get :db-uri))
      (reset! conn (d/connect (conf/get :db-uri)))
    (catch Throwable t
      (log/error "Could not establish db conn." t))))

Also I have this code for recovering connection from Transactor failure/unavailable etc.

(defn fix-if-conn-ex
  ;;getting exception's error message
  [err-msg]
  (when (any? (str/includes? err-msg %) [":db.error/connection-released"
                                         ":db.error/transactor-unavailable"])
    (db/establish-conn)))
1
maybe something's wrong with your connection code, can you show it to us? - Valentin Waeselynck
@ValentinWaeselynck I edited question with my code. - Ertuğrul Çetin
I can't see anything wrong with that, so I would question what conf/get does, and how you observe that the database is empty. Finally, I would make sure that no other parts of the code interferes with the conn atom. - Valentin Waeselynck
@ValentinWaeselynck conf/get just returns DB URI which is "datomic:ddb://us-east-1/my-table/my- db" that's all.If transactor fails/reboots/becomes unavailable I check those exceptions such as(:db.error/connection-released, :db.error/transactor-unavailable) and re-run this establish-conn for recovering conn problem.I think there might be a bug in Datomic? and it's very serious losing data is not acceptable. - Ertuğrul Çetin
@ValentinWaeselynck after I restarted my web app I could not see any data (users)also I connected to transactor from my repl(to be sure) and list all data I have there was no data at all some how it's deleted and that happened twice.Also I've updated code above. - Ertuğrul Çetin

1 Answers

0
votes

I could not reproduce the issue with the latest Datomic version "0.9.5561.56" on my staging environment, I assume it's resolved with that one.