Merge lp:~trond-norbye/drizzle/memcached-startup into lp:~drizzle-trunk/drizzle/development

Proposed by Trond Norbye
Status: Merged
Merged at revision: not available
Proposed branch: lp:~trond-norbye/drizzle/memcached-startup
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: 152 lines (+55/-55)
5 files modified
.bzrignore (+1/-0)
plugin/memcached_functions/plugin.ac (+1/-0)
plugin/memcached_functions/tests/start_mc.sh (+0/-52)
plugin/memcached_functions/tests/start_mc.sh.in (+50/-0)
plugin/memcached_functions/tests/t/memc.test (+3/-3)
To merge this branch: bzr merge lp:~trond-norbye/drizzle/memcached-startup
Reviewer Review Type Date Requested Status
Drizzle Developers Pending
Review via email: mp+16276@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Trond Norbye (trond-norbye) wrote :

Fix the startup script for the memcached server to run the binary we detected during configure

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2009-12-05 00:32:01 +0000
3+++ .bzrignore 2009-12-17 11:06:14 +0000
4@@ -109,6 +109,7 @@
5 plugin/archive/archive_reader
6 plugin/archive/archive_test
7 plugin/archive/concurrency_test
8+plugin/memcached_functions/tests/start_mc.sh
9 plugin/myisam/myisamchk
10 plugin/myisam/myisamlog
11 plugin/myisam/myisampack
12
13=== modified file 'plugin/memcached_functions/plugin.ac'
14--- plugin/memcached_functions/plugin.ac 2009-11-21 01:47:03 +0000
15+++ plugin/memcached_functions/plugin.ac 2009-12-17 11:06:14 +0000
16@@ -3,3 +3,4 @@
17 AS_IF([test "x$ac_cv_libmemcached" = "xno" -a "x${MEMCACHED_BINARY}" = "xyes"],
18 AC_MSG_WARN([libmemcached not found: not building memcached_functions plugin.]))
19 DRIZZLED_PLUGIN_DEP_LIBS="${DRIZZLED_PLUGIN_DEP_LIBS} ${LTLIBMEMCACHED}"
20+AC_CONFIG_FILES([plugin/memcached_functions/tests/start_mc.sh])
21
22=== removed file 'plugin/memcached_functions/tests/start_mc.sh'
23--- plugin/memcached_functions/tests/start_mc.sh 2009-10-16 21:01:42 +0000
24+++ plugin/memcached_functions/tests/start_mc.sh 1970-01-01 00:00:00 +0000
25@@ -1,52 +0,0 @@
26-#! /bin/sh
27-
28-PORT=19191
29-if [ $MC_PORT ]; then
30- PORT=$MC_PORT
31-fi
32-
33-USER=nobody
34-MAXCONN=1024
35-CACHESIZE=1024
36-OPTIONS=""
37-
38-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:$PATH
39-RETVAL=0
40-
41-start () {
42- memcached -d -p $PORT -u $USER -m $CACHESIZE -c $MAXCONN -U 0
43- RETVAL=$?
44-}
45-stop () {
46- PIDS=`ps -ef | grep memcached | grep $PORT | grep $USER | grep -v grep | awk '{print $2}'`
47- if test "x${PIDS}" != "x"
48- then
49- echo "${PIDS}" | xargs -n1 kill -9
50- RETVAL=$?
51- fi
52-}
53-
54-restart () {
55- stop
56- start
57-}
58-
59-
60-# See how we were called.
61-case "$1" in
62- start)
63- start
64- ;;
65- stop)
66- stop
67- ;;
68- restart|reload)
69- restart
70- ;;
71- *)
72- echo $"Usage: $0 {start|stop|restart|reload}"
73- exit 1
74-esac
75-
76-exit $?
77-
78
79=== added file 'plugin/memcached_functions/tests/start_mc.sh.in'
80--- plugin/memcached_functions/tests/start_mc.sh.in 1970-01-01 00:00:00 +0000
81+++ plugin/memcached_functions/tests/start_mc.sh.in 2009-12-17 11:06:14 +0000
82@@ -0,0 +1,50 @@
83+#! /bin/sh
84+
85+PORT=19191
86+if [ $MC_PORT ]; then
87+ PORT=$MC_PORT
88+fi
89+
90+MAXCONN=1024
91+CACHESIZE=1024
92+OPTIONS=""
93+
94+startup()
95+{
96+ @MEMCACHED_BINARY@ -d -p $PORT -m $CACHESIZE -c $MAXCONN -U 0 -P /tmp/memc.pid.$PORT
97+}
98+
99+shutdown()
100+{
101+ if [ -f /tmp/memc.pid.$PORT ]
102+ then
103+ kill -9 `cat /tmp/memc.pid.$PORT`
104+ rm /tmp/memc.pid.$PORT
105+ fi
106+}
107+
108+restart()
109+{
110+ shutdown
111+ startup
112+}
113+
114+
115+# See how we were called.
116+case "$1" in
117+ start)
118+ startup
119+ ;;
120+ stop)
121+ shutdown
122+ ;;
123+ restart|reload)
124+ restart
125+ ;;
126+ *)
127+ echo $"Usage: $0 {start|stop|restart|reload}"
128+ exit 1
129+esac
130+
131+exit $?
132+
133
134=== modified file 'plugin/memcached_functions/tests/t/memc.test'
135--- plugin/memcached_functions/tests/t/memc.test 2009-12-04 18:50:04 +0000
136+++ plugin/memcached_functions/tests/t/memc.test 2009-12-17 11:06:14 +0000
137@@ -1,7 +1,7 @@
138 # we are assuming the memcached binary is contained in PATH or
139 # common directories we might expect it to be in
140---exec $DRIZZLE_TEST_DIR/../plugin/memcached_functions/tests/start_mc.sh stop
141---exec $DRIZZLE_TEST_DIR/../plugin/memcached_functions/tests/start_mc.sh start
142+--exec sh $DRIZZLE_TEST_DIR/../plugin/memcached_functions/tests/start_mc.sh stop
143+--exec sh $DRIZZLE_TEST_DIR/../plugin/memcached_functions/tests/start_mc.sh start
144
145 DROP TABLE IF EXISTS `t1`;
146 --replace_result $MC_PORT MC_A_PORT
147@@ -193,5 +193,5 @@
148 select memc_behavior_get('MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK');
149 select memc_behavior_set('MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK', @size);
150
151---exec $DRIZZLE_TEST_DIR/../plugin/memcached_functions/tests/start_mc.sh stop
152+--exec sh $DRIZZLE_TEST_DIR/../plugin/memcached_functions/tests/start_mc.sh stop
153