Improve libjemalloc resolution in bin/cassandra

patch by Stefan Miklosovic; reviewed by Brandon Williams and David Capwell for CASSANDRA-15767
This commit is contained in:
Stefan Miklosovic 2022-08-11 22:39:17 +02:00
parent 299bfaed35
commit ebddf77924
2 changed files with 14 additions and 7 deletions

View File

@ -1,4 +1,5 @@
3.0.28
* Improve libjemalloc resolution in bin/cassandra (CASSANDRA-15767)
* Fix missing state resetting on CompressedRandomAccessReader read errors (CASSANDRA-17314)
* Fix restarting of services on gossipping-only member (CASSANDRA-17752)
* Fix writetime and ttl functions forbidden for collections instead of multicell columns (CASSANDRA-17628)

View File

@ -152,21 +152,27 @@ find_library()
pattern=$1
path=$(echo ${2} | tr ":" " ")
find $path -regex "$pattern" -print 2>/dev/null | head -n 1
find $path -regex "$pattern" -print 2>/dev/null | sort -ru | head -n 1
}
case "`uname -s`" in
Linux)
if [ -z $CASSANDRA_LIBJEMALLOC ] ; then
dirs="/lib64 /lib /usr/lib64 /usr/lib "
which ldconfig > /dev/null 2>&1
if [ $? = 0 ] ; then
# e.g. for CentOS
dirs="/lib64 /lib /usr/lib64 /usr/lib `ldconfig -v 2>/dev/null | grep -v '^\s' | sed 's/^\([^:]*\):.*$/\1/'`"
else
# e.g. for Debian, OpenSUSE
dirs="/lib64 /lib /usr/lib64 /usr/lib `cat /etc/ld.so.conf /etc/ld.so.conf.d/*.conf | grep '^/'`"
dirs="$dirs `ldconfig -v 2>/dev/null | grep -v '^\s' | sed 's/^\([^:]*\):.*$/\1/'`"
fi
if [ -f /etc/ld.so.conf ]; then
dirs="$dirs `cat /etc/ld.so.conf | grep '^/'`"
fi
additional_configs=$(ls /etc/ld.so.conf.d/*.conf 2>&1)
if [ $? = 0 ]; then
for conf in $additional_configs; do
dirs="$dirs `cat $conf | grep '^/'`"
done
fi
dirs=`echo $dirs | tr " " ":"`
CASSANDRA_LIBJEMALLOC=$(find_library '.*/libjemalloc\.so\(\.1\)*' $dirs)
CASSANDRA_LIBJEMALLOC=$(find_library '.*/libjemalloc\.so.*' $dirs)
fi
if [ ! -z $CASSANDRA_LIBJEMALLOC ] ; then
export JVM_OPTS="$JVM_OPTS -Dcassandra.libjemalloc=$CASSANDRA_LIBJEMALLOC"