Skip to content

Commit d344596

Browse files
docker: updates zipkin-cassandra test image to 4.1.8 (#3794)
If you just update to 4.1.8 and change nothing else, you'll crash like this: ``` 14.33 [2025-02-16 11:04:06,099] ERROR Exception encountered during startup (org.apache.cassandra.service.CassandraDaemon) 14.33 java.lang.UnsupportedOperationException: can't get field offset on a hidden class: private final org.apache.cassandra.db.ClusteringComparator org.apache.cassandra.db.ClusteringComparator$$Lambda/0x000000e0012f5220.arg$1 14.33 at jdk.unsupported/sun.misc.Unsafe.objectFieldOffset(Unsafe.java:652) 14.33 at org.github.jamm.MemoryLayoutSpecification.sizeOfInstanceWithUnsafe(MemoryLayoutSpecification.java:108) 14.33 at org.github.jamm.MemoryLayoutSpecification.sizeOfWithUnsafe(MemoryLayoutSpecification.java:89) 14.33 at org.github.jamm.MemoryMeter.measure(MemoryMeter.java:217) 14.33 at org.github.jamm.MemoryMeter.measureDeep(MemoryMeter.java:259) 14.33 at org.apache.cassandra.utils.ObjectSizes.measureDeep(ObjectSizes.java:219) 14.33 at org.apache.cassandra.cql3.QueryProcessor.measurePstmnt(QueryProcessor.java:912) 14.33 at org.apache.cassandra.cql3.QueryProcessor.parseAndPrepare(QueryProcessor.java:445) 14.33 at org.apache.cassandra.cql3.QueryProcessor.prepareInternal(QueryProcessor.java:414) 14.33 at org.apache.cassandra.cql3.QueryProcessor.executeInternal(QueryProcessor.java:452) 14.33 at org.apache.cassandra.db.SystemKeyspace.checkHealth(SystemKeyspace.java:1087) 14.33 at org.apache.cassandra.service.StartupChecks$13.execute(StartupChecks.java:630) 14.33 at org.apache.cassandra.service.StartupChecks.verify(StartupChecks.java:174) 14.33 at org.apache.cassandra.service.CassandraDaemon.runStartupChecks(CassandraDaemon.java:499) 14.33 at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:253) 14.33 at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:744) 14.33 at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:878) ``` This is due ultimately to needing to upgrade jamm, which had some signature drift. [CASSANDRA-18329](https://issues.apache.org/jira/browse/CASSANDRA-18329) fixes this in 5.0, but not in 4.1. [CASSANDRA-18329](https://issues.apache.org/jira/browse/CASSANDRA-18329) fixed this particularly by [updating call sites to jamm in ObjectSizes.java](apache/cassandra@600f4d9#diff-1122d7d3efe9721af7244d373e66378f7e90cb05fd65859a52e8a3ea58a7c8f9). We use JRE 21 in our test image even though cassandra 4.1 doesn't really support it, to save base layers. The easiest way to fix this was to grab the ObjectSizes.java file from 5.0.3 and the revert their renaming of a public method so it could be a drop in patch. --------- Signed-off-by: Adrian Cole <adrian.cole@elastic.co>
1 parent faa1650 commit d344596

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

docker/test-images/zipkin-cassandra/Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ FROM ghcr.io/openzipkin/java:${java_version} as install
2525
# Use latest stable version: https://cassandra.apache.org/download/
2626
# This is defined in many places because Docker has no "env" script functionality unless you use
2727
# docker-compose: When updating, update everywhere.
28-
# TODO: revlocked, so probably put effort into 5.x instead
29-
ARG cassandra_version=4.1.7
28+
ARG cassandra_version=4.1.8
3029
ENV CASSANDRA_VERSION=$cassandra_version
3130
WORKDIR /install
3231

@@ -36,7 +35,7 @@ RUN /tmp/install.sh && rm /tmp/install.sh
3635

3736
FROM ghcr.io/openzipkin/java:${java_version}-jre as zipkin-cassandra
3837
LABEL org.opencontainers.image.description="Cassandra on OpenJDK and Alpine Linux with Zipkin keyspaces pre-installed"
39-
ARG cassandra_version=4.1.7
38+
ARG cassandra_version=4.1.8
4039
LABEL cassandra-version=$cassandra_version
4140
ENV CASSANDRA_VERSION=$cassandra_version
4241

docker/test-images/zipkin-cassandra/install.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ cat > pom.xml <<-'EOF'
3333
<groupId>net.java.dev.jna</groupId>
3434
<artifactId>*</artifactId>
3535
</exclusion>
36+
<exclusion>
37+
<groupId>com.github.jbellis</groupId>
38+
<artifactId>*</artifactId>
39+
</exclusion>
3640
<exclusion>
3741
<groupId>org.slf4j</groupId>
3842
<artifactId>*</artifactId>
@@ -49,6 +53,12 @@ cat > pom.xml <<-'EOF'
4953
<artifactId>jna</artifactId>
5054
<version>5.16.0</version>
5155
</dependency>
56+
<!-- Use latest to work with JRE 21 per CASSANDRA-18329 -->
57+
<dependency>
58+
<groupId>com.github.jbellis</groupId>
59+
<artifactId>jamm</artifactId>
60+
<version>0.4.0</version>
61+
</dependency>
5262
<!-- log4j not logback -->
5363
<dependency>
5464
<groupId>org.slf4j</groupId>
@@ -63,6 +73,14 @@ mvn -q --batch-mode -DoutputDirectory=lib \
6373
org.apache.maven.plugins:maven-dependency-plugin:3.8.1:copy-dependencies
6474
rm pom.xml
6575

76+
# Get a version of ObjectSizes.java that compiles with jamm 0.4.0
77+
wget --random-wait --tries=5 -qO ObjectSizes.java \
78+
https://raw.githubusercontent.com/apache/cassandra/refs/tags/cassandra-5.0.3/src/java/org/apache/cassandra/utils/ObjectSizes.java
79+
# Rename a public method back to the same name as used in Cassandra 4.1.
80+
sed -i 's/sizeOnHeapExcludingDataOf/sizeOnHeapExcludingData/g' ObjectSizes.java
81+
# Compile it into classes, which overrides the same class from Cassandra 4.1.
82+
javac -cp 'lib/*' -d classes ObjectSizes.java
83+
6684
# Make sure you use relative paths in references like this, so that installation
6785
# is decoupled from runtime
6886
mkdir -p conf data commitlog saved_caches hints triggers
@@ -116,7 +134,7 @@ sed -i '/read_repair_chance/d' schema
116134
#
117135
# Merging makes adding Cassandra v5 easier and lets us share a common JRE 17+
118136
# with other test images even if Cassandra v4 will never officially support it.
119-
# https://github.com/apache/cassandra/blob/cassandra-4.1.7/conf/jvm11-server.options
137+
# https://github.com/apache/cassandra/blob/cassandra-4.1.8/conf/jvm11-server.options
120138
# https://github.com/apache/cassandra/blob/cassandra-5.0.3/conf/jvm17-server.options
121139
#
122140
# Finally, we allow security manager to prevent JRE 21 crashing when Cassandra

0 commit comments

Comments
 (0)