You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2020/06/19 13:24:24 UTC

[cassandra] branch trunk updated: Add a startup check to detect if LZ4 uses java rather than native implementation

This is an automated email from the ASF dual-hosted git repository.

aleksey pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/trunk by this push:
     new c04f9f4  Add a startup check to detect if LZ4 uses java rather than native implementation
c04f9f4 is described below

commit c04f9f448dc0584783c21f39a59932185aa5a562
Author: David Capwell <dc...@apple.com>
AuthorDate: Thu Jun 18 17:47:26 2020 -0700

    Add a startup check to detect if LZ4 uses java rather than native implementation
    
    patch by David Capwell; reviewed by Aleksey Yeschenko for
    CASSANDRA-15884
---
 CHANGES.txt                                              |  1 +
 src/java/org/apache/cassandra/service/StartupChecks.java | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/CHANGES.txt b/CHANGES.txt
index c51a870..aa62351 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.0-alpha5
+ * Add a startup check to detect if LZ4 uses java rather than native implementation (CASSANDRA-15884)
  * Fix missing topology events when running multiple nodes on the same network interface (CASSANDRA-15677)
  * Create config.yml.MIDRES (CASSANDRA-15712)
  * Fix handling of fully purged static rows in repaired data tracking (CASSANDRA-15848)
diff --git a/src/java/org/apache/cassandra/service/StartupChecks.java b/src/java/org/apache/cassandra/service/StartupChecks.java
index 8814281..e8a60f4 100644
--- a/src/java/org/apache/cassandra/service/StartupChecks.java
+++ b/src/java/org/apache/cassandra/service/StartupChecks.java
@@ -29,11 +29,13 @@ import java.util.stream.Collectors;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Joiner;
+import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Iterables;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import net.jpountz.lz4.LZ4Factory;
 import org.apache.cassandra.cql3.QueryProcessor;
 import org.apache.cassandra.cql3.UntypedResultSet;
 import org.apache.cassandra.schema.TableMetadata;
@@ -83,6 +85,7 @@ public class StartupChecks
     // always want the system keyspace check run last, as this actually loads the schema for that
     // keyspace. All other checks should not require any schema initialization.
     private final List<StartupCheck> DEFAULT_TESTS = ImmutableList.of(checkJemalloc,
+                                                                      checkLz4Native,
                                                                       checkValidLaunchDate,
                                                                       checkJMXPorts,
                                                                       checkJMXProperties,
@@ -140,6 +143,17 @@ public class StartupChecks
         }
     };
 
+    public static final StartupCheck checkLz4Native = () -> {
+        try
+        {
+            LZ4Factory.nativeInstance(); // make sure native loads
+        }
+        catch (AssertionError e)
+        {
+            logger.warn("lz4-java was unable to load native librarires; this will lower the performance of lz4 (network/sstables/etc.): {}", Throwables.getRootCause(e).getMessage());
+        }
+    };
+
     public static final StartupCheck checkValidLaunchDate = new StartupCheck()
     {
         /**


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org