You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2015/05/12 18:46:02 UTC
hbase git commit: HBASE-13579 Avoid isCellTTLExpired() for NO-TAG
cases (Ramkrishna S. Vasudevan)
Repository: hbase
Updated Branches:
refs/heads/0.98 8774b463a -> ba58da6b0
HBASE-13579 Avoid isCellTTLExpired() for NO-TAG cases (Ramkrishna S. Vasudevan)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/ba58da6b
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/ba58da6b
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/ba58da6b
Branch: refs/heads/0.98
Commit: ba58da6b0dafd1244de2f2d3550bf1ba3ce221df
Parents: 8774b46
Author: Andrew Purtell <ap...@apache.org>
Authored: Tue May 12 09:41:51 2015 -0700
Committer: Andrew Purtell <ap...@apache.org>
Committed: Tue May 12 09:43:25 2015 -0700
----------------------------------------------------------------------
.../org/apache/hadoop/hbase/NoTagsKeyValue.java | 47 ++++++++++++++++++++
.../hadoop/hbase/io/hfile/HFileReaderV2.java | 4 ++
.../hadoop/hbase/io/hfile/HFileReaderV3.java | 18 ++++++++
3 files changed, 69 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/ba58da6b/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..2c6b170
--- /dev/null
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/NoTagsKeyValue.java
@@ -0,0 +1,47 @@
+/**
+ * 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
+ @Deprecated
+ public short getTagsLength() {
+ return (short) getTagsLengthUnsigned();
+ }
+
+ /**
+ * This returns the total length of the tag bytes
+ */
+ @Override
+ @Deprecated
+ public int getTagsLengthUnsigned() {
+ return 0;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hbase/blob/ba58da6b/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 ec3635b..933e773 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
@@ -684,6 +684,10 @@ public class HFileReaderV2 extends AbstractHFileReader {
if (!isSeeked())
return null;
+ return formKeyValue();
+ }
+
+ protected KeyValue formKeyValue() {
KeyValue ret = new KeyValue(blockBuffer.array(), blockBuffer.arrayOffset()
+ blockBuffer.position(), getCellBufSize());
if (this.reader.shouldIncludeMemstoreTS()) {
http://git-wip-us.apache.org/repos/asf/hbase/blob/ba58da6b/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 94fb7b2..fb9fd16 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
@@ -27,6 +27,8 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
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;
@@ -186,6 +188,22 @@ public class HFileReaderV3 extends HFileReaderV2 {
return kvBufSize;
}
+ @Override
+ public KeyValue getKeyValue() {
+ if (!isSeeked())
+ return null;
+ if (currTagsLen > 0) {
+ return formKeyValue();
+ } else {
+ NoTagsKeyValue ret = new NoTagsKeyValue(blockBuffer.array(), blockBuffer.arrayOffset()
+ + blockBuffer.position(), getCellBufSize());
+ if (this.reader.shouldIncludeMemstoreTS()) {
+ ret.setMvccVersion(currMemstoreTS);
+ }
+ return ret;
+ }
+ }
+
protected void setNonSeekedState() {
super.setNonSeekedState();
currTagsLen = 0;