You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ra...@apache.org on 2016/07/18 04:47:00 UTC
hbase git commit: HBASE-16189 [Rolling Upgrade] 2.0 hfiles cannot be
opened by 1.x servers (Ram)
Repository: hbase
Updated Branches:
refs/heads/branch-1 1e3bce943 -> cfc22ec1e
HBASE-16189 [Rolling Upgrade] 2.0 hfiles cannot be opened by 1.x servers
(Ram)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/cfc22ec1
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/cfc22ec1
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/cfc22ec1
Branch: refs/heads/branch-1
Commit: cfc22ec1ecf5ccaba882c78daf46960f0b5c2510
Parents: 1e3bce9
Author: Ramkrishna <ra...@intel.com>
Authored: Mon Jul 18 10:16:23 2016 +0530
Committer: Ramkrishna <ra...@intel.com>
Committed: Mon Jul 18 10:16:23 2016 +0530
----------------------------------------------------------------------
.../apache/hadoop/hbase/io/hfile/FixedFileTrailer.java | 9 ++++++++-
.../apache/hadoop/hbase/util/CompoundBloomFilter.java | 12 ++++++++++--
2 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/cfc22ec1/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/FixedFileTrailer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/FixedFileTrailer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/FixedFileTrailer.java
index 6735036..f6ae291 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/FixedFileTrailer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/FixedFileTrailer.java
@@ -570,10 +570,17 @@ public class FixedFileTrailer {
comparatorClassName = KeyValue.META_COMPARATOR.getClass().getName();
} else if (comparatorClassName.equals(KeyValue.RAW_COMPARATOR.getLegacyKeyComparatorName())) {
comparatorClassName = KeyValue.RAW_COMPARATOR.getClass().getName();
+ } else if (comparatorClassName.equals("org.apache.hadoop.hbase.CellComparator")) {
+ // 2.0 based comparators found in class name. Convert it to corresponding Comparators in 1.x
+ // branch. Refer to HBASE-16189
+ comparatorClassName = KeyValue.COMPARATOR.getClass().getName();
+ } else if ((comparatorClassName
+ .equals("org.apache.hadoop.hbase.CellComparator$MetaCellComparator"))) {
+ // Refer to HBASE-16189. Fallback to 1.x comparators
+ comparatorClassName = KeyValue.META_COMPARATOR.getClass().getName();
}
// if the name wasn't one of the legacy names, maybe its a legit new kind of comparator.
-
return (Class<? extends KVComparator>)
Class.forName(comparatorClassName);
} catch (ClassNotFoundException ex) {
http://git-wip-us.apache.org/repos/asf/hbase/blob/cfc22ec1/hbase-server/src/main/java/org/apache/hadoop/hbase/util/CompoundBloomFilter.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/CompoundBloomFilter.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/CompoundBloomFilter.java
index beda805..23f1c1a 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/CompoundBloomFilter.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/CompoundBloomFilter.java
@@ -24,6 +24,7 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
+import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.KeyValue.KVComparator;
import org.apache.hadoop.hbase.io.hfile.BlockType;
import org.apache.hadoop.hbase.io.hfile.FixedFileTrailer;
@@ -70,8 +71,15 @@ public class CompoundBloomFilter extends CompoundBloomFilterBase
totalKeyCount = meta.readLong();
totalMaxKeys = meta.readLong();
numChunks = meta.readInt();
- comparator = FixedFileTrailer.createComparator(
- Bytes.toString(Bytes.readByteArray(meta)));
+ byte[] comparatorClassName = Bytes.readByteArray(meta);
+ if (comparatorClassName.length != 0) {
+ comparator = FixedFileTrailer.createComparator(Bytes.toString(comparatorClassName));
+ } else {
+ // Fallback. In 2.0 we will not write the RAW_COMPARATOR name. So when reading back such meta
+ // data. Refer to HBASE-16189
+ // we set the comparator to RAW_COMPARATOR
+ comparator = KeyValue.RAW_COMPARATOR;
+ }
hash = Hash.getInstance(hashType);
if (hash == null) {