Skip to content

Commit

Permalink
Mongo: first failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aphyr committed Feb 25, 2015
1 parent a5567f1 commit b3ba335
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ build
/site
site/**
bench/**
target/**
checkouts/**
*/target/**
*/checkouts/**
*/store/**
*/timeline.html
*/resources/datomic/download-key
Expand Down
2 changes: 1 addition & 1 deletion jepsen/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
; :exclusions [org.fressian/fressian]]
[org.clojure/tools.logging "0.2.6"]
[clj-time "0.6.0"]
[knossos "0.2"]
[knossos "0.2.1-SNAPSHOT"]
[clj-ssh "0.5.7"]
[hiccup "1.0.5"]
[org.clojars.achim/multiset "0.1.0-SNAPSHOT"]
Expand Down
1 change: 0 additions & 1 deletion jepsen/target/stale/extract-native.dependencies

This file was deleted.

31 changes: 20 additions & 11 deletions mongodb/src/mongodb/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,21 @@
(try
(admin-command! conn :replSetInitiate config)
(catch ExceptionInfo e
; Some of the time (but not all the time; why?) Mongo returns this error
; from replsetinitiate, which is, as far as I can tell, not actually an
; error (?)
(when-not (= "Received replSetInitiate - should come online shortly."
(get-in (ex-data e) [:result "errmsg"]))
(condp re-find (get-in (ex-data e) [:result "errmsg"])
; Some of the time (but not all the time; why?) Mongo returns this error
; from replsetinitiate, which is, as far as I can tell, not actually an
; error (?)
#"Received replSetInitiate - should come online shortly."
nil

; This is a hint we should back off and retry; one of the nodes probably
; isn't fully alive yet.
#"need all members up to initiate, not ok"
(do (info "not all members alive yet; retrying replica set initiate"
(Thread/sleep 1000)
(replica-set-initiate! conn config)))

; Or by default re-throw
(throw e)))))

(defn replica-set-master?
Expand Down Expand Up @@ -385,7 +395,7 @@
(DocumentCASClient. "jepsen"
"jepsen"
(ObjectId.)
WriteConcern/JOURNAL_SAFE
WriteConcern/MAJORITY
nil
nil))

Expand All @@ -404,11 +414,10 @@
(->> gen/cas
(gen/delay 1)
(gen/nemesis
(gen/seq (cycle [(gen/sleep 30)
{:type :info :f :start}
(gen/sleep 30)
{:type :info :f :stop}])))
(gen/time-limit 30))
(gen/seq (cycle [(gen/sleep 45)
{:type :info :f :stop}
{:type :info :f :start}])))
(gen/time-limit 200))
(gen/nemesis
(gen/once {:type :info :f :stop}))
(gen/clients
Expand Down
2 changes: 2 additions & 0 deletions mongodb/test/mongodb/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@
(deftest document-cas-test
(let [test (jepsen/run! (m/document-cas-test))]
(is (:valid? (:results test)))
(println "history is")
(pprint (:history test))
(-> test :results :linear report/linearizability)))

0 comments on commit b3ba335

Please sign in to comment.