apurtell commented on a change in pull request #3691:
URL: https://github.com/apache/hbase/pull/3691#discussion_r721576597
##########
File path:
hbase-common/src/main/java/org/apache/hadoop/hbase/util/UnsafeAccess.java
##########
@@ -471,4 +485,57 @@ public static byte toByte(ByteBuffer buf, int offset) {
public static byte toByte(Object ref, long offset) {
return theUnsafe.getByte(ref, offset);
}
+
+ /**
+ * Zero fill a byte buffer as efficiently as possible.
+ * @param buf the byte buffer
+ */
+ public static void clear(final ByteBuffer buf) {
+ if (buf.isDirect()) {
+ clear(((DirectBuffer)buf).address(), buf.capacity());
Review comment:
I will change the patch to use Unsafe.setMemory @Apache9 . I think they
do the alignment test because some architectures do not support unaligned
stores. x86 does. Not sure about ARM. I will change this so we might avoid a
bug report in the future for segfault due to unaligned access on RISC-V or
something.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]