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 05:00:46 GMT
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?

St.Ack



>                 // the bad version is caused by previous successful setData
>                 return stat;
>               }
>             } catch(KeeperException keeperException){
>               // the ZK is not reliable at this moment. just throwing
> exception
>               throw keeperException;
>             }
>
> Kaka Chen

Mime
View raw message