Skip to content
Browse files

Use reasonable vclock pruning settings by default

Setting them all to 0 caused K/V to not be able to update/delete keys
  • Loading branch information...
1 parent dd8d466 commit 458fc6534b8d9153b6aa48028cdbebe39405b365 @michaelklishin committed Sep 18, 2012
Showing with 25 additions and 9 deletions.
  1. +5 −1 ChangeLog.md
  2. +4 −6 src/clojure/clojurewerkz/welle/conversion.clj
  3. +16 −2 test/clojurewerkz/welle/test/kv_test.clj
View
6 ChangeLog.md
@@ -1,6 +1,10 @@
## Changes between Welle 1.3.0 and 1.4.0
-No changes yet.
+### Reasonable Vlock Pruning Defaults
+
+Welle now uses reasonable vclock pruning setting defaults in `clojurewerkz.welle.buckets/update`.
+
+Kudos to @mefesto for reporting the issue.
## Changes between Welle 1.2.0 and 1.3.0
View
10 src/clojure/clojurewerkz/welle/conversion.clj
@@ -399,12 +399,10 @@
:or {allow-siblings false
n-val 3
enable-search false
- ;; same as BucketPropertiesBuilder defaults for
- ;; the respective fields (Java int/long field initial values). MK.
- old-vclock 0
- young-vclock 0
- small-vclock 0
- big-vclock 0}}]
+ old-vclock 86400
+ young-vclock 20
+ small-vclock 50
+ big-vclock 50}}]
(let [bldr (doto (BucketPropertiesBuilder.)
(.r (to-quorum r))
(.w (to-quorum w))
View
18 test/clojurewerkz/welle/test/kv_test.clj
@@ -217,7 +217,7 @@
;; kv/delete
;;
-(deftest test-fetching-deleted-value
+(deftest test-fetching-deleted-value-with-rw=2
(let [bucket-name "clojurewerkz.welle.kv3"
bucket (wb/update bucket-name :last-write-wins true)
k "delete-me"
@@ -227,5 +227,19 @@
(is (empty? (kv/fetch bucket-name k :r 2)))
(kv/store bucket-name k v)
(is (first (kv/fetch bucket-name k)))
- (kv/delete bucket-name k :w 2)
+ (kv/delete bucket-name k :rw 2)
(is (empty? (kv/fetch bucket-name k :r 2)))))
+
+
+(deftest test-fetching-deleted-value-with-bucket-settings
+ (let [bucket-name "clojurewerkz.welle.kv4"
+ bucket (wb/update bucket-name :big-vclock 50 :old-vclock 30000)
+ k "delete-me"
+ v "another value"]
+ (drain bucket-name)
+ (Thread/sleep 150)
+ (is (nil? (kv/fetch-one bucket-name k :r 2)))
+ (kv/store bucket-name k v)
+ (is (kv/fetch-one bucket-name k))
+ (kv/delete bucket-name k :rw 2)
+ (is (nil? (kv/fetch-one bucket-name k :r 2)))))

0 comments on commit 458fc65

Please sign in to comment.
Something went wrong with that request. Please try again.