hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramkris...@apache.org
Subject hbase git commit: HBASE-13579 Avoid isCellTTLExpired() for NO-TAG cases (Ram)
Date Thu, 30 Apr 2015 09:45:33 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 558cac91d -> 3a9c2b0c5


HBASE-13579 Avoid isCellTTLExpired() for NO-TAG cases (Ram)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/3a9c2b0c
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/3a9c2b0c
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/3a9c2b0c

Branch: refs/heads/master
Commit: 3a9c2b0c5510c499371e9f387fa85c5fdeb76628
Parents: 558cac9
Author: ramkrishna <ramkrishna.s.vasudevan@gmail.com>
Authored: Thu Apr 30 15:14:41 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasudevan@gmail.com>
Committed: Thu Apr 30 15:14:41 2015 +0530

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/NoTagsKeyValue.java | 37 ++++++++++++++++++++
 .../hadoop/hbase/io/hfile/HFileReaderImpl.java  | 20 ++++++++---
 2 files changed, 52 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/3a9c2b0c/hbase-common/src/main/java/org/apache/hadoop/hbase/NoTagsKeyValue.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/NoTagsKeyValue.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/NoTagsKeyValue.java
new file mode 100644
index 0000000..c4c8351
--- /dev/null
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/NoTagsKeyValue.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase;
+
+import org.apache.hadoop.hbase.classification.InterfaceAudience;
+
+/**
+ * An extension of the KeyValue where the tags length is always 0 
+ */
+@InterfaceAudience.Private
+public class NoTagsKeyValue extends KeyValue {
+  public NoTagsKeyValue(byte[] bytes, int offset, int length) {
+    super(bytes, offset, length);
+  }
+
+  @Override
+  public int getTagsLength() {
+    return 0;
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hbase/blob/3a9c2b0c/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java
index 81758f7..6e55901 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java
@@ -36,6 +36,7 @@ import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.CellUtil;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.NoTagsKeyValue;
 import org.apache.hadoop.hbase.KeyValue.KVComparator;
 import org.apache.hadoop.hbase.fs.HFileSystem;
 import org.apache.hadoop.hbase.io.FSDataInputStreamWrapper;
@@ -823,12 +824,21 @@ public class HFileReaderImpl implements HFile.Reader, Configurable {
       if (!isSeeked())
         return null;
 
-      KeyValue ret = new KeyValue(blockBuffer.array(), blockBuffer.arrayOffset()
-          + blockBuffer.position(), getCellBufSize());
-      if (this.reader.shouldIncludeMemstoreTS()) {
-        ret.setSequenceId(currMemstoreTS);
+      if(currTagsLen > 0) {
+        KeyValue ret = new KeyValue(blockBuffer.array(), blockBuffer.arrayOffset()
+            + blockBuffer.position(), getCellBufSize());
+        if (this.reader.shouldIncludeMemstoreTS()) {
+          ret.setSequenceId(currMemstoreTS);
+        }
+        return ret;
+      } else {
+        NoTagsKeyValue ret = new NoTagsKeyValue(blockBuffer.array(),
+            blockBuffer.arrayOffset() + blockBuffer.position(), getCellBufSize());
+        if (this.reader.shouldIncludeMemstoreTS()) {
+          ret.setSequenceId(currMemstoreTS);
+        }
+        return ret;
       }
-      return ret;
     }
 
     @Override


Mime
View raw message