HBASE-6858 Fix the incorrect BADVERSION checking in the recoverable zookeeper; REVERT.... BROKE

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1388725 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2012-09-21 23:23:25 +00:00
parent 529807b0e5
commit e30829d8c1
1 changed files with 6 additions and 3 deletions

View File

@ -357,9 +357,12 @@ public class RecoverableZooKeeper {
try{
Stat stat = new Stat();
byte[] revData = zk.getData(path, false, stat);
int idLength = Bytes.toInt(revData, MAGIC_OFFSET);
if (Bytes.compareTo(revData, MAGIC_OFFSET + ID_OFFSET, idLength,
id, 0, id.length) == 0) {
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) {
// the bad version is caused by previous successful setData
return stat;
}