Commit graph

13 commits

Author SHA1 Message Date
James D. Forrester
df5eb22f83 Replace uses of DB_MASTER with DB_PRIMARY
Just an auto-replace from codesniffer for now.

Change-Id: I5240dc9ac5929d291b0ef1c743ea2bfd3f428266
2021-04-29 09:24:31 -07:00
Gergő Tisza
92cedbaa0d Add Maintenance::waitForReplication()
Common utility method for maintenance scripts that's a little more
clever than LBFactory::waitForReplication(). Previously it was
included in Maintenance::commitTransaction but that logs an error
when there is no uncommitted change, and one might want to commit
more often and wait for replicas to catch up only after some amount
of commits.

Change-Id: I3394536eea01eb982a4a2033fd2062bc67f6bdc1
2021-03-18 01:02:41 +01:00
daniel
61a01ba850 maintenance: Fix errors in parameter handling and output of findBadBlobs
- in the instructions for how to extract IDs of bad revisions using
  grep, the expression was looking for the wrong string.

- output for bad revisions didn't include the timestamp, making it
  harder to determine the duration of the problem that cause the
  bad revisions.

- documentation advertized YYYY-MM-DD_HH:MM:SS as an allowed data
  format, but it wasn't actually supported.

Bug: T272540
Change-Id: Iac0c184c5a7008aec3b0899df30c6fb6644b23d9
2021-01-22 01:34:10 +00:00
jenkins-bot
a01f759fbb Merge "Add FindMissingActors script." 2020-09-23 06:56:34 +00:00
Bill Pirkle
d4cf450c1f Have findBadBlobs.php require Maintenance.php rather than cleanupTable.inc
THe findBadBlobs.php maintenance script unnecessarily required
cleanupTable.inc instead of the typical Maintenance.php. While this
worked (because cleanupTable.inc requires Maintenance.php), it was
slightly confusing and slightly less efficient. Change to just
require Maintenance.php instead.

Bug: T263604
Change-Id: I42dfb5220b701ec90f39e9ad905c1e32c9c28904
2020-09-22 19:37:47 -05:00
daniel
dbe7fdb94c Add FindMissingActors script.
This allows bad actor IDs to be overwritten with some default. This
solves the problem of rows in tables like ipblocks, logging, or
revision not being found due to a failing join against the actor table.

Bug: T261325
Change-Id: Ibc554d0b6f52e7b30cdde5138ac165774831ec36
2020-09-22 21:10:16 +02:00
Umherirrender
ba216e52e7 includes: Use expression assignment operator += or |= where possible
It is easier to read.

Change-Id: Ia3965b80153d64f95b415c6c30f526efa252f554
2020-07-31 22:26:42 +00:00
daniel
decb32d216 findBadBlobs: better separate scan and mark modes.
This makes the following changes to the findBadBlobs utility:
- rename --from-date to --scan-from, to match the intended use.
- require the usage of --revisions with --mark, so revisions
  cannot be marked directly when found by a scan.
- catch any exception when testing for bad blobs, casting
  a wider net.
- change the output format, so the IDs of bad revisions can easily be
  extracted by command line tools for further processing.
- warn when trying to mark blobs that can successfully we read.

The idea is to allow detection of blobs that are "bad" in a
large variety of ways, including due to misconfiguration, while at the
same time making sure that blobs do not get marked as bad due to
temporary outages.

The intended usage of findBadBlobs is to first scan a potentially
problematic set of revisions using --scan-from, review to errors found,
and then determine which of the revisions should be marked as bad.
Once the bad revisions have been identified, a list with their IDs
can be extracted from the output, and supplied back to findBadBlobs
via the --revisions option.

Bug: T251778
Change-Id: I47c11190b665c1dac88db32ee2bf683728cb3dc6
2020-06-30 17:30:29 +00:00
Reedy
c7eb28aac9 Fix various MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment
Change-Id: I50c7c93f1534e966224f98a835ca01f93eb9416d
2020-05-21 01:06:05 +00:00
daniel
3675b5fc85 findBadBlobs: Force rev_timestamp index
Force the database to use the rev_timestamp index.
MySql/MariaDB was coming up with very slow query plans.

Bug: T205936
Change-Id: Iab68253c62a51463ba4afd072cd7bff2d1fafdde
2020-05-04 15:19:27 +00:00
daniel
d351bb7e39 RevisionStore: improve error handling in newRevisionsFromBatch
When for some reason we can't determine the title for a revision
in the batch, this should not trigger a fatal TypeError, but handled
gracefully, with helpful information included in the error message.

Bug: T205936
Change-Id: I0c7d2c1fee03d1c9208669a9b5ad66612494a47c
2020-05-03 21:54:02 +02:00
daniel
5b519139dd Allow specific revision IDs to be passed to markBadBlobs.php
This adds a --revisions paramter to markBadBlobs.php that can be used to
specific individual revisions, instead of scanning by date.

Bug: T205936
Change-Id: Ie1a907f2c15f1d4a85affff2701ff2289bfa77ea
2020-04-17 06:54:50 -07:00
daniel
071ce36abd Add findBadBlobs script.
This script scans for content blobs that can't be loaded due to
database corruption, and can change their entry in the content table
to an address starting with "bad:". Such addresses cause the content
to be read as empty, with no log entry. This is useful to avoid
errors and log spam due to known bad revisions.

The script is designed to scan a limited number of revisions from a
given start date. The assumption is that database corruption is
generally caused by an intermedia bug or system failure which will
affect many revisions over a short period of time.

Bug: T205936
Change-Id: I6f513133e90701bee89d63efa618afc3f91c2d2b
2020-04-17 15:04:59 +02:00