r47967 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47966‎ | r47967 | r47968 >
Date:04:53, 3 March 2009
Author:river
Status:deferred
Tags:
Comment:
TSsshtunnel, TScheckraid: new specs
TSmysql: link server with -lmtmalloc, and preload libfasttime
TSmytop: count 'queries' instead of 'questions'
Modified paths:
  • /trunk/tools/ts-specs/TScheckraid.spec (added) (history)
  • /trunk/tools/ts-specs/TSmysql.spec (modified) (history)
  • /trunk/tools/ts-specs/TSmytop.spec (modified) (history)
  • /trunk/tools/ts-specs/TSsshtunnel.spec (added) (history)
  • /trunk/tools/ts-specs/base-specs/mysql.spec (modified) (history)
  • /trunk/tools/ts-specs/ext-sources/checkraid.awk (added) (history)
  • /trunk/tools/ts-specs/ext-sources/checkraid.sh (added) (history)
  • /trunk/tools/ts-specs/ext-sources/mysql.xml (added) (history)
  • /trunk/tools/ts-specs/ext-sources/sshtunnel-smf (added) (history)
  • /trunk/tools/ts-specs/ext-sources/sshtunnel.xml (added) (history)
  • /trunk/tools/ts-specs/patches/mysql-02-fasttime.diff (added) (history)
  • /trunk/tools/ts-specs/patches/mytop-02-questions.diff (added) (history)

Diff [purge]

Index: trunk/tools/ts-specs/TSmytop.spec
@@ -5,6 +5,7 @@
66 Version: 1.6
77 Source: http://jeremy.zawodny.com/mysql/mytop/mytop-%{version}.tar.gz
88 Patch1: mytop-01-specials.diff
 9+Patch2: mytop-02-questions.diff
910
1011 SUNW_BaseDir: %{_basedir}
1112 BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -22,6 +23,7 @@
2324 %prep
2425 %setup -q -n mytop-%version
2526 %patch1 -p0
 27+%patch2 -p0
2628
2729 %build
2830
Index: trunk/tools/ts-specs/TSmysql.spec
@@ -13,12 +13,14 @@
1414 Name: %{mysql.name}
1515 Summary: %{mysql.summary}
1616 Version: %{mysql.version}
 17+Source2: mysql.xml
1718
1819 SUNW_BaseDir: /opt/TSmysql
1920 BuildRoot: %{_tmppath}/%{name}-%{version}-build
2021 %include default-depend.inc
2122
2223 Requires: TSisaexec
 24+Requires: TSlibfasttime
2325
2426 %package devel
2527 Summary: %{summary} - development files
@@ -26,6 +28,10 @@
2729 %include default-depend.inc
2830 Requires: %name
2931
 32+%package root
 33+Summary: %{summary} - / filesystem
 34+SUNW_BaseDir: /
 35+
3036 %package extra
3137 Summary: %{summary} - test suite and benchmark tools
3238 SUNW_BaseDir: %{_basedir}
@@ -92,6 +98,9 @@
9399
94100 ln -s ../../ts/lib/isaexec $RPM_BUILD_ROOT%{_libdir}/mysqld
95101
 102+mkdir -p $RPM_BUILD_ROOT/var/svc/manifest
 103+cp %SOURCE2 $RPM_BUILD_ROOT/var/svc/manifest
 104+
