Set correct MCL_CURRENT and MCL_FUTURE values on IBM POWER to support mlockall(2) through JNA
Patch by rodaira; reviewed by jmckenzie for CASSANDRA-11576 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/a56bc160 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/a56bc160 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/a56bc160 Branch: refs/heads/trunk Commit: a56bc1600bc8b98b9949751873e911ad5b237fbe Parents: 615bf37 Author: Rei Odaira <[email protected]> Authored: Fri Apr 15 10:50:45 2016 -0500 Committer: Josh McKenzie <[email protected]> Committed: Fri Jun 17 12:38:25 2016 -0400 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../org/apache/cassandra/utils/CLibrary.java | 28 ++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/a56bc160/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index ec2b48e..64cfdaa 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 2.1.15 + * Support mlockall on IBM POWER arch (CASSANDRA-11576) * Cache local ranges when calculating repair neighbors (CASSANDRA-11933) * Allow LWT operation on static column with only partition keys (CASSANDRA-10532) * Create interval tree over canonical sstables to avoid missing sstables during streaming (CASSANDRA-11886) http://git-wip-us.apache.org/repos/asf/cassandra/blob/a56bc160/src/java/org/apache/cassandra/utils/CLibrary.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/utils/CLibrary.java b/src/java/org/apache/cassandra/utils/CLibrary.java index 1c771af..48cb67c 100644 --- a/src/java/org/apache/cassandra/utils/CLibrary.java +++ b/src/java/org/apache/cassandra/utils/CLibrary.java @@ -33,8 +33,8 @@ public final class CLibrary { private static final Logger logger = LoggerFactory.getLogger(CLibrary.class); - private static final int MCL_CURRENT = 1; - private static final int MCL_FUTURE = 2; + private static final int MCL_CURRENT; + private static final int MCL_FUTURE; private static final int ENOMEM = 12; @@ -75,6 +75,30 @@ public final class CLibrary logger.warn("Obsolete version of JNA present; unable to register C library. Upgrade to JNA 3.2.7 or later"); jnaAvailable = false; } + + if (System.getProperty("os.arch").toLowerCase().contains("ppc")) + { + if (System.getProperty("os.name").toLowerCase().contains("linux")) + { + MCL_CURRENT = 0x2000; + MCL_FUTURE = 0x4000; + } + else if (System.getProperty("os.name").toLowerCase().contains("aix")) + { + MCL_CURRENT = 0x100; + MCL_FUTURE = 0x200; + } + else + { + MCL_CURRENT = 1; + MCL_FUTURE = 2; + } + } + else + { + MCL_CURRENT = 1; + MCL_FUTURE = 2; + } } private static native int mlockall(int flags) throws LastErrorException;
