From 226672c55f99ee7854a174e50063e816a2af2337 Mon Sep 17 00:00:00 2001 From: Jonathan M Hsieh Date: Mon, 21 Jul 2014 18:50:32 -0700 Subject: [PATCH] HBASE-11561 deprecate ImmutableBytesWritable.getSize and replace with getLength --- .../apache/hadoop/hbase/io/ImmutableBytesWritable.java | 8 ++++---- .../apache/hadoop/hbase/MapFilePerformanceEvaluation.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ImmutableBytesWritable.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ImmutableBytesWritable.java index 7a13392cd39..eabc273cadd 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ImmutableBytesWritable.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ImmutableBytesWritable.java @@ -33,7 +33,7 @@ import org.apache.hadoop.io.WritableComparator; /** * A byte sequence that is usable as a key or value. Based on * {@link org.apache.hadoop.io.BytesWritable} only this class is NOT resizable - * and DOES NOT distinguish between the size of the seqeunce and the current + * and DOES NOT distinguish between the size of the sequence and the current * capacity as {@link org.apache.hadoop.io.BytesWritable} does. Hence its * comparatively 'immutable'. When creating a new instance of this class, * the underlying byte [] is not copied, just referenced. The backing @@ -71,7 +71,7 @@ implements WritableComparable { * @param ibw the value to set this ImmutableBytesWritable to. */ public ImmutableBytesWritable(final ImmutableBytesWritable ibw) { - this(ibw.get(), ibw.getOffset(), ibw.getSize()); + this(ibw.get(), ibw.getOffset(), ibw.getLength()); } /** @@ -119,7 +119,9 @@ implements WritableComparable { /** * @return the number of valid bytes in the buffer + * @deprecated use {@link #getLength()} instead */ + @Deprecated public int getSize() { if (this.bytes == null) { throw new IllegalStateException("Uninitialiized. Null constructor " + @@ -131,8 +133,6 @@ implements WritableComparable { /** * @return the number of valid bytes in the buffer */ - //Should probably deprecate getSize() so that we keep the same calls for all - //byte [] public int getLength() { if (this.bytes == null) { throw new IllegalStateException("Uninitialiized. Null constructor " + diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/MapFilePerformanceEvaluation.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/MapFilePerformanceEvaluation.java index ec47318a2d0..e4ed1a81cfe 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/MapFilePerformanceEvaluation.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/MapFilePerformanceEvaluation.java @@ -252,7 +252,7 @@ public class MapFilePerformanceEvaluation { this.reader.next(key, value); PerformanceEvaluationCommons.assertKey(this.key.get(), format(i, this.verify).get()); - PerformanceEvaluationCommons.assertValueSize(ROW_LENGTH, value.getSize()); + PerformanceEvaluationCommons.assertValueSize(ROW_LENGTH, value.getLength()); } @Override @@ -275,7 +275,7 @@ public class MapFilePerformanceEvaluation { void doRow(int i) throws Exception { ImmutableBytesWritable k = getRandomRow(); ImmutableBytesWritable r = (ImmutableBytesWritable)reader.get(k, value); - PerformanceEvaluationCommons.assertValueSize(r.getSize(), ROW_LENGTH); + PerformanceEvaluationCommons.assertValueSize(r.getLength(), ROW_LENGTH); } private ImmutableBytesWritable getRandomRow() { @@ -304,7 +304,7 @@ public class MapFilePerformanceEvaluation { // TODO: Verify we're getting right values. for (int ii = 0; ii < 29; ii++) { this.reader.next(this.key, this.value); - PerformanceEvaluationCommons.assertValueSize(this.value.getSize(), ROW_LENGTH); + PerformanceEvaluationCommons.assertValueSize(this.value.getLength(), ROW_LENGTH); } } @@ -325,7 +325,7 @@ public class MapFilePerformanceEvaluation { void doRow(int i) throws Exception { ImmutableBytesWritable k = getGaussianRandomRow(); ImmutableBytesWritable r = (ImmutableBytesWritable)reader.get(k, value); - PerformanceEvaluationCommons.assertValueSize(r.getSize(), ROW_LENGTH); + PerformanceEvaluationCommons.assertValueSize(r.getLength(), ROW_LENGTH); } private ImmutableBytesWritable getGaussianRandomRow() {