96105 %clean
97106 rm -rf $RPM_BUILD_ROOT
98107
@@ -148,6 +157,10 @@
149158 %{_bindir}/%_arch64/*
150159 %endif
151160
 161+%files root
 162+%defattr (-, root, sys)
 163+%class(manifest) /var/svc/manifest/mysql.xml
 164+
152165 %files extra
153166 %defattr (-, root, bin)
154167 %dir %attr (0755, root, sys) %{_prefix}/mysql-test
Index: trunk/tools/ts-specs/patches/mytop-02-questions.diff
@@ -0,0 +1,56 @@
 2+--- mytop.old Tue Mar 3 04:50:15 2009
 3+@@ -803,8 +803,8 @@
 4+
 5+ ## Queries per second...
 6+
 7+- my $avg_queries_per_sec = sprintf("%.2f", $STATUS{Questions} / $STATUS{Uptime});
 8+- my $num_queries = $STATUS{Questions};
 9++ my $avg_queries_per_sec = sprintf("%.2f", $STATUS{Queries} / $STATUS{Uptime});
 10++ my $num_queries = $STATUS{Queries};
 11+
 12+ my @t = localtime(time);
 13+
 14+@@ -823,25 +823,25 @@
 15+
 16+
 17+ printf " Queries: %-5s qps: %4.0f Slow: %7s Se/In/Up/De(%%): %02.0f/%02.0f/%02.0f/%02.0f \n",
 18+- make_short( $STATUS{Questions} ), # q total
 19+- $STATUS{Questions} / $STATUS{Uptime}, # qps, average
 20++ make_short( $STATUS{Queries} ), # q total
 21++ $STATUS{Queries} / $STATUS{Uptime}, # qps, average
 22+ make_short( $STATUS{Slow_queries} ), # slow
 23+
 24+ # hmm. a Qcache hit is really a select and should be counted.
 25+- 100 * ($STATUS{Com_select} + ($STATUS{Qcache_hits}||0) ) / $STATUS{Questions},
 26+- 100 * ($STATUS{Com_insert} + $STATUS{Com_replace} ) / $STATUS{Questions},
 27+- 100 * ($STATUS{Com_update} ) / $STATUS{Questions},
 28+- 100 * $STATUS{Com_delete} / $STATUS{Questions};
 29++ 100 * ($STATUS{Com_select} + ($STATUS{Qcache_hits}||0) ) / $STATUS{Queries},
 30++ 100 * ($STATUS{Com_insert} + $STATUS{Com_replace} ) / $STATUS{Queries},
 31++ 100 * ($STATUS{Com_update} ) / $STATUS{Queries},
 32++ 100 * $STATUS{Com_delete} / $STATUS{Queries};
 33+
 34+ $lines_left--;
 35+
 36+ if ($t_delta)
 37+ {
 38+- my $q_diff = ( $STATUS{Questions} - $OLD_STATUS{Questions} );
 39++ my $q_diff = ( $STATUS{Queries} - $OLD_STATUS{Queries} );
 40+ # print("q_diff: $STATUS{Questions} - $OLD_STATUS{Questions} / $t_delta = $q_diff\n");
 41+
 42+ printf(" qps now: %4.0f Slow qps: %3.1f Threads: %4.0f (%4.0f/%4.0f) %02.0f/%02.0f/%02.0f/%02.0f \n",
 43+- ( $STATUS{Questions} - $OLD_STATUS{Questions} ) / $t_delta,
 44++ ( $STATUS{Queries} - $OLD_STATUS{Queries} ) / $t_delta,
 45+ ( # slow now (qps)
 46+ ($STATUS{Slow_queries} ) ?
 47+ ( $STATUS{Slow_queries} - $OLD_STATUS{Slow_queries} ) / $t_delta :
 48+@@ -1068,7 +1068,7 @@
 49+
 50+ sub GetQPS()
 51+ {
 52+- my($data) = Hashes('SHOW STATUS LIKE "Questions"');
 53++ my($data) = Hashes('SHOW STATUS LIKE "Queries"');
 54+ my $num = $data->{Value};
 55+
 56+ if (not defined $questions) ## first time?
Index: trunk/tools/ts-specs/patches/mysql-02-fasttime.diff
@@ -0,0 +1,13 @@
 2+--- scripts/mysqld_safe.sh.old Tue Mar 3 03:22:53 2009
 3+@@ -542,6 +542,10 @@
 4+ # Avoid 'nohup: ignoring input' warning
 5+ test -n "$NOHUP_NICENESS" && cmd="$cmd < /dev/null"
 6+
 7++LD_PRELOAD_32=/opt/ts/lib/libfasttime.so
 8++LD_PRELOAD_64=/opt/ts/lib/amd64/libfasttime.so
 9++export LD_PRELOAD_32 LD_PRELOAD_64
 10++
 11+ log_notice "Starting $MYSQLD daemon with databases from $DATADIR"
 12+ while true
 13+ do
Index: trunk/tools/ts-specs/ext-sources/sshtunnel.xml
@@ -0,0 +1,29 @@
 2+<?xml version='1.0'?>
 3+<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
 4+<service_bundle type='manifest' name='export'>
 5+ <service name='network/sshtunnel' type='service' version='0'>
 6+ <create_default_instance enabled='false'/>
 7+ <dependency name='multi-user-server' grouping='optional_all' restart_on='none' type='service'>
 8+ <service_fmri value='svc:/milestone/multi-user-server'/>
 9+ </dependency>
 10+ <exec_method name='start' type='method' exec='/opt/ts/bin/sshtunnel-smf' timeout_seconds='60'>
 11+ <method_context/>
 12+ </exec_method>
 13+ <exec_method name='stop' type='method' exec=':kill' timeout_seconds='60'>
 14+ <method_context/>
 15+ </exec_method>
 16+ <property_group name='tunnel' type='application'>
 17+ <propval name='local-port' type='integer' value='0'/>
 18+ <propval name='remote-host' type='astring' value=''/>
 19+ <propval name='remote-port' type='integer' value='0'/>
 20+ </property_group>
 21+ <property_group name='startd' type='framework'>
 22+ <propval name='duration' type='astring' value='child'/>
 23+ </property_group>
 24+ <template>
 25+ <common_name>
 26+ <loctext xml:lang='C'>SSH tunnel</loctext>
 27+ </common_name>
 28+ </template>
 29+ </service>
 30+</service_bundle>
Index: trunk/tools/ts-specs/ext-sources/mysql.xml
@@ -0,0 +1,24 @@
 2+<?xml version='1.0'?>
 3+<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
 4+<service_bundle type='manifest' name='export'>
 5+ <service name='application/mysql' type='service' version='0'>
 6+ <create_default_instance enabled='false'/>
 7+ <dependency name='multi-user-server' grouping='optional_all' restart_on='none' type='service'>
 8+ <service_fmri value='svc:/milestone/multi-user-server'/>
 9+ </dependency>
 10+ <exec_method name='start' type='method' exec='/opt/TSmysql/bin/mysqld_safe' timeout_seconds='60'>
 11+ <method_context/>
 12+ </exec_method>
 13+ <exec_method name='stop' type='method' exec='/opt/TSmysql/bin/mysqladmin --defaults-file=/root/.my.cnf shutdown' timeout_seconds='1200'>
 14+ <method_context/>
 15+ </exec_method>
 16+ <property_group name='startd' type='framework'>
 17+ <propval name='duration' type='astring' value='child'/>
 18+ </property_group>
 19+ <template>
 20+ <common_name>
 21+ <loctext xml:lang='C'>MySQL</loctext>
 22+ </common_name>
 23+ </template>
 24+ </service>
 25+</service_bundle>
Index: trunk/tools/ts-specs/ext-sources/checkraid.sh
@@ -0,0 +1,66 @@
 2+#! /bin/ksh
 3+
 4+MAILTO=admins@toolserver.org
 5+VARDIR=/var/opt/ts/checkstatus
 6+LIBDIR=/opt/ts/lib
 7+
 8+PROG=$LIBDIR/checkraid.awk
 9+ARCCONF=/opt/StorMan/arcconf
 10+STATUSFILE=$VARDIR/curr
 11+NEWSTATUS=$VARDIR/new
 12+MAILFILE=$VARDIR/mail
 13+
 14+if ! [ -d "$VARDIR" ]; then
 15+ if ! mkdir -p "$VARDIR"; then
 16+ echo >&2 "$0: could not create $VARDIR"
 17+ exit 1
 18+ fi
 19+fi
 20+
 21+if ! [ -x "$ARCCONF" ]; then
 22+ echo >&2 "$0: $ARCCONF not found; please install the StorMan package."
 23+ exit 1
 24+fi
 25+
 26+if ! $ARCCONF GETCONFIG 1 | $PROG >$NEWSTATUS; then
 27+ echo >&2 "$0: $ARCCONF failed; see above messages for details"
 28+ exit 1
 29+fi
 30+
 31+if [ ! -f $STATUSFILE ]; then
 32+ if ! mv $NEWSTATUS $STATUSFILE; then
 33+ echo >&2 "$0: couldn't write to the status file $STATUSFILE"
 34+ exit 1
 35+ fi
 36+
 37+ exit 0
 38+fi
 39+
 40+if cmp -s $NEWSTATUS $STATUSFILE; then
 41+ rm -f $NEWSTATUS
 42+ exit 0
 43+fi
 44+
 45+rm -f $MAILFILE
 46+cat >$MAILFILE <<__EOF__
 47+A change has been detected in the RAID controller on $(hostname):
 48+
 49+__EOF__
 50+diff -u $STATUSFILE $NEWSTATUS >>$MAILFILE
 51+cat >>$MAILFILE <<__EOF__
 52+
 53+The full controller status follows:
 54+
 55+__EOF__
 56+cat $NEWSTATUS >>$MAILFILE
 57+
 58+rm -f $STATUSFILE
 59+mv $NEWSTATUS $STATUSFILE
 60+
 61+if ! mailx -s "RAID status change for $(hostname)" $MAILTO <$MAILFILE; then
 62+ echo >&2 "$0: can't send mail"
 63+ exit 1
 64+fi
 65+
 66+rm -f $MAILFILE
 67+exit 0
Property changes on: trunk/tools/ts-specs/ext-sources/checkraid.sh
___________________________________________________________________
Name: svn:executable
168 + *
Index: trunk/tools/ts-specs/ext-sources/sshtunnel-smf
@@ -0,0 +1,27 @@
 2+#! /bin/ksh
 3+
 4+ . /lib/svc/share/smf_include.sh
 5+
 6+getproparg() {
 7+ val=`svcprop -p $1 $SMF_FMRI`
 8+ [ -n "$val" ] && echo $val
 9+}
 10+
 11+localport=`getproparg tunnel/local-port`
 12+remoteport=`getproparg tunnel/remote-port`
 13+remotehost=`getproparg tunnel/remote-host`
 14+
 15+echo $localport $remoteport $remotehost
 16+
 17+while true; do
 18+ ssh -Cni /etc/opt/sshtunnel/id_dsa \
 19+ -L$localport:$remotehost:$remoteport \
 20+ -cblowfish-cbc \
 21+ -n -N \
 22+ pppuser@browne.wikimedia.org
 23+
 24+ # Transitory network problem?
 25+ sleep 5
 26+done
 27+
 28+exit 0
Property changes on: trunk/tools/ts-specs/ext-sources/sshtunnel-smf
___________________________________________________________________
Name: svn:executable
129 + *
Index: trunk/tools/ts-specs/ext-sources/checkraid.awk
@@ -0,0 +1,25 @@
 2+#! /usr/bin/nawk -f
 3+
 4+BEGIN {
 5+ FAILED_DISK=0
 6+ FAILED_VOLUME=0
 7+}
 8+
 9+/Controller Status/ {
 10+ STATUS=$4
 11+}
 12+
 13+/Defunct disk drive count/ {
 14+ FAILED_DISK=$6
 15+}
 16+
 17+/Logical devices\/Failed\/Degraded/ {
 18+ split($4, x, / /)
 19+ FAILED_VOLUME=x[2] + x[3]
 20+}
 21+
 22+END {
 23+ print "Controller status: " STATUS
 24+ print "Failed disks: " FAILED_DISK
 25+ print "Failed volumes: " FAILED_VOLUME
 26+}
Property changes on: trunk/tools/ts-specs/ext-sources/checkraid.awk
___________________________________________________________________
Name: svn:executable
127 + *
Index: trunk/tools/ts-specs/TSsshtunnel.spec
@@ -0,0 +1,45 @@
 2+%include Solaris.inc
 3+
 4+Name: TSsshtunnel
 5+Summary: SSH tunnel service
 6+Version: 1
 7+Source1: sshtunnel.xml
 8+Source2: sshtunnel-smf
 9+
 10+SUNW_BaseDir: %{_basedir}
 11+BuildRoot: %{_tmppath}/%{name}-%{version}-build
 12+%include default-depend.inc
 13+
 14+%package root
 15+Summary: %{summary} - / filesystem
 16+SUNW_BaseDir: /
 17+%include default-depend.inc
 18+
 19+%prep
 20+%setup -q -T -c -n %name-%version
 21+
 22+%build
 23+
 24+%install
 25+rm -rf $RPM_BUILD_ROOT
 26+mkdir -p $RPM_BUILD_ROOT/var/svc/manifest/network
 27+cp %SOURCE1 $RPM_BUILD_ROOT/var/svc/manifest/network
 28+mkdir -p $RPM_BUILD_ROOT%{_bindir}
 29+cp %SOURCE2 $RPM_BUILD_ROOT%{_bindir}
 30+
 31+%clean
 32+rm -rf $RPM_BUILD_ROOT
 33+
 34+%files
 35+%defattr (-, root, bin)
 36+%dir %attr (0755, root, bin) %{_bindir}
 37+%attr (0755, root, bin) %{_bindir}/sshtunnel-smf
 38+
 39+%files root
 40+%defattr (-, root, sys)
 41+%dir %attr (0755, root, sys) /var/svc/manifest/network
 42+%class(manifest) /var/svc/manifest/network/sshtunnel.xml
 43+
 44+%changelog
 45+* Sun Mar 01 2009 - river@loreley.flyingparchment.org.uk
 46+- initial spec
Index: trunk/tools/ts-specs/TScheckraid.spec
@@ -0,0 +1,38 @@
 2+%include Solaris.inc
 3+
 4+Name: TScheckraid
 5+Summary: checkraid utility for Adapter RAID controllers
 6+Version: 1
 7+Source1: checkraid.sh
 8+Source2: checkraid.awk
 9+
 10+SUNW_BaseDir: %{_basedir}
 11+BuildRoot: %{_tmppath}/%{name}-%{version}-build
 12+%include default-depend.inc
 13+
 14+# Requires:
 15+
 16+%prep
 17+%setup -q -T -c -n %name-%version
 18+%build
 19+
 20+%install
 21+rm -rf $RPM_BUILD_ROOT
 22+mkdir -p $RPM_BUILD_ROOT%{_libdir}
 23+cp %SOURCE2 $RPM_BUILD_ROOT%{_libdir}
 24+mkdir -p $RPM_BUILD_ROOT%{_bindir}
 25+cp %SOURCE1 $RPM_BUILD_ROOT%{_bindir}/checkraid
 26+
 27+%clean
 28+rm -rf $RPM_BUILD_ROOT
 29+
 30+%files
 31+%defattr (-, root, bin)
 32+%dir %attr (0755, root, bin) %{_bindir}
 33+%attr (0755, root, bin) %{_bindir}/checkraid
 34+%dir %attr (0755, root, bin) %{_libdir}
 35+%attr (0755, root, bin) %{_libdir}/checkraid.awk
 36+
 37+%changelog
 38+* Sat Feb 28 2009 - river@loreley.flyingparchment.org.uk
 39+- initial spec
Index: trunk/tools/ts-specs/base-specs/mysql.spec
@@ -5,6 +5,7 @@
66 Version: 5.1.31
77 Source: http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.1/mysql-%{version}.tar.gz
88 Patch1: mysql-01-libdir.diff
 9+Patch2: mysql-02-fasttime.diff
910
1011 SUNW_BaseDir: /opt/TSmysql
1112 BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -12,6 +13,7 @@
1314 %prep
1415 %setup -q -n mysql-%version
1516 %patch1 -p0
 17+%patch2 -p0
1618
1719 %build
1820
@@ -28,6 +30,7 @@
2931 --includedir=%{_includedir} \
3032 --with-extra-charsets=all \
3133 --with-mysqld-user=mysql \
 34+ --with-mysqld-libs=-lmtmalloc \
3235 --with-zlib-dir=/usr \
3336 --with-big-tables \
3437 --with-ssl=/usr/sfw \

Status & tagging log