Uploaded image for project: 'Apache Cassandra'
  1. Apache Cassandra
  2. CASSANDRA-13233

Improve testing on macOS by eliminating sigar logging

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 3.0.12, 3.11.0, 4.0-alpha1, 4.0
    • None
    • None
    • Normal

    Description

      The changes introduced in CASSANDRA-7838 (Resolved; Fixed; 2.2.0 beta 1): "Warn user when OS settings are poor / integrate sigar" are not Mac friendly.

      INFO  [main] 2016-10-18T11:20:10,330 SigarLibrary.java:44 - Initializing SIGAR library
      DEBUG [main] 2016-10-18T11:20:10,342 SigarLog.java:60 - no libsigar-universal64-macosx.dylib in java.library.path
      org.hyperic.sigar.SigarException: no libsigar-universal64-macosx.dylib in java.library.path
              at org.hyperic.sigar.Sigar.loadLibrary(Sigar.java:172) ~[sigar-1.6.4.jar:?]
              at org.hyperic.sigar.Sigar.<clinit>(Sigar.java:100) [sigar-1.6.4.jar:?]
              at org.apache.cassandra.utils.SigarLibrary.<init>(SigarLibrary.java:47) [main/:?]
              at org.apache.cassandra.utils.SigarLibrary.<clinit>(SigarLibrary.java:28) [main/:?]
              at org.apache.cassandra.utils.UUIDGen.hash(UUIDGen.java:363) [main/:?]
              at org.apache.cassandra.utils.UUIDGen.makeNode(UUIDGen.java:342) [main/:?]
              at org.apache.cassandra.utils.UUIDGen.makeClockSeqAndNode(UUIDGen.java:291) [main/:?]
              at org.apache.cassandra.utils.UUIDGen.<clinit>(UUIDGen.java:42) [main/:?]
              at org.apache.cassandra.config.CFMetaData$Builder.build(CFMetaData.java:1278) [main/:?]
              at org.apache.cassandra.SchemaLoader.standardCFMD(SchemaLoader.java:369) [classes/:?]
              at org.apache.cassandra.SchemaLoader.standardCFMD(SchemaLoader.java:356) [classes/:?]
              at org.apache.cassandra.SchemaLoader.standardCFMD(SchemaLoader.java:351) [classes/:?]
              at org.apache.cassandra.batchlog.BatchTest.defineSchema(BatchTest.java:59) [classes/:?]
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_66]
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_66]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_66]
              at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_66]
              at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) [junit-4.6.jar:?]
              at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) [junit-4.6.jar:?]
              at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) [junit-4.6.jar:?]
              at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27) [junit-4.6.jar:?]
              at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) [junit-4.6.jar:?]
              at org.junit.runners.ParentRunner.run(ParentRunner.java:220) [junit-4.6.jar:?]
              at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39) [junit-4.6.jar:?]
              at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:535) [ant-junit.jar:?]
              at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1182) [ant-junit.jar:?]
              at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:1033) [ant-junit.jar:?]
      INFO  [main] 2016-10-18T11:20:10,350 SigarLibrary.java:57 - Could not initialize SIGAR library org.hyperic.sigar.Sigar.getFileSystemListNative()[Lorg/hyperic/sigar/FileSystem;
      

      There are 2 issues addressed by the attached patch:

      1. Create platform aware (windows, Darwin, linux) implementations of CLibrary (for instance CLibrary today assumes all platforms have support for posix_fadvise but this doesn't exist in the Darwin kernel). If methods are defined with the "native" JNI keyword in java when the class is loaded it will cause our jna check to fail incorrectly making all of CLibrary "disabled" even though because jnaAvailable = false even though on a platform like Darwin all of the native methods except posix_fadvise are supported.
      2. Replace sigar usage to get current pid with calls to CLibrary/native equivalent – and fall back to Sigar for platforms like Windows who don't have that support with JDK8 (and without a CLibrary equivalent)

      Attachments

        1. 28827709.diff
          28 kB
          Michael Kjellman
        2. CASSANDRA-13233-trunk-v2.diff
          27 kB
          Michael Kjellman

        Activity

          People

            mkjellman Michael Kjellman
            mkjellman Michael Kjellman
            Michael Kjellman
            Jason Brown
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: