Skip to content

Commit ca0a645

Browse files
committed
fix test
1 parent 3290962 commit ca0a645

File tree

14 files changed

+44
-53
lines changed

14 files changed

+44
-53
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,9 +1649,9 @@ public boolean prefetchStarted() {
16491649

16501650
/**
16511651
* Create a Scanner on this file. No seeks or reads are done on creation. Call
1652-
* {@link HFileScanner#seekTo(Cell)} to position an start the read. There is nothing to clean up
1653-
* in a Scanner. Letting go of your references to the scanner is sufficient. NOTE: Do not use this
1654-
* overload of getScanner for compactions. See
1652+
* {@link HFileScanner#seekTo(ExtendedCell)} to position an start the read. There is nothing to
1653+
* clean up in a Scanner. Letting go of your references to the scanner is sufficient. NOTE: Do not
1654+
* use this overload of getScanner for compactions. See
16551655
* {@link #getScanner(Configuration, boolean, boolean, boolean)}
16561656
* @param conf Store configuration.
16571657
* @param cacheBlocks True if we should cache blocks read in by this scanner.
@@ -1666,8 +1666,8 @@ public HFileScanner getScanner(Configuration conf, boolean cacheBlocks, final bo
16661666

16671667
/**
16681668
* Create a Scanner on this file. No seeks or reads are done on creation. Call
1669-
* {@link HFileScanner#seekTo(Cell)} to position an start the read. There is nothing to clean up
1670-
* in a Scanner. Letting go of your references to the scanner is sufficient.
1669+
* {@link HFileScanner#seekTo(ExtendedCell)} to position an start the read. There is nothing to
1670+
* clean up in a Scanner. Letting go of your references to the scanner is sufficient.
16711671
* @param conf Store configuration.
16721672
* @param cacheBlocks True if we should cache blocks read in by this scanner.
16731673
* @param pread Use positional read rather than seek+read if true (pread is better for

hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileScanner.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.io.IOException;
2222
import java.nio.ByteBuffer;
2323
import java.util.function.IntConsumer;
24-
import org.apache.hadoop.hbase.Cell;
2524
import org.apache.hadoop.hbase.ExtendedCell;
2625
import org.apache.hadoop.hbase.regionserver.Shipper;
2726
import org.apache.yetus.audience.InterfaceAudience;
@@ -31,7 +30,7 @@
3130
* reposition yourself as well.
3231
* <p>
3332
* A scanner doesn't always have a key/value that it is pointing to when it is first created and
34-
* before {@link #seekTo()}/{@link #seekTo(Cell)} are called. In this case,
33+
* before {@link #seekTo()}/{@link #seekTo(ExtendedCell)} are called. In this case,
3534
* {@link #getKey()}/{@link #getValue()} returns null. At most other times, a key and value will be
3635
* available. The general pattern is that you position the Scanner using the seekTo variants and
3736
* then getKey and getValue.
@@ -90,29 +89,30 @@ public interface HFileScanner extends Shipper, Closeable {
9089
boolean next() throws IOException;
9190

9291
/**
93-
* Gets the current key in the form of a cell. You must call {@link #seekTo(Cell)} before this
94-
* method.
92+
* Gets the current key in the form of a cell. You must call {@link #seekTo(ExtendedCell)} before
93+
* this method.
9594
* @return gets the current key as a Cell.
9695
*/
9796
ExtendedCell getKey();
9897

9998
/**
100-
* Gets a buffer view to the current value. You must call {@link #seekTo(Cell)} before this
101-
* method.
99+
* Gets a buffer view to the current value. You must call {@link #seekTo(ExtendedCell)} before
100+
* this method.
102101
* @return byte buffer for the value. The limit is set to the value size, and the position is 0,
103102
* the start of the buffer view.
104103
*/
105104
ByteBuffer getValue();
106105

107-
/** Returns Instance of {@link org.apache.hadoop.hbase.Cell}. */
106+
/** Returns Instance of {@link ExtendedCell}. */
108107
ExtendedCell getCell();
109108

110109
/** Returns Reader that underlies this Scanner instance. */
111110
HFile.Reader getReader();
112111

113112
/**
114-
* @return True is scanner has had one of the seek calls invoked; i.e. {@link #seekBefore(Cell)}
115-
* or {@link #seekTo()} or {@link #seekTo(Cell)}. Otherwise returns false.
113+
* @return True is scanner has had one of the seek calls invoked; i.e.
114+
* {@link #seekBefore(ExtendedCell)} or {@link #seekTo()} or
115+
* {@link #seekTo(ExtendedCell)}. Otherwise returns false.
116116
*/
117117
boolean isSeeked();
118118

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ImmutableMemStoreLAB.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,14 @@
2020
import com.google.errorprone.annotations.RestrictedApi;
2121
import java.util.List;
2222
import java.util.concurrent.atomic.AtomicBoolean;
23-
import org.apache.hadoop.hbase.Cell;
2423
import org.apache.hadoop.hbase.ExtendedCell;
2524
import org.apache.hadoop.hbase.nio.RefCnt;
2625
import org.apache.yetus.audience.InterfaceAudience;
2726

2827
/**
2928
* A MemStoreLAB implementation which wraps N MemStoreLABs. Its main duty is in proper managing the
3029
* close of the individual MemStoreLAB. This is treated as an immutable one and so do not allow to
31-
* add any more Cells into it. {@link #copyCellInto(Cell)} throws Exception
30+
* add any more Cells into it. {@link #copyCellInto(ExtendedCell))} throws Exception
3231
*/
3332
@InterfaceAudience.Private
3433
public class ImmutableMemStoreLAB implements MemStoreLAB {

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueHeap.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,9 @@ public void close() {
236236
* As individual scanners may run past their ends, those scanners are automatically closed and
237237
* removed from the heap.
238238
* <p>
239-
* This function (and {@link #reseek(Cell)}) does not do multi-column Bloom filter and lazy-seek
240-
* optimizations. To enable those, call {@link #requestSeek(Cell, boolean, boolean)}.
239+
* This function (and {@link #reseek(ExtendedCell)}) does not do multi-column Bloom filter and
240+
* lazy-seek optimizations. To enable those, call
241+
* {@link #requestSeek(ExtendedCell, boolean, boolean)}.
241242
* @param seekKey KeyValue to seek at or after
242243
* @return true if KeyValues exist at or after specified key, false if not
243244
*/
@@ -249,7 +250,7 @@ public boolean seek(ExtendedCell seekKey) throws IOException {
249250
}
250251

251252
/**
252-
* This function is identical to the {@link #seek(Cell)} function except that
253+
* This function is identical to the {@link #seek(ExtendedCell)} function except that
253254
* scanner.seek(seekKey) is changed to scanner.reseek(seekKey).
254255
*/
255256
@Override

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreLAB.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package org.apache.hadoop.hbase.regionserver;
1919

2020
import org.apache.hadoop.conf.Configuration;
21-
import org.apache.hadoop.hbase.Cell;
2221
import org.apache.hadoop.hbase.ExtendedCell;
2322
import org.apache.hadoop.hbase.util.ReflectionUtils;
2423
import org.apache.yetus.audience.InterfaceAudience;
@@ -39,8 +38,8 @@
3938
* collection occurs.
4039
* <p>
4140
* This manages the large sized chunks. When Cells are to be added to Memstore, MemStoreLAB's
42-
* {@link #copyCellInto(Cell)} gets called. This allocates enough size in the chunk to hold this
43-
* cell's data and copies into this area and then recreate a Cell over this copied data.
41+
* {@link #copyCellInto(ExtendedCell)} gets called. This allocates enough size in the chunk to hold
42+
* this cell's data and copies into this area and then recreate a Cell over this copied data.
4443
* <p>
4544
* @see ChunkCreator
4645
*/

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreLABImpl.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import org.apache.hadoop.hbase.ByteBufferExtendedCell;
3131
import org.apache.hadoop.hbase.Cell;
3232
import org.apache.hadoop.hbase.ExtendedCell;
33-
import org.apache.hadoop.hbase.KeyValueUtil;
3433
import org.apache.hadoop.hbase.nio.RefCnt;
3534
import org.apache.hadoop.hbase.regionserver.CompactingMemStore.IndexType;
3635
import org.apache.yetus.audience.InterfaceAudience;
@@ -219,14 +218,7 @@ private ExtendedCell copyCellInto(ExtendedCell cell, int maxAlloc) {
219218
private static ExtendedCell copyToChunkCell(ExtendedCell cell, ByteBuffer buf, int offset,
220219
int len) {
221220
int tagsLen = cell.getTagsLength();
222-
if (cell instanceof ExtendedCell) {
223-
((ExtendedCell) cell).write(buf, offset);
224-
} else {
225-
// Normally all Cell impls within Server will be of type ExtendedCell. Just considering the
226-
// other case also. The data fragments within Cell is copied into buf as in KeyValue
227-
// serialization format only.
228-
KeyValueUtil.appendTo(cell, buf, offset, true);
229-
}
221+
cell.write(buf, offset);
230222
return createChunkCell(buf, offset, len, tagsLen, cell.getSequenceId());
231223
}
232224

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ protected boolean trySkipToNextRow(ExtendedCell cell) throws IOException {
928928
}
929929

930930
/**
931-
* See {@link org.apache.hadoop.hbase.regionserver.StoreScanner#trySkipToNextRow(Cell)}
931+
* See {@link #trySkipToNextRow(ExtendedCell)}
932932
* @param cell current cell
933933
* @return true means skip to next column, false means not
934934
*/

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/querymatcher/ColumnTracker.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package org.apache.hadoop.hbase.regionserver.querymatcher;
1919

2020
import java.io.IOException;
21-
import org.apache.hadoop.hbase.Cell;
2221
import org.apache.hadoop.hbase.ExtendedCell;
2322
import org.apache.hadoop.hbase.regionserver.ShipperListener;
2423
import org.apache.hadoop.hbase.regionserver.querymatcher.ScanQueryMatcher.MatchCode;
@@ -54,9 +53,10 @@ public interface ColumnTracker extends ShipperListener {
5453
/**
5554
* Checks if the column is present in the list of requested columns by returning the match code
5655
* instance. It does not check against the number of versions for the columns asked for. To do the
57-
* version check, one has to call {@link #checkVersions(Cell, long, byte, boolean)} method based
58-
* on the return type (INCLUDE) of this method. The values that can be returned by this method are
59-
* {@link MatchCode#INCLUDE}, {@link MatchCode#SEEK_NEXT_COL} and {@link MatchCode#SEEK_NEXT_ROW}.
56+
* version check, one has to call {@link #checkVersions(ExtendedCell, long, byte, boolean)} method
57+
* based on the return type (INCLUDE) of this method. The values that can be returned by this
58+
* method are {@link MatchCode#INCLUDE}, {@link MatchCode#SEEK_NEXT_COL} and
59+
* {@link MatchCode#SEEK_NEXT_ROW}.
6060
* @param cell a cell with the column to match against
6161
* @param type The type of the Cell
6262
* @return The match code instance.
@@ -68,11 +68,11 @@ public interface ColumnTracker extends ShipperListener {
6868
/**
6969
* Keeps track of the number of versions for the columns asked for. It assumes that the user has
7070
* already checked if the cell needs to be included by calling the
71-
* {@link #checkColumn(Cell, byte)} method. The enum values returned by this method are
71+
* {@link #checkColumn(ExtendedCell, byte)} method. The enum values returned by this method are
7272
* {@link MatchCode#SKIP}, {@link MatchCode#INCLUDE}, {@link MatchCode#INCLUDE_AND_SEEK_NEXT_COL}
7373
* and {@link MatchCode#INCLUDE_AND_SEEK_NEXT_ROW}. Implementations which include all the columns
74-
* could just return {@link MatchCode#INCLUDE} in the {@link #checkColumn(Cell, byte)} method and
75-
* perform all the operations in this checkVersions method.
74+
* could just return {@link MatchCode#INCLUDE} in the {@link #checkColumn(ExtendedCell, byte)}
75+
* method and perform all the operations in this checkVersions method.
7676
* @param cell a cell with the column to match against
7777
* @param timestamp The timestamp of the cell.
7878
* @param type the type of the key value (Put/Delete)

hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,23 +341,23 @@ public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c,
341341
}
342342
}
343343
if (visibilityTags != null) {
344-
List<Cell> updatedCells = new ArrayList<>();
344+
List<ExtendedCell> updatedCells = new ArrayList<>();
345345
for (CellScanner cellScanner = m.cellScanner(); cellScanner.advance();) {
346346
Cell ce = cellScanner.current();
347347
assert ce instanceof ExtendedCell;
348-
ExtendedCell cell = (ExtendedCell) c;
348+
ExtendedCell cell = (ExtendedCell) ce;
349349
List<Tag> tags = PrivateCellUtil.getTags(cell);
350350
if (modifiedTagFound) {
351351
// Rewrite the tags by removing the modified tags.
352352
removeReplicationVisibilityTag(tags);
353353
}
354354
tags.addAll(visibilityTags);
355-
Cell updatedCell = PrivateCellUtil.createCell(cell, tags);
355+
ExtendedCell updatedCell = PrivateCellUtil.createCell(cell, tags);
356356
updatedCells.add(updatedCell);
357357
}
358358
m.getFamilyCellMap().clear();
359359
// Clear and add new Cells to the Mutation.
360-
for (Cell cell : updatedCells) {
360+
for (ExtendedCell cell : updatedCells) {
361361
if (m instanceof Put) {
362362
Put p = (Put) m;
363363
p.add(cell);

hbase-server/src/main/java/org/apache/hadoop/hbase/util/BloomContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void writeBloom(ExtendedCell cell) throws IOException {
5353
}
5454
}
5555

56-
private void sanityCheck(Cell cell) throws IOException {
56+
private void sanityCheck(ExtendedCell cell) throws IOException {
5757
if (this.getLastCell() != null) {
5858
if (comparator.compare(cell, this.getLastCell()) <= 0) {
5959
throw new IOException("Added a key not lexically larger than" + " previous. Current cell = "
@@ -72,5 +72,5 @@ private void sanityCheck(Cell cell) throws IOException {
7272
* @param cell the cell to be verified
7373
* @return true if a new key else false
7474
*/
75-
protected abstract boolean isNewKey(Cell cell);
75+
protected abstract boolean isNewKey(ExtendedCell cell);
7676
}

hbase-server/src/main/java/org/apache/hadoop/hbase/util/RowBloomContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
import static org.apache.hadoop.hbase.regionserver.HStoreFile.LAST_BLOOM_KEY;
2121

2222
import java.io.IOException;
23-
import org.apache.hadoop.hbase.Cell;
2423
import org.apache.hadoop.hbase.CellComparator;
2524
import org.apache.hadoop.hbase.CellUtil;
25+
import org.apache.hadoop.hbase.ExtendedCell;
2626
import org.apache.hadoop.hbase.io.hfile.HFile.Writer;
2727
import org.apache.yetus.audience.InterfaceAudience;
2828

@@ -45,7 +45,7 @@ public void addLastBloomKey(Writer writer) throws IOException {
4545
}
4646

4747
@Override
48-
protected boolean isNewKey(Cell cell) {
48+
protected boolean isNewKey(ExtendedCell cell) {
4949
if (this.getLastCell() != null) {
5050
return !CellUtil.matchingRows(cell, this.getLastCell());
5151
}

hbase-server/src/main/java/org/apache/hadoop/hbase/util/RowColBloomContext.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import static org.apache.hadoop.hbase.regionserver.HStoreFile.LAST_BLOOM_KEY;
2121

2222
import java.io.IOException;
23-
import org.apache.hadoop.hbase.Cell;
2423
import org.apache.hadoop.hbase.CellComparator;
2524
import org.apache.hadoop.hbase.CellUtil;
2625
import org.apache.hadoop.hbase.ExtendedCell;
@@ -50,7 +49,7 @@ public void addLastBloomKey(Writer writer) throws IOException {
5049
}
5150

5251
@Override
53-
protected boolean isNewKey(Cell cell) {
52+
protected boolean isNewKey(ExtendedCell cell) {
5453
if (this.getLastCell() != null) {
5554
return !CellUtil.matchingRowColumn(cell, this.getLastCell());
5655
}

hbase-server/src/main/java/org/apache/hadoop/hbase/util/RowPrefixFixedLengthBloomContext.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,16 @@ public RowPrefixFixedLengthBloomContext(BloomFilterWriter bloomFilterWriter,
4040
this.prefixLength = prefixLength;
4141
}
4242

43-
public void writeBloom(Cell cell) throws IOException {
43+
@Override
44+
public void writeBloom(ExtendedCell cell) throws IOException {
4445
super.writeBloom(getRowPrefixCell(cell));
4546
}
4647

4748
/**
4849
* @param cell the cell
4950
* @return the new cell created by row prefix
5051
*/
51-
private ExtendedCell getRowPrefixCell(Cell cell) {
52+
private ExtendedCell getRowPrefixCell(ExtendedCell cell) {
5253
byte[] row = CellUtil.copyRow(cell);
5354
return ExtendedCellBuilderFactory.create(CellBuilderType.DEEP_COPY)
5455
.setRow(row, 0, Math.min(prefixLength, row.length)).setType(Cell.Type.Put).build();

hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCellFlatSet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ public static Object[] data() {
6565

6666
private static final int NUM_OF_CELLS = 4;
6767
private static final int SMALL_CHUNK_SIZE = 64;
68-
private ExtendedCell ascCells[];
68+
private ExtendedCell[] ascCells;
6969
private CellArrayMap<ExtendedCell> ascCbOnHeap;
70-
private ExtendedCell descCells[];
70+
private ExtendedCell[] descCells;
7171
private CellArrayMap<ExtendedCell> descCbOnHeap;
7272
private final static Configuration CONF = new Configuration();
7373
private KeyValue lowerOuterCell;

0 commit comments

Comments
 (0)