New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
9608 trunk #236
9608 trunk #236
Conversation
build.xml
Outdated
<property name="ecj.version" value="4.6.1"/> | ||
<property name="ohc.version" value="0.5.1"/> | ||
|
||
<!-- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: let's move this java version section above the dependencies section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
build.xml
Outdated
@@ -462,7 +501,9 @@ | |||
<dependency groupId="com.googlecode.concurrent-trees" artifactId="concurrent-trees" version="2.4.0" /> | |||
<dependency groupId="com.github.ben-manes.caffeine" artifactId="caffeine" version="2.3.5" /> | |||
<dependency groupId="org.jctools" artifactId="jctools-core" version="1.2.1"/> | |||
<dependency groupId="org.ow2.asm" artifactId="asm" version="5.0.4" /> | |||
<dependency groupId="org.ow2.asm" artifactId="asm" version="6.2" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe introduce a property with the version for org.ow2.asm
, like what you've done for ecj.version
and others?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
build.xml
Outdated
@@ -703,6 +744,13 @@ | |||
</patternset> | |||
<mapper type="flatten"/> | |||
</unzip> | |||
|
|||
<delete> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you need to delete the netty and asm jars here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise an older asm (and previously an older netty version as well) landed in build/lib/jars
via a transitive dependency.
conf/jvm11.options
Outdated
# Java 11 (and newer) GC logging options: | ||
# See description of https://bugs.openjdk.java.net/browse/JDK-8046148 for details about the syntax | ||
# The following is the equivalent to -XX:+PrintGCDetails -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10M | ||
#-Xlog:gc=info,heap*=trace,age*=debug,safepoint=info,promotion*=trace:file=/var/log/cassandra/gc.log:time,uptime,pid,tid,level:filecount=10,filesize=10240 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nit: filesize=10240
is the file size in bytes. change to 10485760
if you actually want 10MB files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch!
conf/cassandra-env.sh
Outdated
if ! grep -q "^-[X]log:gc" $CASSANDRA_CONF/jvm.options ; then # [X] to prevent ccm from replacing this line | ||
# only add -Xlog:gc if it's not mentioned in jvm.options file | ||
mkdir -p ${CASSANDRA_HOME}/logs | ||
JVM_OPTS="$JVM_OPTS -Xlog:gc=info,heap*=trace,age*=debug,safepoint=info,promotion*=trace:file=${CASSANDRA_HOME}/logs/gc.log:time,uptime,pid,tid,level:filecount=10,filesize=10240" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nit: filesize=10240
is the file size in bytes. change to 10485760
if you actually want 10MB files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch!
} | ||
isCleanerAvailable = canClean; | ||
} | ||
|
||
public static boolean isDirectBuffer(ByteBuffer buf) | ||
{ | ||
return clsDirectBuffer.isInstance(buf); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we just call ByteBuffer.isDirect()
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
@@ -208,7 +225,5 @@ public void checkPackageAccess(String pkg) | |||
RuntimePermission perm = new RuntimePermission("accessClassInPackage." + pkg); | |||
throw new AccessControlException("access denied: " + perm, perm); | |||
} | |||
|
|||
super.checkPackageAccess(pkg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we need to call super.checkPackageAccess()
anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise JavaScript based UDFs stop working due to JPMS, that would raise errors like
Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.jdk.internal.org.objectweb.asm")
@@ -78,7 +77,14 @@ | |||
static | |||
{ | |||
FILE_DESCRIPTOR_FD_FIELD = FBUtilities.getProtectedField(FileDescriptor.class, "fd"); | |||
FILE_CHANNEL_FD_FIELD = FBUtilities.getProtectedField(FileChannelImpl.class, "fd"); | |||
try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this in a try/catch block now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of the Class.forName
declaring the checked exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh, ok missed that one
{ | ||
// For Java 11 try to see whether the class actually exists and read the | ||
// class file data via the class' module. (This is necessary at least | ||
// for 9-ea build 123) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still true as of java11 (ea 19)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm - seems that was actually a bug in Java and it's been fixed.
private static Class clsDirectBuffer; | ||
private static MethodHandle mhDirectBufferCleaner; | ||
private static MethodHandle mhCleanerClean; | ||
private static MethodHandle mhDirectBufferAddress; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mhDirectBufferAddress
isn't used anywhere. can we eliminate it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
canClean = true; | ||
} | ||
catch (Throwable t) | ||
{ | ||
logger.info("Cannot initialize un-mmaper. Compacted data files will not be removed promptly.", t); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original log message here was rather awful. I'm not sure sure what actions an operator could take after seeing this, and Compacted data files will not be removed promptly
is sufficiently vague.
Maybe we could say something like: `Cannot initialize optimized memory deallocator. Some data, both in-memory and on-disk, may live longer due to garbage collection."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good
cleanerClean(buf, false); | ||
} | ||
|
||
public static void cleanerClean(ByteBuffer buf, boolean cleanAttachment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any code path where cleanAttachment
can be true. Am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yikes - that was wrong. good catch!
public static File createTempFile(String prefix, String suffix, File directory) | ||
{ | ||
try | ||
{ | ||
return File.createTempFile(prefix, suffix, directory); | ||
// Do not use java.io.File.createTempFile(), because some tests rely on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the tests that require monotonicity in the file version numbers also require the versions to be related to wall-clock time? If not, and the monotonicity / uniqueness guarantees are sufficient, you can simplify the while
loop below to get just the next value by tempFileNum.getAndIncrement()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I think that's reasonable.
b63587c
to
014b837
Compare
patch by Robert Stupp; reviewed by Jason Brown and Eduard Tudenhöfner for CASSANDRA-9608
use chronicle-core snapshot build to run on Java 11 the snapshot-build of chronicle-core solves the "junit.framework.AssertionFailedError: java.lang.NoSuchFieldException: reservedMemory" issue at net.openhft.chronicle.core.Jvm.<clinit>(Jvm.java:87) see OpenHFT/Chronicle-Core#68
conf/jvm11-clients.options
Outdated
########################################################################### | ||
# jvm11-clients.options # | ||
# # | ||
# See jvm-clients.options. This file is specific for Java 8 and newer. # |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this should say for Java 11 and newer
build.xml
Outdated
<property name="source.version" value="1.8"/> | ||
<property name="target.version" value="1.8"/> | ||
<!-- | ||
We specific '8' instead of '1.8' in source.version to indicate that that this build requires Java 11 _and_ Java 8. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
petty nit: We specify
build.xml
Outdated
@@ -1665,7 +1763,7 @@ | |||
<echo message="Mem size : ${mem.size}"/> | |||
</target> | |||
|
|||
<target name="test" depends="build-test,get-cores,get-mem,stress-build" description="Parallel Test Runner"> | |||
<target name="test" depends="build-test" description="Parallel Test Runner"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this not depend on get-cores,get-mem
anymore? Otherwise, those targets are unused in the build.xml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, re-added
@@ -591,14 +592,17 @@ private NameEnvironmentAnswer findType(String className) | |||
|
|||
String resourceName = className.replace('.', '/') + ".class"; | |||
|
|||
try (InputStream is = UDFunction.udfClassLoader.getResourceAsStream(resourceName)) | |||
try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why we need a nested try
block here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah - I've changed that part twice. But yea, one try-catch is absolutely sufficient.
JVMStabilityInspector.inspectThrowable(t); | ||
logger.info("Cannot initialize un-mmaper. (Are you using a non-Oracle JVM?) Compacted data files will not be removed promptly. Consider using an Oracle JVM or using standard disk access mode"); | ||
throw new RuntimeException(t); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, this is a change in semantics (throwing a RuntimeException). Previously, we would just complain if we couldn't get to the buffer cleaner, now we're basically terminating the process. Is that intended? If it is, at minimum the log statement a few lines up should be FATAL
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty much every JVM should have a Cleaner
nowadays. Not having would break a lot of assumṕtions IMO.
Changed the log message to ERROR.
|
||
// We have a positive long here, which is safe to use for example | ||
// for CommitLogTest. | ||
String timePart = Long.toString(num); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename this variable, or maybe just move Long.toString(num)
into the next line.
DirectBuffer db = (DirectBuffer) buffer; | ||
if (db.cleaner() != null) | ||
db.cleaner().clean(); | ||
if (buffer.isDirect()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is redundant as you've already performed the !buffer.isDirect()
earlier in this method (and bailed if it isn't)
db.cleaner().clean(); | ||
if (buffer.isDirect()) | ||
{ | ||
Object cleaner = mhDirectBufferCleaner.bindTo(buffer).invoke(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some comments here? It's not clear what's going on, but more importantly, why there's two code paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woops. There shouldn't be any else.
@@ -78,7 +77,14 @@ | |||
static | |||
{ | |||
FILE_DESCRIPTOR_FD_FIELD = FBUtilities.getProtectedField(FileDescriptor.class, "fd"); | |||
FILE_CHANNEL_FD_FIELD = FBUtilities.getProtectedField(FileChannelImpl.class, "fd"); | |||
try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh, ok missed that one
Is javaexec.in.sh needed anymore? Looks like all the java checks are in |
No, it's no longer needed. I removed it. |
Committed as sha |
(cherry picked from commit 5f0479d)
(cherry picked from commit 5f0479d)
No description provided.