            (>= (:min-epoch status) epoch))))
 
 (defn completed-checkpoint [{:keys [checkpoint messenger job-id tenancy-id log] :as state}]
+
+  (swap! coordinator-log conj :completed-checkpoint)
   (let [{:keys [epoch write-version]} checkpoint
         write-coordinate? (> epoch 0)
         coordinates {:tenancy-id tenancy-id


(defn offer-heartbeats
  [{:keys [messenger] :as state}]
  (run! pub/offer-heartbeat! (m/publishers messenger))
  (assoc state :last-heartbeat-time (System/nanoTime)))

(def coordinator-backoff-ms 1)

(defn offer-barriers [{:keys [messenger barrier] :as state}]
  (if (:offering? barrier)

         (throw (Exception. "Coordinator failed to write coordinates.
                             This is likely due to the coordinator being quarantined, and another coordinator taking over.")))))


(defn next-replica
  [{:keys [log job-id peer-id messenger curr-replica tenancy-id] :as state}
   barrier-period-ns
   new-replica]
  (swap! coordinator-log conj :next-replica)
  (let [curr-version (get-in curr-replica [:allocation-version job-id])
        new-version (get-in new-replica [:allocation-version job-id])
        job-reallocated? (not= curr-version new-version)]
