[
https://issues.apache.org/jira/browse/HBASE-12057?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Valera V. Kharseko updated HBASE-12057:
---
Status: Patch Available (was: Open)
https://github.com/openam-org-ru/org.apache.hbase/commit/618f1beb87ed5cfaa7923d6b3bf1afb5f5480613?diff=unified
{code}
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java
b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java
index 88f8b0c..0f68fc0 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java
@@ -1195,6 +1195,33 @@
return (x1 + Long.MIN_VALUE) (x2 + Long.MIN_VALUE);
}
+ private static final boolean
unaligned=!sparcv9.equals(System.getProperty(os.arch));
+
+ private long getLong(Object address, long offset) {
+ if (unaligned) {
+return theUnsafe.getLong(address, offset);
+ } else {
+if (littleEndian) {
+ return (((long) theUnsafe.getByte(address, offset + 7) )
56) |
+ (((long) theUnsafe.getByte(address, offset + 6) 0xff)
48) |
+ (((long) theUnsafe.getByte(address, offset + 5) 0xff)
40) |
+ (((long) theUnsafe.getByte(address, offset + 4) 0xff)
32) |
+ (((long) theUnsafe.getByte(address, offset + 3) 0xff)
24) |
+ (((long) theUnsafe.getByte(address, offset + 2) 0xff)
16) |
+ (((long) theUnsafe.getByte(address, offset + 1) 0xff)
8) |
+ (((long) theUnsafe.getByte(address, offset) 0xff)
);
+} else {
+ return (((long) theUnsafe.getByte(address, offset) )
56) |
+ (((long) theUnsafe.getByte(address, offset + 1) 0xff)
48) |
+ (((long) theUnsafe.getByte(address, offset + 2) 0xff)
40) |
+ (((long) theUnsafe.getByte(address, offset + 3) 0xff)
32) |
+ (((long) theUnsafe.getByte(address, offset + 4) 0xff)
24) |
+ (((long) theUnsafe.getByte(address, offset + 5) 0xff)
16) |
+ (((long) theUnsafe.getByte(address, offset + 6) 0xff)
8) |
+ (((long) theUnsafe.getByte(address, offset + 7) 0xff)
);
+}
+ }
+}
/**
* Lexicographically compare two arrays.
*
@@ -1226,8 +1253,8 @@
* On the other hand, it is substantially faster on 64-bit.
*/
for (int i = 0; i minWords * SIZEOF_LONG; i += SIZEOF_LONG) {
- long lw = theUnsafe.getLong(buffer1, offset1Adj + (long) i);
- long rw = theUnsafe.getLong(buffer2, offset2Adj + (long) i);
+ long lw = getLong(buffer1, offset1Adj + (long) i);
+ long rw = getLong(buffer2, offset2Adj + (long) i);
long diff = lw ^ rw;
if (diff != 0) {
{code}
solaris -d64 jvm crash getLong workaround
-
Key: HBASE-12057
URL: https://issues.apache.org/jira/browse/HBASE-12057
Project: HBase
Issue Type: Bug
Components: util
Affects Versions: 0.98.6.1
Environment: solaris -d64
Reporter: Valera V. Kharseko
solaris 64 fix based on
https://issues.apache.org/jira/secure/attachment/12625582/solaris_unsafe_fix.patch
https://bugs.openjdk.java.net/browse/JDK-8021574?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)