Protobuf serializer

57 views
Skip to first unread message

Mat Evans

unread,
Jun 19, 2014, 10:59:52 AM6/19/14
to project-...@googlegroups.com
Hi all,

I'm making a client in Go that talks to voldemort over protobuffs but i'm having some problems getting a GET request to work.

I'm at the point where the client has set the protocol to pb0 and received the ok response.
After that I build the pb object and serialize it, but the response I get back is

Unknown store ''.

I've definitely set the strore in the pb object so I had a look at the store config.

Am I right in thinking I need a pb class needs to go in both the key and value serializer config sections?

ie..

    <key-serializer>
        <type>protobuff</type>
        <schema-info>java=com.something.YourProtoBuffClassName</schema-info>
    </key-serializer>
    <value-serializer>
        <type>protobuff</type>
        <schema-info>java=com.something.YourProtoBuffClassName</schema-info>
    </value-serializer>

Also - i'm not entirely sure how to get the class file - i've used the proto files under src/ to create my go protobuff files but i'm afraid i'm not too familiar with Java - will Ant have built these when building voldemort? I've had a good look around and can't find anything that looks like it will work.

Many thanks for any pointers
Mat

Arunachalam

unread,
Jun 19, 2014, 11:16:33 AM6/19/14
to project-...@googlegroups.com
I am not too familiar with protocol buffers. But one thing I can tell you for sure is ant or gradle will not touch the stores.xml file for sure. Also the error message "Unknown store" could be indicating the fact that you are not passing in the correct store request to the server. 

