From 27840b135c6be6fb1fc39b7671b76d5cf2672e7a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Thu, 26 Jun 2008 12:31:50 +0000 Subject: [PATCH] merge 313_5 --- org.glite.lb.utils/Makefile | 1 + org.glite.lb.utils/src/glite-lb-bkpurge-offline.sh | 172 +++++++++++++++++++++ org.glite.lb.ws-interface/src/LBTypes.xml.T | 2 +- 3 files changed, 174 insertions(+), 1 deletion(-) create mode 100644 org.glite.lb.utils/src/glite-lb-bkpurge-offline.sh diff --git a/org.glite.lb.utils/Makefile b/org.glite.lb.utils/Makefile index e4e98d5..fcc4a8b 100644 --- a/org.glite.lb.utils/Makefile +++ b/org.glite.lb.utils/Makefile @@ -91,6 +91,7 @@ install: ${INSTALL} -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version} ${INSTALL} -m 644 ${top_srcdir}/doc/README* ${PREFIX}/share/doc/${package}-${version} ${INSTALL} -m 644 ${MAN_GZ} ${PREFIX}/share/man/man1 + ${INSTALL} -m 755 ${top_srcdir}/src/glite-lb-bkpurge-offline.sh ${PREFIX}/bin/glite-lb-bkpurge-offline for p in ${UTILS} ; do \ ${INSTALL} -m 755 "$$p" "${PREFIX}/bin/glite-lb-$$p"; \ diff --git a/org.glite.lb.utils/src/glite-lb-bkpurge-offline.sh b/org.glite.lb.utils/src/glite-lb-bkpurge-offline.sh new file mode 100644 index 0000000..6b5bf84 --- /dev/null +++ b/org.glite.lb.utils/src/glite-lb-bkpurge-offline.sh @@ -0,0 +1,172 @@ +#!/bin/bash + +cat <&2 $0 probably already running! +fi + +if killall -0 glite-lb-bkserverd 2>/dev/null || killall -0 glite-lb-proxy 2>/dev/null +then +echo >&2 glite-lb-bkserverd or glite-lb-proxy running! +fi + +echo +echo -n "Continue (y/n)?"; read r +if [ "$r" = "y" ] +then echo Working... +else echo Aborting.; exit 1; +fi + + +getsecs() { + echo $(($(echo "$1" | sed -e 's/s$//' \ + -e 's/m$/*60/' \ + -e 's/h$/*3600/' \ + -e 's/d$/*86400/') )) +} + +now=$(date "+%s") + +tclause="" +add_tclause() { + case "$1" in + 6|7|8|9) spart="states.status=$1";; + o) spart="(states.status<6 OR states.status>9)";; + esac + if [ -z "$tclause" ]; then concat=""; else concat=" OR ";fi + tclause="$tclause$concat($spart AND states.jobid = es.jobid and states.seq = es.event AND es.arrived $tempfile1 + +ds="DELETE$quick FROM jobs,states,e,short_fields,long_fields,status_tags" +ds="$ds USING states" +ds="$ds LEFT JOIN events AS e ON (e.jobid = states.jobid)" +ds="$ds LEFT JOIN jobs ON (jobs.jobid = states.jobid)" +ds="$ds LEFT JOIN short_fields ON (short_fields.jobid = e.jobid AND short_fields.event=e.event)" +ds="$ds LEFT JOIN long_fields ON (long_fields.jobid = e.jobid AND long_fields.event=e.event)" +ds="$ds LEFT JOIN status_tags ON (status_tags.jobid = states.jobid)" + +#wc -l $tempfile1 /dev/null;echo -n "???";read n +( + cnt=0 + echo "SET autocommit=0;" + echo "BEGIN;" + while read jobid + do + echo "UPDATE acls,jobs SET acls.refcnt=acls.refcnt-1 " \ + "WHERE jobs.jobid='$jobid' AND jobs.aclid=acls.aclid;" + echo "$ds WHERE states.jobid='$jobid';" + if [ $(($cnt % 10)) = 9 ] + then + echo "COMMIT;" + echo "BEGIN;" + fi + cnt=$((cnt+1)) + done + echo "DELETE FROM acls WHERE refcnt=0;" + echo "COMMIT;" +) < $tempfile1 | $mysqlcmd +rm $tempfile1 +fi + +if [ "$thorough" = 1 ] +then + ( + for table in acls jobs status_tags events \ + short_fields states long_fields + do + echo "OPTIMIZE TABLE $table;" + done + ) | $mysqlcmd +fi + +# TODO: acls/singleshot, grey_jobs, notif_jobs, notif_registrations, users diff --git a/org.glite.lb.ws-interface/src/LBTypes.xml.T b/org.glite.lb.ws-interface/src/LBTypes.xml.T index 8a594f4..8f161fc 100644 --- a/org.glite.lb.ws-interface/src/LBTypes.xml.T +++ b/org.glite.lb.ws-interface/src/LBTypes.xml.T @@ -233,7 +233,7 @@ Generic SOAP fault, used to deliver any LB errors. - Source component (module) of the error. + Source component (module) of the error. Numeric error code. Error text corresponding to the code. Additional description of the error (e.g. filename) -- 1.8.2.3