r55387 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55386‎ | r55387 | r55388 >
Date:17:07, 20 August 2009
Author:rainman
Status:deferred
Tags:
Comment:
* bug 20313 - Lucene Search "build" doesn't work when maintenance is symlinked
* retry OAI reads a number of times so we don't fail the update round if there is a bad apache in the cluster
Modified paths:
  • /branches/lucene-search-2.1/build (modified) (history)
  • /branches/lucene-search-2.1/src/org/wikimedia/lsearch/oai/OAIHarvester.java (modified) (history)

Diff [purge]

Index: branches/lucene-search-2.1/src/org/wikimedia/lsearch/oai/OAIHarvester.java
@@ -28,6 +28,8 @@
2929 protected IndexId iid;
3030 protected String resumptionToken, responseDate;
3131 protected String host;
 32+ /** number of retries before giving up, useful when there are broken servers in the cluster */
 33+ protected int retries = 5;
3234
3335 public OAIHarvester(IndexId iid, String url, Authenticator auth) throws MalformedURLException{
3436 this.urlbase = url;
@@ -59,13 +61,24 @@
6062
6163 protected void read(URL url) throws IOException {
6264 log.info("Reading records from "+url);
63 - collector = new IndexUpdatesCollector(iid);
64 - InputStream in = new BufferedInputStream(url.openStream());
65 - parser = new OAIParser(in,collector);
66 - parser.parse();
67 - resumptionToken = parser.getResumptionToken();
68 - responseDate = parser.getResponseDate();
69 - in.close();
 65+ // try reading from url a number of times before giving up
 66+ for(int tryNum = 1; tryNum <= this.retries; tryNum++){
 67+ try{
 68+ collector = new IndexUpdatesCollector(iid);
 69+ InputStream in = new BufferedInputStream(url.openStream());
 70+ parser = new OAIParser(in,collector);
 71+ parser.parse();
 72+ resumptionToken = parser.getResumptionToken();
 73+ responseDate = parser.getResponseDate();
 74+ in.close();
 75+ break;
 76+ } catch(IOException e){
 77+ if(tryNum == this.retries)
 78+ throw e;
 79+ else
 80+ log.warn("Error reading from url (will retry): "+url);
 81+ }
 82+ }
7083 }
7184
7285 /** Invoke ListRecords using the last resumption token, get atLeast num of records */
Index: branches/lucene-search-2.1/build
@@ -9,10 +9,15 @@
1010 [ -e $dumps ] || mkdir $dumps
1111 dumpfile="$dumps/dump-$dbname.xml"
1212 timestamp=`date -u +%Y-%m-%d`
13 - slave=`php $mediawiki/maintenance/getSlaveServer.php $dbname`
 13+ slave=`php $mediawiki/maintenance/getSlaveServer.php \
 14+ $dbname \
 15+ --conf $mediawiki/LocalSettings.php \
 16+ --aconf $mediawiki/AdminSettings.php`
1417 echo "Dumping $dbname..."
1518 cd $mediawiki && php maintenance/dumpBackup.php \
1619 $dbname \
 20+ --conf $mediawiki/LocalSettings.php \
 21+ --aconf $mediawiki/AdminSettings.php \
1722 --current \
1823 --server=$slave > $dumpfile
1924 [ -e $indexes/status ] || mkdir -p $indexes/status

Status & tagging log