HBASE-6858 Fix the incorrect BADVERSION checking in the recoverable zookeeper

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

View File

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