Riak network error (Network.Riak.Tag.getTag): invalid riak message code: 120 #3

Open
aleator opened this Issue Feb 24, 2011 · 0 comments

Projects

None yet

1 participant

@aleator

Using riak-0.14 and simple test program below, I get

RiakTest: Riak network error (Network.Riak.Tag.getTag): invalid riak message code: 120

Which is possibly due to trying to put too large object into riak, but results in something that the bindings don't seem to handle properly

{-#LANGUAGE OverloadedStrings,ParallelListComp#-}
module Main where
import Network.Riak hiding (get,put)
import Network.Riak.Value
import Network.Riak.Content
import qualified Data.ByteString.Lazy.Char8 as BS
import System.Environment
import Data.List

instance IsContent BS.ByteString where
    fromContent c | content_type c == Just "application/octet-stream" = Just $ value c
                     | otherwise = Nothing

    toContent v = empty{value=v,content_type=Just "application/octet-stream"}
    {-# INLINE toContent #-}

main = do 
 print "hello"
 let cntn = BS.replicate 200000 'x'
     biteSize = 20000
 let chunks = unfoldr chop cntn
     chop b | BS.null b = Nothing
            | otherwise = Just $ BS.splitAt biteSize b
   --  biteSize = read bite'
 c <- connect defaultClient
 head [put c "tests" (BS.pack $ ("my-key"++ show i)) Nothing chunk Default Default | chunk <- chunks | i <- [1..] ]
 disconnect c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment