Bryan O'Sullivan avatar Bryan O'Sullivan committed c71dda5

Add basic debug logging if a conflict occurs on put

Comments (0)

Files changed (1)

src/Network/Riak/Monoid.hs

     ) 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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.