r68035 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68034‎ | r68035 | r68036 >
Date:21:40, 14 June 2010
Author:ariel
Status:resolved (Comments)
Tags:
Comment:
XML backups: nospawn option: main process will fetch text directly instead of spawning separate one
Modified paths:
  • /trunk/backup/worker.py (modified) (history)

Diff [purge]

Index: trunk/backup/worker.py
@@ -57,7 +57,7 @@
5858
5959 class Runner(object):
6060
61 - def __init__(self, wiki, date=None, checkpoint=None, prefetch=True):
 61+ def __init__(self, wiki, date=None, checkpoint=None, prefetch=True, spawn=True):
6262 self.wiki = wiki
6363 self.config = wiki.config
6464 self.dbName = wiki.dbName
@@ -248,10 +248,10 @@
249249 XmlStub("First-pass for page XML data dumps"),
250250 XmlDump("articles",
251251 "<big><b>Articles, templates, image descriptions, and primary meta-pages.</b></big>",
252 - "This contains current versions of article content, and is the archive most mirror sites will probably want.", prefetch),
 252+ "This contains current versions of article content, and is the archive most mirror sites will probably want.", prefetch, spawn),
253253 XmlDump("meta-current",
254254 "All pages, current versions only.",
255 - "Discussion and user pages are included in this complete archive. Most mirrors won't want this extra material.", prefetch),
 255+ "Discussion and user pages are included in this complete archive. Most mirrors won't want this extra material.", prefetch, spawn),
256256 XmlLogging("Pull out all logging data")]
257257 if self.wiki.hasFlaggedRevs():
258258 self.items.append(
@@ -263,7 +263,7 @@
264264 BigXmlDump("meta-history",
265265 "All pages with complete page edit history (.bz2)",
266266 "These dumps can be *very* large, uncompressing up to 20 times the archive download size. " +
267 - "Suitable for archival and statistical use, most mirror sites won't want or need this.", prefetch))
 267+ "Suitable for archival and statistical use, most mirror sites won't want or need this.", prefetch, spawn))
268268 self.items.append(
269269 XmlRecompressDump("meta-history",
270270 "All pages with complete edit history (.7z)",
@@ -724,11 +724,12 @@
725725
726726 class XmlDump(Dump):
727727 """Primary XML dumps, one section at a time."""
728 - def __init__(self, subset, desc, detail, prefetch):
 728+ def __init__(self, subset, desc, detail, prefetch, spawn):
729729 Dump.__init__(self, desc)
730730 self._subset = subset
731731 self._detail = detail
732732 self._prefetch = prefetch
 733+ self._spawn = spawn
733734
734735 def detail(self):
735736 """Optionally return additional text to appear under the heading."""
@@ -779,7 +780,12 @@
780781 else:
781782 runner.status("... building %s XML dump, no text prefetch..." % self._subset)
782783 prefetch = None
783 -
 784+
 785+ if self._spawn:
 786+ spawn = "--spawn=%s" % (runner.config.php)
 787+ else:
 788+ spawn = None
 789+
784790 dumpCommand = """
785791 %s -q %s/maintenance/dumpTextPass.php \
786792 --wiki=%s \
@@ -788,7 +794,7 @@
789795 %s \
790796 --report=1000 \
791797 --server=%s \
792 - --spawn=%s""" % shellEscape((
 798+ %s""" % shellEscape((
793799 runner.config.php,
794800 runner.config.wikiDir,
795801 runner.dbName,
@@ -796,7 +802,7 @@
797803 prefetch,
798804 runner.forceNormalOption(),
799805 runner.dbServer,
800 - runner.config.php))
 806+ spawn))
801807 command = dumpCommand
802808 return command
803809
@@ -975,9 +981,10 @@
976982 checkpoint = None
977983 forceLock = False
978984 prefetch = True
 985+ spawn = True
979986
980987 (options, remainder) = getopt.gnu_getopt(sys.argv[1:], "",
981 - ['date=', 'checkpoint=', 'force', 'noprefetch'])
 988+ ['date=', 'checkpoint=', 'force', 'noprefetch', 'nospawn'])
982989 for (opt, val) in options:
983990 if opt == "--date":
984991 date = val
@@ -987,6 +994,8 @@
988995 forceLock = True
989996 elif opt == "--noprefetch":
990997 prefetch = False
 998+ elif opt == "--nospawn":
 999+ spawn = False
9911000
9921001 if len(remainder) > 0:
9931002 wiki = WikiDump.Wiki(config, remainder[0])
@@ -998,7 +1007,7 @@
9991008 wiki = findAndLockNextWiki(config)
10001009
10011010 if wiki:
1002 - runner = Runner(wiki, date, checkpoint, prefetch)
 1011+ runner = Runner(wiki, date, checkpoint, prefetch, spawn)
10031012 print "Running %s..." % wiki.dbName
10041013 runner.run()
10051014 wiki.unlock()

Comments

#Comment by MarkAHershberger (talk | contribs)   18:30, 16 July 2010

Similar comments here for "spawn" as for "prefetch" on r67318

#Comment by ArielGlenn (talk | contribs)   19:03, 19 July 2010

see rev 69560.

Status & tagging log