On Thu, Sep 20, 2012 at 10:00 PM, Stack <[email protected]> wrote: > On Thu, Sep 20, 2012 at 8:32 PM, kaka chen <[email protected]> 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
