r53318 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53317‎ | r53318 | r53319 >
Date:17:44, 15 July 2009
Author:brion
Status:ok
Tags:
Comment:
Commit some maintenance scripts from live site per Tim's recommendation
Modified paths:
  • /branches/wmf-deployment/maintenance/jobs-loop.sh (added) (history)
  • /branches/wmf-deployment/maintenance/lag.php (added) (history)
  • /branches/wmf-deployment/maintenance/storage/make-all-blobs (added) (history)
  • /branches/wmf-deployment/maintenance/storage/recompressTracked.sh (added) (history)
  • /branches/wmf-deployment/maintenance/storage/testRctComplete.php (added) (history)

Diff [purge]

Index: branches/wmf-deployment/maintenance/lag.php
@@ -0,0 +1,33 @@
 2+<?php
 3+
 4+$wgUseNormalUser = true;
 5+require_once('commandLine.inc');
 6+
 7+if ( $options['r'] ) {
 8+ print 'time ';
 9+ foreach( $wgDBservers as $i => $server ) {
 10+ $hostname = gethostbyaddr( $wgDBservers[$i]['host'] );
 11+ $hostname = str_replace( '.pmtpa.wmnet', '', $hostname );
 12+ printf("%-12s ", $hostname );
 13+ }
 14+ print("\n");
 15+
 16+ while( 1 ) {
 17+ $lags = $wgLoadBalancer->getLagTimes();
 18+ unset( $lags[0] );
 19+ print( date( 'H:i:s' ) . ' ' );
 20+ foreach( $lags as $i => $lag ) {
 21+ printf("%-12s " , $lag === false ? 'false' : $lag );
 22+ }
 23+ print("\n");
 24+ sleep(5);
 25+ }
 26+} else {
 27+ $lb = wfGetLB();
 28+ $lags = $lb->getLagTimes();
 29+ foreach( $lags as $i => $lag ) {
 30+ $name = $lb->getServerName( $i );
 31+ printf("%-20s %s\n" , $name, $lag === false ? 'false' : $lag );
 32+ }
 33+}
 34+?>
Property changes on: branches/wmf-deployment/maintenance/lag.php
___________________________________________________________________
Name: svn:eol-style
135 + native
Index: branches/wmf-deployment/maintenance/storage/make-all-blobs
@@ -0,0 +1,18 @@
 2+#!/bin/bash
 3+
 4+if [ -z $1 ];then
 5+ echo "Usage: make-all-blobs <server> [<table name>]"
 6+ exit 1
 7+fi
 8+server=$1
 9+if [ -z $2 ]; then
 10+ table=blobs
 11+else
 12+ table=$2
 13+fi
 14+
 15+for db in `</home/wikipedia/common/all.dblist`;do
 16+ echo "CREATE DATABASE IF NOT EXISTS $db" | mysql -u wikiadmin -p`wikiadmin_pass` -h $server && \
 17+ sed "s/blobs\>/$table/" blobs.sql | mysql -u wikiadmin -p`wikiadmin_pass` -h $server $db
 18+done
 19+
Property changes on: branches/wmf-deployment/maintenance/storage/make-all-blobs
___________________________________________________________________
Name: svn:executable
120 + *
Index: branches/wmf-deployment/maintenance/storage/recompressTracked.sh
@@ -0,0 +1,15 @@
 2+#!/bin/bash
 3+
 4+for db in `</home/wikipedia/common/all.dblist`;do
 5+ echo "
 6+-------------------------------------
 7+$db
 8+-------------------------------------
 9+" | tee -a /home/wikipedia/logs/norotate/rct/stdout.log
 10+ if [ "$db" == enwiki ]; then
 11+ procs=40
 12+ else
 13+ procs=5
 14+ fi
 15+ php recompressTracked.php --wiki=$db --procs=$procs --info-log=/home/wikipedia/logs/norotate/rct/info.log --critical-log=/home/wikipedia/logs/norotate/rct/critical.log rc1 | tee -a /home/wikipedia/logs/norotate/rct/stdout.log
 16+done
Property changes on: branches/wmf-deployment/maintenance/storage/recompressTracked.sh
___________________________________________________________________
Name: svn:eol-style
117 + native
Name: svn:executable
218 + *
Index: branches/wmf-deployment/maintenance/storage/testRctComplete.php
@@ -0,0 +1,22 @@
 2+<?php
 3+require_once( dirname(__FILE__).'/../commandLine.inc' );
 4+
 5+$bad = 0;
 6+$good = 0;
 7+foreach ( $wgLocalDatabases as $wiki ) {
 8+ $lb = wfGetLB( $wiki );
 9+ $db = $lb->getConnection( DB_SLAVE, array(), $wiki );
 10+ if ( $db->tableExists( 'blob_tracking' ) ) {
 11+ $notDone = $db->selectField( 'blob_tracking', '1',
 12+ array( 'bt_moved' => 0 ) );
 13+ if ( $notDone ) {
 14+ $bad++;
 15+ echo "$wiki\n";
 16+ } else {
 17+ $good++;
 18+ }
 19+ }
 20+ $lb->reuseConnection( $db );
 21+}
 22+echo "$bad wiki(s) incomplete\n";
 23+echo "$good wiki(s) complete\n";
Property changes on: branches/wmf-deployment/maintenance/storage/testRctComplete.php
___________________________________________________________________
Name: svn:eol-style
124 + native
Index: branches/wmf-deployment/maintenance/jobs-loop.sh
@@ -0,0 +1,33 @@
 2+#!/bin/bash
 3+
 4+trap 'kill %-; exit' SIGTERM
 5+[ ! -z "$1" ] && {
 6+ echo "starting type-specific job runner: $1"
 7+ type=$1
 8+}
 9+
 10+cd `readlink -f /home/wikipedia/common/php/maintenance`
 11+while [ 1 ];do
 12+ db=
 13+ while [ -z $db ];do
 14+ if [ ! -z "$type" ]; then
 15+ db=`php -n nextJobDB.php --type=$type`
 16+ else
 17+ db=`php -n nextJobDB.php`
 18+ fi
 19+
 20+ if [ -z $db ];then
 21+ # No jobs to do, wait for a while
 22+ echo "No jobs..."
 23+ sleep 5
 24+ fi
 25+ done
 26+ echo $db
 27+ if [ ! -z "$type" ]; then
 28+ nice -n 20 php runJobs.php $db --procs=4 $type &
 29+ else
 30+ nice -n 20 php runJobs.php $db --procs=4 &
 31+ fi
 32+ wait
 33+done
 34+
Property changes on: branches/wmf-deployment/maintenance/jobs-loop.sh
___________________________________________________________________
Name: svn:eol-style
135 + native
Name: svn:executable
236 + *

Follow-up revisions

RevisionCommit summaryAuthorDate
r56375Merge some changes & custom scripts back from old wmf-deployment branch:...brion17:46, 15 September 2009
r57252Reapply -wmf version tweak and some files from deployment branch...brion21:18, 1 October 2009

Status & tagging log