hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Yates <jesse.k.ya...@gmail.com>
Subject Re: Use of required keyword in protobuf messages
Date Tue, 07 Aug 2012 16:25:48 GMT
On Tue, Aug 7, 2012 at 12:47 AM, Stack <stack@duboce.net> wrote:

> On Mon, Aug 6, 2012 at 11:39 PM, Chris Trezzo <ctrezzo@gmail.com> wrote:
> > Some engineers at Google have come to the conclusion that using
> > requireddoes more harm than good; they prefer to use only
> > optional and repeated. However, this view is not universal."
> >
> > Thoughts?
> >
> How hard adding the logic Chris?  Any 'costs' associated.
> St.Ack

I've found (in my limited experience) that it ends up being a single
helper/util function per message, though at worst it can be one helper per
element in the message. The latter comes about if you have an optional
element that also has some optional elements. In that case you need to make
sure that (1) the message content there and (2) enough of the content is

Fortunately, this is usually a pretty fast check, just checking the
presence of fields per RPC (and each object has generated has___() methods
for this checking), so its not too terrible since the boolean checks are
pretty fast (and using generalized RPC already has a bunch of overhead too

This can theoretically lead to a proliferation of helper functions that
validate message/message contents for lots of different cases. In reality
though, I think this ends up being at most 2-3 per message type (at
_worst_) given then relative simplicity of our RPCs. If we go with this, we
will probably have to a have a helper/validator cleanup when its gets out
of control.

Jesse Yates

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message