From 529807b0e5ccdf7dcaaef22bb78c3e41f2475b3e Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Fri, 21 Sep 2012 21:52:02 +0000 Subject: [PATCH] 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 --- .../hadoop/hbase/zookeeper/RecoverableZooKeeper.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java index 2b71860e3d4..586fe696ac6 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/RecoverableZooKeeper.java @@ -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; }