1. Bryan O'Sullivan
  2. riak-haskell-client


Bryan O'Sullivan  committed c71dda5

Add basic debug logging if a conflict occurs on put

  • Participants
  • Parent commits 510d36d
  • Branches default

Comments (0)

Files changed (1)

File src/Network/Riak/Monoid.hs

View file
     ) where
 import Control.Arrow (first)
+import Control.Monad (unless)
 import Data.Function (on)
 import Data.Either (partitionEithers)
 import Data.List (sortBy)
 import Data.Monoid (Monoid(..))
+import Network.Riak.Debug (debug)
 import Network.Riak.Types.Internal hiding (MessageTag(..))
 get :: (Monoid c) =>
         case xs of
           []             -> return (val, vclock) -- not observed in the wild
           [v] | v == val -> return (val, vclock)
-          ys             -> go (mconcat (val:ys)) (Just vclock)
+          ys             -> do debug "put" "conflict" 
+                               go (mconcat (val:ys)) (Just vclock)
   go val0 mvclock0
 put_ :: (Eq c, Monoid c) =>
   go acc puts = do
     rs <- doPut conn bucket (map snd puts) w dw
     let (conflicts, ok) = partitionEithers $ zipWith mush puts rs
+    unless (null conflicts) $
+      debug "putMany" $ show (length conflicts) ++ " conflicts"
     go (ok++acc) conflicts
   mush (i,(k,_,c)) (cs,v) =
       case cs of