Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,13 @@ protected void decode(
try {
getParserForTypeMethod = protobufMessageLiteClass.getDeclaredMethod("getParserForType");
newBuilderForTypeMethod = protobufMessageLiteClass.getDeclaredMethod("newBuilderForType");
// TODO: If this is false then the class will fail to load? Can refactor it out?
hasParser = true;
} catch (NoSuchMethodException e) {
// If the method is not found, we are in trouble. Abort.
throw new RuntimeException(e);
}

try {
protobufMessageLiteClass.getDeclaredMethod("getParserForType");
hasParser = true;
} catch (Throwable var2) {
}

HAS_PARSER = hasParser;
}
}
24 changes: 11 additions & 13 deletions hbase-build-configuration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this check is run by precommit testing only, I'm fine with bumping this check over to JDK11. Please make sure that test-patch is calling it from the jdk11 incantation instead of the jdk8 incantation.

<!-- https://errorprone.info/docs/installation Maven section has details -->
<!-- required when compiling with JDK 8 -->
<javac.version>9+181-r4173-1</javac.version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.errorprone</groupId>
Expand All @@ -86,12 +81,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>javac</artifactId>
<version>${javac.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand All @@ -109,8 +98,17 @@
<arg>-XDcompilePolicy=simple</arg>
<!-- All -Xep need to be on single line see: https://github.com/google/error-prone/pull/1115 -->
<arg>-Xplugin:ErrorProne -XepDisableWarningsInGeneratedCode -Xep:FallThrough:OFF -Xep:MutablePublicArray:OFF -Xep:ClassNewInstance:ERROR -Xep:MissingDefault:ERROR</arg>
<!-- Required when compiling with JDK 8 -->
<arg>-J-Xbootclasspath/p:${settings.localRepository}/com/google/errorprone/javac/${javac.version}/javac-${javac.version}.jar</arg>

<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
Expand Down
18 changes: 9 additions & 9 deletions hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -1102,10 +1102,11 @@ private int calculateHashForKey(Cell cell) {
*/
@Override
public KeyValue clone() throws CloneNotSupportedException {
super.clone();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wtf was this even doing?

byte [] b = new byte[this.length];
System.arraycopy(this.bytes, this.offset, b, 0, this.length);
KeyValue ret = new KeyValue(b, 0, b.length);
KeyValue ret = (KeyValue) super.clone();
ret.bytes = new byte[this.length];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe simpler to use Arrays.copyOfRange here?

ret.offset = 0;
ret.length = ret.bytes.length;
System.arraycopy(this.bytes, this.offset, ret.bytes, 0, this.length);
// Important to clone the memstoreTS as well - otherwise memstore's
// update-in-place methods (eg increment) will end up creating
// new entries
Expand Down Expand Up @@ -1720,8 +1721,8 @@ public String getLegacyKeyComparatorName() {
}

@Override
protected Object clone() throws CloneNotSupportedException {
return new MetaComparator();
protected MetaComparator clone() throws CloneNotSupportedException {
return (MetaComparator) super.clone();
}

/**
Expand Down Expand Up @@ -2248,9 +2249,8 @@ public byte[] getShortMidpointKey(final byte[] leftKey, final byte[] rightKey) {
}

@Override
protected Object clone() throws CloneNotSupportedException {
super.clone();
return new KVComparator();
protected KVComparator clone() throws CloneNotSupportedException {
return (KVComparator) super.clone();
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@
* {@link ColumnInterpreter} is used to interpret column value. This class is
* parameterized with the following (these are the types with which the {@link ColumnInterpreter}
* is parameterized, and for more description on these, refer to {@link ColumnInterpreter}):
* @param T Cell value data type
* @param S Promoted data type
* @param P PB message that is used to transport initializer specific bytes
* @param Q PB message that is used to transport Cell (&lt;T&gt;) instance
* @param R PB message that is used to transport Promoted (&lt;S&gt;) instance
* @param <T> Cell value data type
* @param <S> Promoted data type
* @param <P> PB message that is used to transport initializer specific bytes
* @param <Q> PB message that is used to transport Cell (&lt;T&gt;) instance
* @param <R> PB message that is used to transport Promoted (&lt;S&gt;) instance
*/
@InterfaceAudience.Private
public class AggregateImplementation<T, S, P extends Message, Q extends Message, R extends Message>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
/**
* Writes HFiles. Passed Cells must arrive in order.
* Writes current time as the sequence id for the file. Sets the major compacted
* attribute on created @{link {@link HFile}s. Calling write(null,null) will forcibly roll
* attribute on created {@link HFile}s. Calling write(null,null) will forcibly roll
* all HFiles being written.
* <p>
* Using this class as part of a MapReduce job is best done
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ public Configuration getConf() {
* @param rsServices interface to available region server functionality
* @param conf the configuration
*/
@SuppressWarnings("ReturnValueIgnored") // Checking method exists as CPU optimization
public RegionCoprocessorHost(final HRegion region,
final RegionServerServices rsServices, final Configuration conf) {
super(rsServices);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void dispose() {
public String getAttemptingUser() {
Optional<UserGroupInformation> optionalUser = serverWithProvider.getAttemptingUser();
if (optionalUser.isPresent()) {
optionalUser.get().toString();
return optionalUser.get().toString();
}
return "Unknown";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void testPutIteration() throws IOException {
for (CellScanner cellScanner = p.cellScanner(); cellScanner.advance();) {
Cell cell = cellScanner.current();
byte [] bytes = Bytes.toBytes(index++);
cell.equals(new KeyValue(ROW, bytes, bytes, TIMESTAMP, bytes));
assertEquals(new KeyValue(ROW, bytes, bytes, TIMESTAMP, bytes), cell);
}
assertEquals(COUNT, index);
}
Expand All @@ -74,15 +74,13 @@ public void testPutConcurrentModificationOnIteration() throws IOException {
p.addColumn(bytes, bytes, TIMESTAMP, bytes);
}
int index = 0;
int trigger = 3;
for (CellScanner cellScanner = p.cellScanner(); cellScanner.advance();) {
Cell cell = cellScanner.current();
byte [] bytes = Bytes.toBytes(index++);
// When we hit the trigger, try inserting a new KV; should trigger exception
if (trigger == 3) p.addColumn(bytes, bytes, TIMESTAMP, bytes);
cell.equals(new KeyValue(ROW, bytes, bytes, TIMESTAMP, bytes));
p.addColumn(bytes, bytes, TIMESTAMP, bytes);
assertEquals(new KeyValue(ROW, bytes, bytes, TIMESTAMP, bytes), cell);
}
assertEquals(COUNT, index);
}

@Test
Expand All @@ -96,7 +94,7 @@ public void testDeleteIteration() throws IOException {
for (CellScanner cellScanner = d.cellScanner(); cellScanner.advance();) {
Cell cell = cellScanner.current();
byte [] bytes = Bytes.toBytes(index++);
cell.equals(new KeyValue(ROW, bytes, bytes, TIMESTAMP, KeyValue.Type.DeleteColumn));
assertEquals(new KeyValue(ROW, bytes, bytes, TIMESTAMP, KeyValue.Type.Delete), cell);
}
assertEquals(COUNT, index);
}
Expand Down Expand Up @@ -151,7 +149,7 @@ public void testResultIteration() throws IOException {
for (CellScanner cellScanner = r.cellScanner(); cellScanner.advance();) {
Cell cell = cellScanner.current();
byte [] bytes = Bytes.toBytes(index++);
cell.equals(new KeyValue(ROW, bytes, bytes, TIMESTAMP, bytes));
assertEquals(new KeyValue(ROW, bytes, bytes, TIMESTAMP, bytes), cell);
}
assertEquals(COUNT, index);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package org.apache.hadoop.hbase.codec;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

Expand Down Expand Up @@ -96,10 +97,7 @@ static int getRoughSize(final Cell [] cells) {
}

static void verifyCells(final Cell [] input, final Cell [] output) {
assertEquals(input.length, output.length);
for (int i = 0; i < input.length; i ++) {
input[i].equals(output[i]);
}
assertArrayEquals(input, output);
}

static void doCodec(final Codec codec, final Cell [] cells, final int cycles, final int count,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ private synchronized ResultScannerWrapper getScanner(int id) {
* id-&gt;scanner hash-map.
*
* @param id the ID of the scanner to remove
* @return a Scanner, or null if ID was invalid.
*/
private synchronized void removeScanner(int id) {
scannerMap.invalidate(id);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1780,7 +1780,7 @@
-->
<checkstyle.version>8.28</checkstyle.version>
<exec.maven.version>1.6.0</exec.maven.version>
<error-prone.version>2.4.0</error-prone.version>
<error-prone.version>2.10.0</error-prone.version>
<jamon.plugin.version>2.4.2</jamon.plugin.version>
<lifecycle.mapping.version>1.0.0</lifecycle.mapping.version>
<maven.antrun.version>1.8</maven.antrun.version>
Expand Down