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 2015/05/06 08:43:09 UTC
hbase git commit: HBASE-13579 - Avoid isCellTTLExpired() for NO-TAG
cases (Ram)
Repository: hbase
Updated Branches:
refs/heads/branch-1 308d51594 -> 426c7eef0
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/426c7eef
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/426c7eef
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/426c7eef
Branch: refs/heads/branch-1
Commit: 426c7eef09af0a4f306c6cc0f70f994b01f68ad6
Parents: 308d515
Author: ramkrishna <ra...@gmail.com>
Authored: Wed May 6 12:10:31 2015 +0530
Committer: ramkrishna <ra...@gmail.com>
Committed: Wed May 6 12:12:39 2015 +0530
----------------------------------------------------------------------
.../org/apache/hadoop/hbase/NoTagsKeyValue.java | 37 ++++++++++++++++++++
.../hadoop/hbase/io/hfile/HFileReaderV2.java | 7 +++-
.../hadoop/hbase/io/hfile/HFileReaderV3.java | 17 +++++++++
3 files changed, 60 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/426c7eef/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/426c7eef/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
index b30d5c2..1775230 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
@@ -33,6 +33,7 @@ import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.KeyValue.KVComparator;
+import org.apache.hadoop.hbase.NoTagsKeyValue;
import org.apache.hadoop.hbase.fs.HFileSystem;
import org.apache.hadoop.hbase.io.FSDataInputStreamWrapper;
import org.apache.hadoop.hbase.io.encoding.DataBlockEncoder;
@@ -747,7 +748,11 @@ public class HFileReaderV2 extends AbstractHFileReader {
if (!isSeeked())
return null;
- KeyValue ret = new KeyValue(blockBuffer.array(), blockBuffer.arrayOffset()
+ return formNoTagsKeyValue();
+ }
+
+ protected Cell formNoTagsKeyValue() {
+ NoTagsKeyValue ret = new NoTagsKeyValue(blockBuffer.array(), blockBuffer.arrayOffset()
+ blockBuffer.position(), getCellBufSize());
if (this.reader.shouldIncludeMemstoreTS()) {
ret.setSequenceId(currMemstoreTS);
http://git-wip-us.apache.org/repos/asf/hbase/blob/426c7eef/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV3.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV3.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV3.java
index f881ff5a..b5cadb1 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV3.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV3.java
@@ -30,6 +30,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.fs.HFileSystem;
import org.apache.hadoop.hbase.io.FSDataInputStreamWrapper;
import org.apache.hadoop.hbase.io.crypto.Cipher;
@@ -190,6 +191,22 @@ public class HFileReaderV3 extends HFileReaderV2 {
return kvBufSize;
}
+ @Override
+ public Cell getKeyValue() {
+ if (!isSeeked())
+ return null;
+ if (currTagsLen > 0) {
+ KeyValue ret = new KeyValue(blockBuffer.array(), blockBuffer.arrayOffset()
+ + blockBuffer.position(), getCellBufSize());
+ if (this.reader.shouldIncludeMemstoreTS()) {
+ ret.setSequenceId(currMemstoreTS);
+ }
+ return ret;
+ } else {
+ return formNoTagsKeyValue();
+ }
+ }
+
protected void setNonSeekedState() {
super.setNonSeekedState();
currTagsLen = 0;