It is very tricky without code ( someone in the community might understand protocol buffer or go , I don't) . I would break this down into 2 parts. Serialize and write it into store, use command line shell to see if the object is there in the store. You can use admin shell fetch entries to see the raw bytes. After that try to fix your get call.

Thanks,
Arun.


--
You received this message because you are subscribed to the Google Groups "project-voldemort" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-voldem...@googlegroups.com.
Visit this group at http://groups.google.com/group/project-voldemort.
For more options, visit https://groups.google.com/d/optout.

Brendan Harris (a.k.a. stotch on irc.oftc.net)

unread,
Jun 19, 2014, 11:38:10 AM6/19/14
to project-...@googlegroups.com


On Thursday, June 19, 2014 7:59:52 AM UTC-7, Mat Evans wrote:
I'm making a client in Go that talks to voldemort over protobuffs but i'm having some problems getting a GET request to work.

Very cool. Someone should have done this a long time ago. I really like Go.

Unknown store ''.

Just as Arun said, "Unknown store" is very specific and means that either your store does not exist on the voldemort server or you have given the wrong store name (perhaps a typo) during initialization of the client. So, perhaps double check your store name that you set in the pb object and make sure it matches what's in stores.xml exactly.
 
I've definitely set the strore in the pb object so I had a look at the store config.

Am I right in thinking I need a pb class needs to go in both the key and value serializer config sections?

If you want to serialize both to a class, yes. If you just want the key to be a simple string or int, then you only need a class to serialize the value (I am guess that is where you need a complex data structure). It all depends on what you need.

Also - i'm not entirely sure how to get the class file - i've used the proto files under src/ to create my go protobuff files but i'm afraid i'm not too familiar with Java - will Ant have built these when building voldemort? I've had a good look around and can't find anything that looks like it will work.

Ant won't compile the proto specs, if that's what you're asking. You will have to do that yourself, by downloading the protobuf compiler (protoc) and compiling your specific proto spec. See https://code.google.com/p/protobuf/ for details.

Brendan

Mat Evans

unread,
Jun 19, 2014, 12:21:20 PM6/19/14
to project-...@googlegroups.com
Hi Brendan, Arun

Thanks both for your replies!

Brendan, yeah, i've got the VProto.class files compiled now - my store config did look like this..

<stores>
  <store>
    <name>test</name>
    <persistence>bdb</persistence>
    <description>Test store</description>
    <routing-strategy>consistent-routing</routing-strategy>
    <routing>server</routing>
    <replication-factor>1</replication-factor>
    <required-reads>1</required-reads>
    <required-writes>1</required-writes>
    <key-serializer>
      <type>protobuff</type>
      <schema-info>java=voldemort.client.protocol.pb.VProto</schema-info>
    </key-serializer>
    <value-serializer>
      <type>protobuff</type>
      <schema-info>java=voldemort.client.protocol.pb.VProto</schema-info>
    </value-serializer>
    <hinted-handoff-strategy>consistent-handoff</hinted-handoff-strategy>    
  </store>
</stores>


but i'm thinking now I probably just need to use a string for both to make it easy so have changed them back and have updated the store name to check test wasn't being strange

<stores>
  <store>
    <name>test</name>
    <persistence>bdb</persistence>
    <description>Test store</description>
    <routing-strategy>consistent-routing</routing-strategy>
    <routing>server</routing>
    <replication-factor>1</replication-factor>
    <required-reads>1</required-reads>
    <required-writes>1</required-writes>
    <key-serializer>
      <type>string</type>
    </key-serializer>
    <value-serializer>
      <type>string</type>
    </value-serializer>
    <hinted-handoff-strategy>consistent-handoff</hinted-handoff-strategy>    
  </store>
</stores>

Looking at Voldemort starting - it seems to have created that store

[17:10:11,838 voldemort.server.storage.StorageService] INFO Opening store 'mat' (bdb).  [main]
[17:10:11,838 voldemort.store.bdb.BdbStorageConfiguration] INFO Creating BDB data directory '/data/servers/voldemort-release-1.6.0-cutoff/config/radar_node_cluster/data/bdb/mat.  [main]
[17:10:11,863 voldemort.store.bdb.BdbStorageConfiguration] INFO Creating environment for mat:   [main]
[17:10:11,863 voldemort.store.bdb.BdbStorageConfiguration] INFO     BDB cache size = 1073741824  [main]
[17:10:11,863 voldemort.store.bdb.BdbStorageConfiguration] INFO     BDB je.cleaner.threads = 1  [main]
[17:10:11,863 voldemort.store.bdb.BdbStorageConfiguration] INFO     BDB je.cleaner.minUtilization = 50  [main]
[17:10:11,863 voldemort.store.bdb.BdbStorageConfiguration] INFO     BDB je.cleaner.minFileUtilization = 0  [main]
[17:10:11,863 voldemort.store.bdb.BdbStorageConfiguration] INFO     BDB je.log.fileMax = 62914560  [main]
[17:10:11,864 voldemort.store.bdb.BdbStorageConfiguration] INFO     BDB allowCreate=true,cacheSize=1073741824,txnNoSync=false,txnWriteNoSync=false,{je.tree.maxDelta=100, je.cleaner.bytesInterval=31457280, je.maxMemory=1073741824, je.cleaner.adjustUtilization=false, je.log.faultReadSize=2048, je.env.isTransactional=true, je.cleaner.maxBatchFiles=0, je.cleaner.minUtilization=50, je.tree.binDelta=75, je.cleaner.fetchObsoleteSize=true, je.cleaner.lookAheadCacheSize=8192, je.lock.nLockTables=7, je.cleaner.threads=1, je.log.iteratorReadSize=8192, je.lock.timeout=500 MILLISECONDS, je.checkpointer.wakeupInterval=30000000, je.checkpointer.highPriority=false, je.checkpointer.bytesInterval=209715200, je.cleaner.lazyMigration=false, je.cleaner.minFileUtilization=0, je.txn.durability=NO_SYNC,NO_SYNC,SIMPLE_MAJORITY, je.sharedCache=true, je.env.fairLatches=false, je.log.fileMax=62914560},  [main]


Using the cli it works nicely

Established connection to mat via tcp://localhost:6666/
> put "hello" "world"
> get "hello"
version(0:1) ts:1403194298444: "world"


Then using my go client - it seems to be serializing with the correct values, but still comes back with - Unknown store ''.

:type:GET should_route:true store:"mat" get:<key:"hello" >


My client is making a struct from the go protobuf code that I created from the .proto files in the code, and with strings for keys and values I'm assuming that should work?

The only bit of info i've found on the Voldemort protocols is this page - https://github.com/voldemort/voldemort/wiki/Writing-own-client-for-Voldemort
Is that the only information going?

I've used the Ruby client as a model to build some of the Go stuff but it seems i'm not quite there yet!

Gonna get wireshark out now, and just make sure what I think is being sent over the wire is actually what's happening!

I'll get back when i've confirmed that.

I'll sort out a blog post or example repo once i've got it sorted as I think Go and Voldemort is gonna be a killer app :)

