Skip to content

Commit

Permalink
Add nodetool fix for JDK-8278972 (CASSANDRA-17581) (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
emerkle826 authored Jun 2, 2022
1 parent ad92c57 commit a7e16a3
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions scripts/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,27 @@ _metrics_collector_supported() {
[ "$(uname -m)" != "aarch64" ]
}

_needs_nodetool_fix() {
# JDK (8 and 11) updates that include the fix for JDK-8278972 cause nodetool
# to break due to the more strict URI parsing. This is fixed in Cassandra as
# of 3.11.13 and 4.0.4. Management API images based on Cassandra versions
# 3.11.12 and 4.0.3 will need to provide a work around
[ "${CASSANDRA_VERSION}" == "3.11.12" -o ${CASSANDRA_VERSION} == "4.0.3" ]
}

_nodetool_fix() {
# create a wrapper around nodetool to switch URI parsing to legacy mode
if [ -e /opt/cassandra/bin/nodetool ] ; then
cp -a /opt/cassandra/bin/nodetool /opt/cassandra/bin/nodetool.orig
# create a wrapper
cat << EOF > /opt/cassandra/bin/nodetool
#!/bin/sh
/opt/cassandra/bin/nodetool.orig -Dcom.sun.jndi.rmiURLParsing=legacy "$@"
EOF
fi
}

if [ "$1" = 'mgmtapi' ]; then
echo "Starting Management API"

Expand All @@ -54,6 +75,11 @@ if [ "$1" = 'mgmtapi' ]; then
cp -R /config/* "${CASSANDRA_CONF:-/etc/cassandra}"
fi

# Add the nodetool fix if needed
if _needs_nodetool_fix ; then
_nodetool_fix
fi

# Make sure the management api agent jar is set
# We do this here for the following reasons:
# 1. configbuilder will overwrite the cassandra-env-sh, so we don't want to set this after
Expand Down

0 comments on commit a7e16a3

Please sign in to comment.