You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by Demai Ni <ni...@gmail.com> on 2013/12/17 03:13:14 UTC

question about how to add a new field in matching in ClusterStatusProtos:ServerLoad

hi, folks,

I am reading the code inside ClusterStatusProtos:ServerLoad, and couldn't
figure out some simple logic when trying to add a new field. Can someone
enlighten me please?

-----------------------------------------------
I use the trunk version for @line
@4517~4580, is there a relationship between the tag value and the bitField
value?
  switch (tag) {
...
.           case *64*: {
              bitField0_ |=* 0x00000020*;
              reportEndTime_ = input.readUInt64();
              break;
            }
....
            case *72*: {
              bitField0_ |= *0x00000040*;
              infoServerPort_ = input.readUInt32();
              break;
            }
@4993: at the write, the tag is *9*, but from the read above it is *72*?
if (((bitField0_ & 0x00000040) == 0x00000040)) {
        output.writeUInt32(*9*, infoServerPort_);
--------------------------------------------------

so if I'd like to add a new field(say a String), what kind of tag value I
should use? many thanks

Demai

Re: question about how to add a new field in matching in ClusterStatusProtos:ServerLoad

Posted by Demai Ni <ni...@gmail.com>.
after made and installed protoc 2.5, everything works fine now. Many thanks
for the help

Demai


On Mon, Dec 16, 2013 at 7:13 PM, Demai Ni <ni...@gmail.com> wrote:

> Sergey,
>
> thanks a lot. This is the first time I am playing with proto buffer. You
> saved me a lot of time.
>
> I used yum to install a protoc on my redhat, which is 2.3.0($protoc
> --version: libprotoc 2.3.0). Do I have to use the latest 2.5.0? Because
> the command encounters a lot of errors like when run under hbase/hbase-protocol
> folder
>
> Cell.proto:23:8: Option "java_generate_equals_and_hash" unknown.
> HBase.proto: Import "Cell.proto" was not found or had errors.
> AccessControl.proto: Import "HBase.proto" was not found or had errors.
> AccessControl.proto:47:14: "TableName" is not defined.
> AccessControl.proto:95:12: "TableName" is not defined.
> Cell.proto:23:8: Option "java_generate_equals_and_hash" unknown.
> ....
>
>
> I copy/paste the whole bash output here: http://pastebin.com/KwwwPYLz
>
> thanks
>
> Demai
>
>
>
>
>
> On Mon, Dec 16, 2013 at 6:25 PM, Sergey Shelukhin <se...@hortonworks.com>wrote:
>
>> This is generated protobuf code.
>> You just need to edit .proto file and generate code; see
>> ./hbase-protocol/README.txt
>>
>>
>> On Mon, Dec 16, 2013 at 6:13 PM, Demai Ni <ni...@gmail.com> wrote:
>>
>> > hi, folks,
>> >
>> > I am reading the code inside ClusterStatusProtos:ServerLoad, and
>> couldn't
>> > figure out some simple logic when trying to add a new field. Can someone
>> > enlighten me please?
>> >
>> > -----------------------------------------------
>> > I use the trunk version for @line
>> > @4517~4580, is there a relationship between the tag value and the
>> bitField
>> > value?
>> >   switch (tag) {
>> > ...
>> > .           case *64*: {
>> >               bitField0_ |=* 0x00000020*;
>> >               reportEndTime_ = input.readUInt64();
>> >               break;
>> >             }
>> > ....
>> >             case *72*: {
>> >               bitField0_ |= *0x00000040*;
>> >               infoServerPort_ = input.readUInt32();
>> >               break;
>> >             }
>> > @4993: at the write, the tag is *9*, but from the read above it is *72*?
>> > if (((bitField0_ & 0x00000040) == 0x00000040)) {
>> >         output.writeUInt32(*9*, infoServerPort_);
>> > --------------------------------------------------
>> >
>> > so if I'd like to add a new field(say a String), what kind of tag value
>> I
>> > should use? many thanks
>> >
>> > Demai
>> >
>>
>> --
>> CONFIDENTIALITY NOTICE
>> NOTICE: This message is intended for the use of the individual or entity
>> to
>> which it is addressed and may contain information that is confidential,
>> privileged and exempt from disclosure under applicable law. If the reader
>> of this message is not the intended recipient, you are hereby notified
>> that
>> any printing, copying, dissemination, distribution, disclosure or
>> forwarding of this communication is strictly prohibited. If you have
>> received this communication in error, please contact the sender
>> immediately
>> and delete it from your system. Thank You.
>>
>
>

Re: question about how to add a new field in matching in ClusterStatusProtos:ServerLoad

Posted by Demai Ni <ni...@gmail.com>.
Sergey,

thanks a lot. This is the first time I am playing with proto buffer. You
saved me a lot of time.

I used yum to install a protoc on my redhat, which is 2.3.0($protoc
--version: libprotoc 2.3.0). Do I have to use the latest 2.5.0? Because the
command encounters a lot of errors like when run under hbase/hbase-protocol
folder

Cell.proto:23:8: Option "java_generate_equals_and_hash" unknown.
HBase.proto: Import "Cell.proto" was not found or had errors.
AccessControl.proto: Import "HBase.proto" was not found or had errors.
AccessControl.proto:47:14: "TableName" is not defined.
AccessControl.proto:95:12: "TableName" is not defined.
Cell.proto:23:8: Option "java_generate_equals_and_hash" unknown.
....


I copy/paste the whole bash output here: http://pastebin.com/KwwwPYLz

thanks

Demai





On Mon, Dec 16, 2013 at 6:25 PM, Sergey Shelukhin <se...@hortonworks.com>wrote:

> This is generated protobuf code.
> You just need to edit .proto file and generate code; see
> ./hbase-protocol/README.txt
>
>
> On Mon, Dec 16, 2013 at 6:13 PM, Demai Ni <ni...@gmail.com> wrote:
>
> > hi, folks,
> >
> > I am reading the code inside ClusterStatusProtos:ServerLoad, and couldn't
> > figure out some simple logic when trying to add a new field. Can someone
> > enlighten me please?
> >
> > -----------------------------------------------
> > I use the trunk version for @line
> > @4517~4580, is there a relationship between the tag value and the
> bitField
> > value?
> >   switch (tag) {
> > ...
> > .           case *64*: {
> >               bitField0_ |=* 0x00000020*;
> >               reportEndTime_ = input.readUInt64();
> >               break;
> >             }
> > ....
> >             case *72*: {
> >               bitField0_ |= *0x00000040*;
> >               infoServerPort_ = input.readUInt32();
> >               break;
> >             }
> > @4993: at the write, the tag is *9*, but from the read above it is *72*?
> > if (((bitField0_ & 0x00000040) == 0x00000040)) {
> >         output.writeUInt32(*9*, infoServerPort_);
> > --------------------------------------------------
> >
> > so if I'd like to add a new field(say a String), what kind of tag value I
> > should use? many thanks
> >
> > Demai
> >
>
> --
> CONFIDENTIALITY NOTICE
> NOTICE: This message is intended for the use of the individual or entity to
> which it is addressed and may contain information that is confidential,
> privileged and exempt from disclosure under applicable law. If the reader
> of this message is not the intended recipient, you are hereby notified that
> any printing, copying, dissemination, distribution, disclosure or
> forwarding of this communication is strictly prohibited. If you have
> received this communication in error, please contact the sender immediately
> and delete it from your system. Thank You.
>

Re: question about how to add a new field in matching in ClusterStatusProtos:ServerLoad

Posted by Sergey Shelukhin <se...@hortonworks.com>.
This is generated protobuf code.
You just need to edit .proto file and generate code; see
./hbase-protocol/README.txt


On Mon, Dec 16, 2013 at 6:13 PM, Demai Ni <ni...@gmail.com> wrote:

> hi, folks,
>
> I am reading the code inside ClusterStatusProtos:ServerLoad, and couldn't
> figure out some simple logic when trying to add a new field. Can someone
> enlighten me please?
>
> -----------------------------------------------
> I use the trunk version for @line
> @4517~4580, is there a relationship between the tag value and the bitField
> value?
>   switch (tag) {
> ...
> .           case *64*: {
>               bitField0_ |=* 0x00000020*;
>               reportEndTime_ = input.readUInt64();
>               break;
>             }
> ....
>             case *72*: {
>               bitField0_ |= *0x00000040*;
>               infoServerPort_ = input.readUInt32();
>               break;
>             }
> @4993: at the write, the tag is *9*, but from the read above it is *72*?
> if (((bitField0_ & 0x00000040) == 0x00000040)) {
>         output.writeUInt32(*9*, infoServerPort_);
> --------------------------------------------------
>
> so if I'd like to add a new field(say a String), what kind of tag value I
> should use? many thanks
>
> Demai
>

-- 
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to 
which it is addressed and may contain information that is confidential, 
privileged and exempt from disclosure under applicable law. If the reader 
of this message is not the intended recipient, you are hereby notified that 
any printing, copying, dissemination, distribution, disclosure or 
forwarding of this communication is strictly prohibited. If you have 
received this communication in error, please contact the sender immediately 
and delete it from your system. Thank You.