You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by db...@apache.org on 2013/06/03 03:03:07 UTC

[1/2] git commit: Backport from 2.0 - Expose whether jna is enabled and memory is locked via JMX patch by dbrosius reviewed by jbellis for cassandra-5508

Updated Branches:
  refs/heads/trunk 19ad1ca4b -> 3d1e29bd1


Backport from 2.0 - Expose whether jna is enabled and memory is locked via JMX
patch by dbrosius reviewed by jbellis for cassandra-5508


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/11eb3529
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/11eb3529
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/11eb3529

Branch: refs/heads/trunk
Commit: 11eb35291643d99bf5a3a1879a3b7356ff3d4bdd
Parents: 456e91d
Author: Dave Brosius <db...@apache.org>
Authored: Sun Jun 2 13:37:08 2013 -0400
Committer: Dave Brosius <db...@apache.org>
Committed: Sun Jun 2 13:37:08 2013 -0400

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../apache/cassandra/service/CassandraDaemon.java  |   31 +++++++++++++++
 .../cassandra/service/NativeAccessMBean.java       |   25 ++++++++++++
 src/java/org/apache/cassandra/utils/CLibrary.java  |   15 +++++++
 4 files changed, 72 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/11eb3529/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 8aa0138..6e05a51 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -15,6 +15,7 @@
  * Add a rate limit option to stress (CASSANDRA-5004)
  * have BulkLoader ignore snapshots directories (CASSANDRA-5587) 
  * fix SnitchProperties logging context (CASSANDRA-5602)
+ * Expose whether jna is enabled and memory is locked via JMX (CASSANDRA-5508)
 Merged from 1.1:
  * Remove buggy thrift max message length option (CASSANDRA-5529)
  * Fix NPE in Pig's widerow mode (CASSANDRA-5488)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/11eb3529/src/java/org/apache/cassandra/service/CassandraDaemon.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/CassandraDaemon.java b/src/java/org/apache/cassandra/service/CassandraDaemon.java
index 343d497..53c653f 100644
--- a/src/java/org/apache/cassandra/service/CassandraDaemon.java
+++ b/src/java/org/apache/cassandra/service/CassandraDaemon.java
@@ -19,6 +19,7 @@ package org.apache.cassandra.service;
 
 import java.io.File;
 import java.io.IOException;
+import java.lang.management.ManagementFactory;
 import java.net.InetAddress;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -26,6 +27,10 @@ import java.util.Arrays;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.StandardMBean;
+
 import com.google.common.collect.Iterables;
 import org.apache.log4j.PropertyConfigurator;
 import org.slf4j.Logger;
