Commit graph

6 commits

Author SHA1 Message Date
Timo Tijhof
4ef0891994 rdbms: Consolidate logger channels into one
Notable changes:

* In SqlBagOStuff::getConnectionFromServerInfo, only two loggers were
  injected. The rest implicitly got a NullLogger due to being absent.
  These are now effectively unsilenced.

* Database::__construct() required almost all parameters, even the
  loggers. I've wanted to move some of DatabaseFactory into the ctor
  here for a while. In order to make this change not a breaking
  change, the new 'logger' parameter is optional with NullLogger as
  default. This allowed some of the test cases, which were simply
  passing NullLogger, to be fixed by passing nothing instead of
  passing the new option name.

  The Database class is behind a dozen layers of indirection for
  real use, so this will still be injected just fine (DBF, LB, LBF,
  MWLBF, etc.).

* In LegacyLogger, the handling for $wgDBerrorLog was previously
  limited to DBConnection and DBQuery. This now includes errors
  from other (generally, newer) parts of Rdbms as well, which were
  previously missing.

  This only affects sites (typically CI and dev setup) where
  $wgDBerrorLog is used, as opposed to the more common
  $wgDebugLogGroups by-channel configuration.

* TransactionProfiler gets its logger injected in a rather odd way,
  via entrypoints (MediaWiki.php, ApiMain.php, and MaintenanceRunner)
  as opposed to service wiring. This is kept as-is for now.

* In LBFactoryTest, in particular testInvalidSelectDBIndependent2,
  there are cases that intentionally produce failures of which
  the result is then observed. In CI we assert that dberror.log is
  empty so instead of adding the missing logger fields to that
  LBFactory instance, the only one set (replLogger) is removed.
  The alternative is to set 'logger' now, which would naturally
  cause CI failures due to unexpected entries coming through to
  non-mocked error log.

Bug: T320873
Change-Id: I7ca996618e41b93f488cb5c4de82000bb36e0dd3
2023-01-03 22:46:38 +00:00
Umherirrender
8b1a3d13eb tests: Use WikiPageFactory to create WikiPage object
Bug: T259948
Change-Id: I9afcf3b845306f81ee5ca156553256e6c38df3a0
2022-06-26 23:21:02 +02:00
Umherirrender
b0398654c5 tests: Do not use class alias in @covers
Also fix case for the XMLTypeCheck test

Change-Id: I809510c8085a36e20fd0eefb5e77d2671b3148f2
2022-05-28 00:37:43 +02:00
Tim Starling
682aad7557 Move LinksUpdate and LinksDeletionUpdate into the new namespace
Change-Id: I5cf7a08324d08aa89c23540222ba8eddc1ae2647
2022-01-04 15:35:57 +11:00
Tim Starling
d3b2b80067 LinksUpdate refactor
* In LinksUpdate, put each table in its own class, so that the
  special code for each table has a more elegant place to go.
* Use generators to abstract and flatten out the underlying ParserOutput
  data structures, without requiring the data to be copied. This allows
  the incremental logic which was previously duplicated for each table,
  i.e. computing insertions and deletions from the old and new state,
  to be factored out. The per-table batch classes act as container
  abstractions for the underlying data.

Bug: T263437
Depends-On: I472f4a023969bfde6298eb56112c16d2ae842199
Change-Id: Id40be19a8caa7b4669911927964cfd6755c25238
2022-01-04 15:35:57 +11:00
Tim Starling
9496e37ac7 Additional tests for LinksUpdate and LinksDeletionUpdate
Each table at least needs an added, deleted and unmodified link in order
to fully exercise the incremental update code.

Disable INSERT IGNORE during testing, since this can hide an omitted
delete query.

Change-Id: Iaa9f32ea5171da4f983379d7ff313bfdf1cb0b2f
2021-12-09 12:32:06 +11:00