This is an automated email from the ASF dual-hosted git repository. zhangduo pushed a commit to branch branch-3 in repository https://gitbox.apache.org/repos/asf/hbase.git
commit 5deeb173b3a9890e6f184ef7c2b20f2a45fe15f1 Author: Duo Zhang <[email protected]> AuthorDate: Fri May 17 22:06:11 2024 +0800 HBASE-28578 Remove deprecated methods in HFileScanner (#5885) Signed-off-by: Xin Sun <[email protected]> (cherry picked from commit 2dbbcdf84932387f4f192e0e9232a294c9b7d642) --- .../apache/hadoop/hbase/io/HalfStoreFileReader.java | 14 -------------- .../hadoop/hbase/io/hfile/HFileReaderImpl.java | 21 --------------------- .../apache/hadoop/hbase/io/hfile/HFileScanner.java | 18 ------------------ .../apache/hadoop/hbase/io/hfile/TestReseekTo.java | 5 +++-- 4 files changed, 3 insertions(+), 55 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HalfStoreFileReader.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HalfStoreFileReader.java index 2119a3e7cbe..f4cccfd03b0 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HalfStoreFileReader.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HalfStoreFileReader.java @@ -105,13 +105,6 @@ public class HalfStoreFileReader extends StoreFileReader { return delegate.getKey(); } - @Override - public String getKeyString() { - if (atEnd) return null; - - return delegate.getKeyString(); - } - @Override public ByteBuffer getValue() { if (atEnd) return null; @@ -119,13 +112,6 @@ public class HalfStoreFileReader extends StoreFileReader { return delegate.getValue(); } - @Override - public String getValueString() { - if (atEnd) return null; - - return delegate.getValueString(); - } - @Override public Cell getCell() { if (atEnd) return null; 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 9c9b38c4906..e0585c6edaa 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 @@ -1040,16 +1040,6 @@ public abstract class HFileReaderImpl implements HFile.Reader, Configurable { } } - @Override - public String getKeyString() { - return CellUtil.toString(getKey(), false); - } - - @Override - public String getValueString() { - return ByteBufferUtils.toStringBinary(getValue()); - } - public int compareKey(CellComparator comparator, Cell key) { blockBuffer.asSubByteBuffer(blockBuffer.position() + KEY_VALUE_LEN_SIZE, currKeyLen, pair); this.bufBackedKeyOnlyKv.setKey(pair.getFirst(), pair.getSecond(), currKeyLen, rowLen); @@ -1571,17 +1561,6 @@ public abstract class HFileReaderImpl implements HFile.Reader, Configurable { return seeker.getCell(); } - @Override - public String getKeyString() { - return CellUtil.toString(getKey(), false); - } - - @Override - public String getValueString() { - ByteBuffer valueBuffer = getValue(); - return ByteBufferUtils.toStringBinary(valueBuffer); - } - private void assertValidSeek() { if (this.curBlock == null) { throw new NotSeekedException(reader.getPath()); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileScanner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileScanner.java index 0393d3b788a..b0022788c38 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileScanner.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileScanner.java @@ -106,24 +106,6 @@ public interface HFileScanner extends Shipper, Closeable { /** Returns Instance of {@link org.apache.hadoop.hbase.Cell}. */ Cell getCell(); - /** - * Convenience method to get a copy of the key as a string - interpreting the bytes as UTF8. You - * must call {@link #seekTo(Cell)} before this method. - * @return key as a string - * @deprecated Since hbase-2.0.0 - */ - @Deprecated - String getKeyString(); - - /** - * Convenience method to get a copy of the value as a string - interpreting the bytes as UTF8. You - * must call {@link #seekTo(Cell)} before this method. - * @return value as a string - * @deprecated Since hbase-2.0.0 - */ - @Deprecated - String getValueString(); - /** Returns Reader that underlies this Scanner instance. */ HFile.Reader getReader(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestReseekTo.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestReseekTo.java index c757798a394..b40f39777d8 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestReseekTo.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestReseekTo.java @@ -32,6 +32,7 @@ import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.Tag; import org.apache.hadoop.hbase.testclassification.IOTests; import org.apache.hadoop.hbase.testclassification.SmallTests; +import org.apache.hadoop.hbase.util.ByteBufferUtils; import org.apache.hadoop.hbase.util.Bytes; import org.junit.ClassRule; import org.junit.Test; @@ -118,7 +119,7 @@ public class TestReseekTo { long start = System.nanoTime(); scanner.seekTo(new KeyValue(Bytes.toBytes(key), Bytes.toBytes("family"), Bytes.toBytes("qual"), Bytes.toBytes(value))); - assertEquals(value, scanner.getValueString()); + assertEquals(value, ByteBufferUtils.toStringBinary(scanner.getValue())); } scanner.seekTo(); @@ -128,7 +129,7 @@ public class TestReseekTo { long start = System.nanoTime(); scanner.reseekTo(new KeyValue(Bytes.toBytes(key), Bytes.toBytes("family"), Bytes.toBytes("qual"), Bytes.toBytes(value))); - assertEquals("i is " + i, value, scanner.getValueString()); + assertEquals("i is " + i, value, ByteBufferUtils.toStringBinary(scanner.getValue())); } reader.close();