Thanks,
Mat

Mat Evans

unread,
Jun 19, 2014, 12:30:59 PM6/19/14
to project-...@googlegroups.com
Update:

Using wireshark - this is the conversation

> pb0
> ok
> ...:type:GET should_route:true store:"mat" get:<key:"hello" > 
> ..........Unknown store ''.

So it does indeed seem that it's sending the right store so I suspect I might have got the wrong end of the stick and am using protobufs in the wrong way.

Brendan Harris (a.k.a. stotch on irc.oftc.net)

unread,
Jun 19, 2014, 12:45:23 PM6/19/14
to project-...@googlegroups.com

On Thursday, June 19, 2014 9:30:59 AM UTC-7, Mat Evans wrote:
Update:

Using wireshark - this is the conversation

> pb0
> ok
> ...:type:GET should_route:true store:"mat" get:<key:"hello" > 
> ..........Unknown store ''.

So it does indeed seem that it's sending the right store so I suspect I might have got the wrong end of the stick and am using protobufs in the wrong way.

But in your stores.xml it says the store name is "test" and in the protocol is says the store name is "mat". That's not right. It should be "test".

Brendan

Mat Evans

unread,
Jun 19, 2014, 2:43:05 PM6/19/14
to project-...@googlegroups.com
Hi Brendan,

Apologies - that was a typo - the store is definitely named mat as you can see in the above output :)

cheers,

Mat Evans

unread,
Jun 20, 2014, 4:40:47 AM6/20/14
to project-...@googlegroups.com
A quick update..

Just run the ruby client and followed it with wireshark - seem I'm not serializing it correctly.

The ruby conversation looks like this

> pb0
> ok
> ..........mat".
.hello
> ....
.
.world.
...........(


Compared to the go version, it seems i'm not binary encoding the right parts.
Will post back when I get it working!

Mta

Mat Evans

unread,
Jun 20, 2014, 7:50:17 AM6/20/14
to project-...@googlegroups.com
Success!!

I've got a client working - although very simply.

I'll tidy it up and post it somewhere as a reference - it was mainly a pointer issue :( but working nicely now.

Arunachalam

unread,
Jun 20, 2014, 9:38:41 AM6/20/14
to project-...@googlegroups.com
Good to hear that Mat. It would help the community if you can put up a github project for the go voldemort client :)

Thanks,
Arun.


--

Mat Evans

unread,
Jun 23, 2014, 6:36:15 AM6/23/14
to project-...@googlegroups.com
Hi all,

I've started putting some stuff up on github.

The first one is


I'm not sure you guys will find that one very interesting - it just shows the process of creating the protobuf files in Go - something more for the Go community.
It's also then easily importable into any Go program.

Next, i'm just tidying up the client to make it a bit more idiomatic and probably make it more testable - something that might take me till tomorrow or wednesday, but then I'll update this thread with the repo location and some more information.

Initial testing is pretty good though - it seems quick!

Any questions, just shout
Mat
Reply all
Reply to author
Forward
0 new messages