@@ -53,6 +58,8 @@ import org.apache.cassandra.utils.Mx4jTool;
  */
 public class CassandraDaemon
 {
+    public static final String MBEAN_NAME = "org.apache.cassandra.db:type=NativeAccess";
+    
     static
     {
         initLog4j();
@@ -420,6 +427,17 @@ public class CassandraDaemon
 
         try
         {
+            try
+            {
+                MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+                mbs.registerMBean(new StandardMBean(new NativeAccess(), NativeAccessMBean.class), new ObjectName(MBEAN_NAME));
+            }
+            catch (Exception e)
+            {
+                logger.error("error registering MBean " + MBEAN_NAME, e);
+                //Allow the server to start even if the bean can't be registered
+            }
+            
             setup();
 
             if (pidFile != null)
@@ -465,6 +483,19 @@ public class CassandraDaemon
     {
         instance.activate();
     }
+    
+    static class NativeAccess implements NativeAccessMBean
+    {
+        public boolean isAvailable()
+        {
+            return CLibrary.jnaAvailable();
+        }
+        
+        public boolean isMemoryLockable() 
+        {
+            return CLibrary.jnaMemoryLockable();
+        }
+    }
 
     public interface Server
     {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/11eb3529/src/java/org/apache/cassandra/service/NativeAccessMBean.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/NativeAccessMBean.java b/src/java/org/apache/cassandra/service/NativeAccessMBean.java
new file mode 100644
index 0000000..e1f21c2
--- /dev/null
+++ b/src/java/org/apache/cassandra/service/NativeAccessMBean.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cassandra.service;
+
+public interface NativeAccessMBean 
+{
+    boolean isAvailable();
+
+    boolean isMemoryLockable();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cassandra/blob/11eb3529/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 f8ad9d1..b0853c1 100644
--- a/src/java/org/apache/cassandra/utils/CLibrary.java
+++ b/src/java/org/apache/cassandra/utils/CLibrary.java
@@ -49,12 +49,16 @@ public final class CLibrary
     private static final int POSIX_FADV_WILLNEED   = 3; /* fadvise.h */
     private static final int POSIX_FADV_DONTNEED   = 4; /* fadvise.h */
     private static final int POSIX_FADV_NOREUSE    = 5; /* fadvise.h */
+    
+    static boolean jnaAvailable = false;
+    static boolean jnaLockable = false;
 
     static
     {
         try
         {
             Native.register("c");
+            jnaAvailable = true;
         }
         catch (NoClassDefFoundError e)
         {
@@ -101,12 +105,23 @@ public final class CLibrary
     }
 
     private CLibrary() {}
+    
+    public static boolean jnaAvailable()
+    {
+        return jnaAvailable;
+    }
+    
+    public static boolean jnaMemoryLockable()
+    {
+        return jnaLockable;
+    }
 
     public static void tryMlockall()
     {
         try
         {
             mlockall(MCL_CURRENT);
+            jnaLockable = true;
             logger.info("JNA mlockall successful");
         }
         catch (UnsatisfiedLinkError e)


[2/2] git commit: Merge branch 'cassandra-1.2' into trunk

Posted by db...@apache.org.
Merge branch 'cassandra-1.2' into trunk


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/3d1e29bd
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/3d1e29bd
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/3d1e29bd

Branch: refs/heads/trunk
Commit: 3d1e29bd1adc9d720a66471a7c6564c2d3039b22
Parents: 19ad1ca 11eb352
Author: Dave Brosius <db...@apache.org>
Authored: Sun Jun 2 21:02:06 2013 -0400
Committer: Dave Brosius <db...@apache.org>
Committed: Sun Jun 2 21:02:06 2013 -0400

----------------------------------------------------------------------
 CHANGES.txt                                        |    2 +-
 .../cassandra/service/NativeAccessMBean.java       |   18 ++++++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/3d1e29bd/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 47cc712,6e05a51..ead2f76
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,63 -1,3 +1,62 @@@
 +2.0
 + * Removed on-heap row cache (CASSANDRA-5348)
 + * use nanotime consistently for node-local timeouts (CASSANDRA-5581)
 + * Avoid unnecessary second pass on name-based queries (CASSANDRA-5577)
 + * Experimental triggers (CASSANDRA-1311)
 + * JEMalloc support for off-heap allocation (CASSANDRA-3997)
 + * Single-pass compaction (CASSANDRA-4180)
 + * Removed token range bisection (CASSANDRA-5518)
 + * Removed compatibility with pre-1.2.5 sstables and network messages
 +   (CASSANDRA-5511)
 + * removed PBSPredictor (CASSANDRA-5455)
 + * CAS support (CASSANDRA-5062, 5441, 5442, 5443)
 + * Leveled compaction performs size-tiered compactions in L0 
 +   (CASSANDRA-5371, 5439)
 + * Add yaml network topology snitch for mixed ec2/other envs (CASSANDRA-5339)
 + * Log when a node is down longer than the hint window (CASSANDRA-4554)
 + * Optimize tombstone creation for ExpiringColumns (CASSANDRA-4917)
 + * Improve LeveledScanner work estimation (CASSANDRA-5250, 5407)
 + * Replace compaction lock with runWithCompactionsDisabled (CASSANDRA-3430)
 + * Change Message IDs to ints (CASSANDRA-5307)
 + * Move sstable level information into the Stats component, removing the
 +   need for a separate Manifest file (CASSANDRA-4872)
 + * avoid serializing to byte[] on commitlog append (CASSANDRA-5199)
 + * make index_interval configurable per columnfamily (CASSANDRA-3961)
 + * add default_time_to_live (CASSANDRA-3974)
 + * add memtable_flush_period_in_ms (CASSANDRA-4237)
 + * replace supercolumns internally by composites (CASSANDRA-3237, 5123)
 + * upgrade thrift to 0.9.0 (CASSANDRA-3719)
 + * drop unnecessary keyspace parameter from user-defined compaction API 
-  * Expose whether jna is enabled and memory is locked via JMX (CASSANDRA-5508)
 +   (CASSANDRA-5139)
 + * more robust solution to incomplete compactions + counters (CASSANDRA-5151)
 + * Change order of directory searching for c*.in.sh (CASSANDRA-3983)
 + * Add tool to reset SSTable compaction level for LCS (CASSANDRA-5271)
 + * Allow custom configuration loader (CASSANDRA-5045)
 + * Remove memory emergency pressure valve logic (CASSANDRA-3534)
 + * Reduce request latency with eager retry (CASSANDRA-4705)
 + * cqlsh: Remove ASSUME command (CASSANDRA-5331)
 + * Rebuild BF when loading sstables if bloom_filter_fp_chance
 +   has changed since compaction (CASSANDRA-5015)
 + * remove row-level bloom filters (CASSANDRA-4885)
 + * Change Kernel Page Cache skipping into row preheating (disabled by default)
 +   (CASSANDRA-4937)
 + * Improve repair by deciding on a gcBefore before sending
 +   out TreeRequests (CASSANDRA-4932)
 + * Add an official way to disable compactions (CASSANDRA-5074)
 + * Reenable ALTER TABLE DROP with new semantics (CASSANDRA-3919)
 + * Add binary protocol versioning (CASSANDRA-5436)
 + * Swap THshaServer for TThreadedSelectorServer (CASSANDRA-5530)
 + * Add alias support to SELECT statement (CASSANDRA-5075)
 + * Don't create empty RowMutations in CommitLogReplayer (CASSANDRA-5541)
 + * Use range tombstones when dropping cfs/columns from schema (CASSANDRA-5579)
 + * cqlsh: drop CQL2/CQL3-beta support (CASSANDRA-5585)
 + * Track max/min column names in sstables to be able to optimize slice
 +   queries (CASSANDRA-5514, CASSANDRA-5595, CASSANDRA-5600)
 + * Binary protocol: allow batching already prepared statements (CASSANDRA-4693)
 + * Allow preparing timestamp, ttl and limit in CQL3 queries (CASSANDRA-4450)
 + * Support native link w/o JNA in Java7 (CASSANDRA-3734)
 + * Use SASL authentication in binary protocol v2 (CASSANDRA-5545)
 +
  1.2.6
   * Reduce SSTableLoader memory usage (CASSANDRA-5555)
   * Scale hinted_handoff_throttle_in_kb to cluster size (CASSANDRA-5272)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3d1e29bd/src/java/org/apache/cassandra/service/NativeAccessMBean.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/NativeAccessMBean.java
index 39b96c5,e1f21c2..b0c408c
--- a/src/java/org/apache/cassandra/service/NativeAccessMBean.java
+++ b/src/java/org/apache/cassandra/service/NativeAccessMBean.java
@@@ -5,5 -22,4 +22,4 @@@ public interface NativeAccessMBea
      boolean isAvailable();
  
      boolean isMemoryLockable();
 -}
 +}
-