                     {:split-key split-key
                      :first-key (::first-key part)
                      :last-key (::last-key part)})))
-  (let [defaults (select-keys part [:data/type ::data/families ::limit])
-        [left right] (divide-tablets store (::tablets part) split-key)]
+  (let [defaults (select-keys part [:data/type ::data/families ::limit])]
     ; Construct new partitions from left and right tablet maps.
-    [(let [base-keys (tablet/keys (node/get-data store (:base left)))]
-       (assoc defaults
-              ::data/count (count base-keys)
-              ::membership (into (bloom/create (::limit part)) base-keys)
-              ::first-key (first base-keys)
-              ::last-key (last base-keys)
-              ::tablets left))
-     (let [base-keys (tablet/keys (node/get-data store (:base right)))]
-       (assoc defaults
-              ::data/count (count base-keys)
-              ::membership (into (bloom/create (::limit part)) base-keys)
-              ::first-key (first base-keys)
-              ::last-key (last base-keys)
-              ::tablets right))]))
+    (map
+      (fn make-part
+        [tablets]
+        (let [base-keys (tablet/keys (node/get-data store (:base tablets)))]
+          (assoc defaults
+                 ::data/count (count base-keys)
+                 ::membership (into (bloom/create (::limit part)) base-keys)
+                 ::first-key (first base-keys)
+                 ::last-key (last base-keys)
+                 ::tablets tablets)))
+      (divide-tablets store (::tablets part) split-key))))
 
 
 (defn join

      (tablet/from-records f tablet-updates))
    (store-tablet! store family-key)
    (conj tablets)))


(defn add-records!
  "Performs an update across the tablets in the partition to merge in the given
  record data."
  [store part f records]
  (let [tablets (->> records
                     (reduce (partial append-record-updates (::data/families part)) {})
                     (reduce (partial update-tablet! store f) (::tablets part)))
        record-keys (map first records)
        record-count (count (tablet/read-all (node/get-data store (:base tablets))))]
    ; FIXME: this may result in a partition larger than the limit in size
    (assoc part
           ::data/count record-count
           ::tablets tablets
           ::membership (into (::membership part) record-keys)
           ::first-key (apply key/min (::first-key part) record-keys)
           ::last-key (apply key/max (::last-key part) record-keys))))


(defn from-records

                ::first-key
                ::last-key
                ::tablets]))


(def default-limit
  "The default number of records to build partitions up to."
  100000)



