            (future
              (try
                (dotimes [i 50000]
-;                 (call! conn "MENTIONS.insert" i (rand-int 1000)))
+;                 (call! conn "MENTIONS.insert" i (rand-int 1000))
                  ; If we go TOO fast we'll start forcing other ops to time
                  ; out. If we go too slow we won't get a long enough log.
                  (Thread/sleep 1)

  [test]
  (remove nil? (pmap up? (:nodes test))))

(defn await-initialization
  "Blocks until the logfile reports 'Server completed initialization'."
  [node]
  (info "Waiting for" node "to initialize at voltroot:" voltroot)
  (timeout 120000
           (throw (RuntimeException.
                    (str node " failed to initialize in time; STDOUT:\n\n"
                         (meh (c/exec :tail :-n 10
                                      (str base-dir "/log/stdout.log")))
                         "\n\nLOG:\n\n"
                         (meh (c/exec :tail :-n 10
                                      (str voltroot "/log/volt.log")))
                         "\n\n")))
           (c/sudo username
                   (c/cd voltroot
                         ; hack hack hack
                         (Thread/sleep 3000)
                         (c/exec :tail :-n 1 :-f "log/volt.log"
                                 | :grep :-m 1 "Initialized VoltDB root directory"
                                 | :xargs (c/lit "echo \"\" >> log/volt.log \\;")))
                   (info node "initialized"))))

(defn await-start
    "Blocks until the logfile reports 'Server completed initialization'."
  [node]
  (info "Waiting for" node "to start at voltroot:" voltroot )
  (timeout 120000
           (throw (RuntimeException.
                    (str node " failed to start in time; STDOUT:\n\n"
                        (meh (c/exec :tail :-n 10
                                      (str base-dir "/log/stdout.log")))

       [:commandlog {:enabled true, :synchronous true, :logsize 128}
        [:frequency {:time 2}]]]))) ; milliseconds

(defn init-voltdb!
  "Starts the daemon with the given command."
  [test host]
  (info host "initializing voltdbroot")
  (c/sudo username
          (c/cd voltroot
                (c/exec (str base-dir "/bin/voltdb") :init
                    :--config (str base-dir "/deployment.xml")
                    :--force
                    :--dir (str base-dir)
                    (c/lit ">> log/stdout.log")
                ))))

(defn configure!
  "Prepares config files and creates fresh DB."
  [test node]
  (c/sudo username
        (c/cd base-dir
              (c/exec :echo (deployment-xml test) :> "deployment.xml")))

  (init-voltdb! (jepsen/primary test))
)

(defn close!
  "Calls c.close"
