Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HBASE-26523 + HBASE-25465 + HBASE-26855 backport to branch-2.4 #4439

Merged
merged 5 commits into from
May 18, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
spotless apply
virajjasani committed May 17, 2022

Verified

This commit was signed with the committer’s verified signature.
virajjasani Viraj Jasani
commit 17be48f86c8e878f67e5f7d5296aadb14d69c7f9
Original file line number Diff line number Diff line change
@@ -1427,7 +1427,8 @@ int putShort(byte[] bytes, int offset, short val) {

protected static final class UnsafeConverter extends Converter {

public UnsafeConverter() {}
public UnsafeConverter() {
}

static {
if (!UNSAFE_UNALIGNED) {
@@ -1475,11 +1476,11 @@ int putShort(byte[] bytes, int offset, short val) {
}

/**
* Provides a lexicographical comparer implementation; either a Java
* implementation or a faster implementation based on {@code Unsafe}.
*
* <p>Uses reflection to gracefully fall back to the Java implementation if
* {@code Unsafe} isn't available.
* Provides a lexicographical comparer implementation; either a Java implementation or a faster
* implementation based on {@code Unsafe}.
* <p>
* Uses reflection to gracefully fall back to the Java implementation if {@code Unsafe} isn't
* available.
*/
@InterfaceAudience.Private
static class LexicographicalComparerHolder {
Original file line number Diff line number Diff line change
@@ -191,8 +191,8 @@ public UnsafeLayout() {
@Override
int headerSize() {
try {
return (int) HBasePlatformDependent.objectFieldOffset(
HeaderSize.class.getDeclaredField("a"));
return (int) HBasePlatformDependent
.objectFieldOffset(HeaderSize.class.getDeclaredField("a"));
} catch (NoSuchFieldException | SecurityException e) {
LOG.error(e.toString(), e);
}
@@ -221,8 +221,10 @@ private static MemoryLayout getMemoryLayout() {
// Have a safeguard in case Unsafe estimate is wrong. This is static context, there is
// no configuration, so we look at System property.
String enabled = System.getProperty("hbase.memorylayout.use.unsafe");
if (HBasePlatformDependent.isUnsafeAvailable() &&
(enabled == null || Boolean.parseBoolean(enabled))) {
if (
HBasePlatformDependent.isUnsafeAvailable()
&& (enabled == null || Boolean.parseBoolean(enabled))
) {
LOG.debug("Using Unsafe to estimate memory layout");
return new UnsafeLayout();
}
Original file line number Diff line number Diff line change
@@ -19,9 +19,10 @@

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import org.apache.hadoop.hbase.unsafe.HBasePlatformDependent;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.yetus.audience.InterfaceStability;
import org.apache.hadoop.hbase.unsafe.HBasePlatformDependent;

import org.apache.hbase.thirdparty.io.netty.util.internal.PlatformDependent;

@InterfaceAudience.Private
@@ -192,10 +193,7 @@ public static int toInt(ByteBuffer buf, int offset) {

/**
* Reads a int value at the given Object's offset considering it was written in big-endian format.
* @param ref
* @param offset
* @return int value at offset
>>>>>>> 6cef9e1602... HBASE-25465 Use javac --release option for supporting cross version compilation (#4164)
* nn * @return int value at offset
*/
public static int toInt(Object ref, long offset) {
if (LITTLE_ENDIAN) {
@@ -254,7 +252,7 @@ private static long getAsLong(ByteBuffer buf, int offset) {

/**
* Returns the byte at the given offset
* @param buf the buffer to read
* @param buf the buffer to read
* @param offset the offset at which the byte has to be read
* @return the byte at the given offset
*/
@@ -324,16 +322,12 @@ private static void unsafeCopy(Object src, long srcAddr, Object dst, long destAd

/**
* Copies specified number of bytes from given offset of {@code src} ByteBuffer to the
<<<<<<< HEAD
* {@code dest} array. nnnnn
=======
* {@code dest} array.
* @param src source buffer
* @param srcOffset offset into source buffer
* @param dest destination array
* @param src source buffer
* @param srcOffset offset into source buffer
* @param dest destination array
* @param destOffset offset into destination buffer
* @param length length of data to copy
>>>>>>> 6cef9e1602... HBASE-25465 Use javac --release option for supporting cross version compilation (#4164)
* @param length length of data to copy
*/
public static void copy(ByteBuffer src, int srcOffset, byte[] dest, int destOffset, int length) {
long srcAddress = srcOffset;
@@ -351,11 +345,11 @@ public static void copy(ByteBuffer src, int srcOffset, byte[] dest, int destOffs
/**
* Copies specified number of bytes from given offset of {@code src} buffer into the {@code dest}
* buffer.
* @param src source buffer
* @param srcOffset offset into source buffer
* @param dest destination buffer
* @param src source buffer
* @param srcOffset offset into source buffer
* @param dest destination buffer
* @param destOffset offset into destination buffer
* @param length length of data to copy
* @param length length of data to copy
*/
public static void copy(ByteBuffer src, int srcOffset, ByteBuffer dest, int destOffset,
int length) {
@@ -434,7 +428,6 @@ public static int putByte(ByteBuffer buf, int offset, byte b) {
return offset + 1;
}


public static long directBufferAddress(ByteBuffer buf) {
return PlatformDependent.directBufferAddress(buf);
}
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@
import org.apache.hbase.thirdparty.com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
import org.apache.hbase.thirdparty.javax.ws.rs.core.MediaType;

@Category({RestTests.class, MediumTests.class})
@Category({ RestTests.class, MediumTests.class })
@RunWith(Parameterized.class)
public class TestMultiRowResource {
@ClassRule
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@
import org.apache.hbase.thirdparty.com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
import org.apache.hbase.thirdparty.javax.ws.rs.core.MediaType;

@Category({RestTests.class, MediumTests.class})
@Category({ RestTests.class, MediumTests.class })
public class TestNamespacesInstanceResource {
@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@
import org.apache.hbase.thirdparty.com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
import org.apache.hbase.thirdparty.javax.ws.rs.core.MediaType;

@Category({RestTests.class, MediumTests.class})
@Category({ RestTests.class, MediumTests.class })
public class TestTableScan {
@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@
import org.apache.hbase.thirdparty.com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
import org.apache.hbase.thirdparty.javax.ws.rs.core.MediaType;

@Category({RestTests.class, MediumTests.class})
@Category({ RestTests.class, MediumTests.class })
public class TestVersionResource {

@ClassRule
Original file line number Diff line number Diff line change
@@ -67,9 +67,9 @@ public LruCachedBlockQueue(long maxSize, long blockSize) {
* @param cb block to try to add to the queue
*/
@edu.umd.cs.findbugs.annotations.SuppressWarnings(
value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE",
justification = "head can not be null as heapSize is greater than maxSize,"
+ " which means we have something in the queue")
value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE",
justification = "head can not be null as heapSize is greater than maxSize,"
+ " which means we have something in the queue")
public void add(LruCachedBlock cb) {
if (heapSize < maxSize) {
queue.add(cb);
Original file line number Diff line number Diff line change
@@ -70,9 +70,9 @@ public CachedEntryQueue(long maxSize, long blockSize) {
* @param entry a bucket entry with key to try to add to the queue
*/
@edu.umd.cs.findbugs.annotations.SuppressWarnings(
value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE",
justification = "head can not be null as cacheSize is greater than maxSize,"
+ " which means we have something in the queue")
value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE",
justification = "head can not be null as cacheSize is greater than maxSize,"
+ " which means we have something in the queue")
public void add(Map.Entry<BlockCacheKey, BucketEntry> entry) {
if (cacheSize < maxSize) {
queue.add(entry);