File tree 2 files changed +60
-0
lines changed
2 files changed +60
-0
lines changed Original file line number Diff line number Diff line change 115
115
CASSANDRA_VERSION_FROM_BUILD = get_version_from_build (CASSANDRA_DIR )
116
116
117
117
118
+ # Determine the location of the libjemalloc jar so that we can specify it
119
+ # through environment variables when start Cassandra. This reduces startup
120
+ # time, making the dtests run faster.
121
+ def find_libjemalloc ():
122
+ if is_win ():
123
+ # let the normal bat script handle finding libjemalloc
124
+ return ""
125
+
126
+ this_dir = os .path .dirname (os .path .realpath (__file__ ))
127
+ script = os .path .join (this_dir , "findlibjemalloc.sh" )
128
+ try :
129
+ p = subprocess .Popen ([script ], stdout = subprocess .PIPE , stderr = subprocess .PIPE )
130
+ stdout , stderr = p .communicate ()
131
+ if stderr or not stdout :
132
+ return "-" # tells C* not to look for libjemalloc
133
+ else :
134
+ return stdout
135
+ except Exception , exc :
136
+ print "Failed to run script to prelocate libjemalloc ({}): {}" .format (script , exc )
137
+ return ""
138
+
139
+ CASSANDRA_LIBJEMALLOC = find_libjemalloc ()
140
+
141
+
118
142
class expect_control_connection_failures (object ):
119
143
"""
120
144
We're just using a class here as a one-off object with a filter method, for
@@ -270,6 +294,7 @@ def _get_cluster(self, name='test'):
270
294
cluster .set_configuration_options (values = {'memtable_allocation_type' : 'offheap_objects' })
271
295
272
296
cluster .set_datadir_count (DATADIR_COUNT )
297
+ cluster .set_environment_variable ('CASSANDRA_LIBJEMALLOC' , CASSANDRA_LIBJEMALLOC )
273
298
274
299
return cluster
275
300
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ # taken from bin/cassandra
4
+
5
+ find_library ()
6
+ {
7
+ pattern=$1
8
+ path=$( echo ${2} | tr " :" " " )
9
+ find $path -regex " $pattern " -print 2> /dev/null | head -n 1
10
+ }
11
+
12
+ case " ` uname -s` " in
13
+ Linux)
14
+ which ldconfig > /dev/null 2>&1
15
+ if [ $? = 0 ] ; then
16
+ # e.g. for CentOS
17
+ dirs=" /lib64 /lib /usr/lib64 /usr/lib ` ldconfig -v 2> /dev/null | grep -v ' ^\s' | sed ' s/^\([^:]*\):.*$/\1/' ` "
18
+ else
19
+ # e.g. for Debian, OpenSUSE
20
+ dirs=" /lib64 /lib /usr/lib64 /usr/lib ` cat /etc/ld.so.conf /etc/ld.so.conf.d/* .conf | grep ' ^/' ` "
21
+ fi
22
+ dirs=` echo $dirs | tr " " " :" `
23
+ CASSANDRA_LIBJEMALLOC=$( find_library ' .*/libjemalloc\.so\(\.1\)*' $dirs )
24
+ ;;
25
+ Darwin)
26
+ CASSANDRA_LIBJEMALLOC=$( find_library ' .*/libjemalloc\.dylib' $DYLD_LIBRARY_PATH :${DYLD_FALLBACK_LIBRARY_PATH-$HOME / lib:/ usr/ local/ lib:/ lib:/ usr/ lib} )
27
+ ;;
28
+ esac
29
+
30
+ if [ ! -z $CASSANDRA_LIBJEMALLOC ] ; then
31
+ echo $( CASSANDRA_LIBJEMALLOC)
32
+ exit 0
33
+ else
34
+ exit 1
35
+ fi
You can’t perform that action at this time.
0 commit comments