hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stack <st...@duboce.net>
Subject Re: Confused about the process of handle BADVERSION at setData() method in RecoverableZookeeper.java
Date Fri, 21 Sep 2012 21:02:11 GMT
On Thu, Sep 20, 2012 at 10:00 PM, Stack <stack@duboce.net> wrote:
> On Thu, Sep 20, 2012 at 8:32 PM, kaka chen <kaka11.chen@gmail.com> wrote:
>> Hi All:
>>     Can someone explain the handle BADVERSION at setData() method in
>> RecoverableZookeeper.java, I am very confused. The meta data is MAGIC(1
>> BYTE) + LENGTH_FIELD(4 BYTE) + ID + DATA, but the parsing is very strange,
>> and why to compare id with data? Please help me, thanks!
>>
>>             case BADVERSION:
>>             // try to verify whether the previous setData success or not
>>             try{
>>               Stat stat = new Stat();
>>               byte[] revData = zk.getData(path, false, stat);
>>               int idLength = Bytes.toInt(revData, ID_LENGTH_SIZE);
>>               int dataLength = revData.length-ID_LENGTH_SIZE-idLength;
>>               int dataOffset = ID_LENGTH_SIZE+idLength;
>>
>>               if(Bytes.compareTo(revData, ID_LENGTH_SIZE, id.length,
>>                   revData, dataOffset, dataLength) == 0) {
>
>
> I don't know.  The above looks wong to me.  Maybe if I read more of
> RecoverableZooKeeper, it'd make sense (but I doubt it).
>
> Se we tried to setData but the version proffered was wrong; someone
> else had changed it on us.
>
> Is there a broader context?
>

I asked the author Liyin and he looked at it.  Says its a bug too.  He
hopes to fix it (I made
https://issues.apache.org/jira/browse/HBASE-6859).  Do you have a fix?

Thanks,
St.Ack

Mime
View raw message