General database-related code cleanup:
authorTim Starling <tstarling@users.mediawiki.org>
Thu, 23 Jun 2011 03:14:11 +0000 (03:14 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Thu, 23 Jun 2011 03:14:11 +0000 (03:14 +0000)
commit0e7320547063bc206a81b5e93f2ceee933cb219d
tree94d1ca83cca435ca4cf521627d8be5741123b1ab
parentf2ff5d901af621944c7aa9c8325a5ec6fcd148cf
General database-related code cleanup:
* Merged the 4 simulated implementations of Database*::replace(). I took diffs, they were nearly identical. I made one based on the IBM DB2 version, since it used insert() which looked like a nice touch.
* Provided the non-simulated implementation of Database*::replace() via a protected member function, and made DatabaseMysql::replace() and DatabaseSqlite::replace() into a wrapper for it.
* Moved the MySQL-specific functionality from masterPosWait(), getSlavePos() and getMasterPos() from DatabaseBase to DatabaseMysql.
* Renamed getStatus() to getMysqlStatus() and moved it to DatabaseMysql. Removed "unimplemented" errors from two other subclasses. Really there's no way another DBMS could or should implement this function.
* Split the LoadMonitor class into a no-op class and a MySQL-specific class, to avoid fatal errors due to the getMysqlStatus() call if other DBMSs tried to use LoadBalancer with multiple servers. Of course there are lots of other reasons it won't work, I'm just fixing the architecture issue here.

And while I have a replicated test setup handy:
* On MySQL 4.1.9 and later, use SHOW SLAVE STATUS to get the lag instead of SHOW PROCESSLIST. This has the advantage of reading zero when there are no events for a while.
12 files changed:
RELEASE-NOTES-1.19
includes/AutoLoader.php
includes/db/Database.php
includes/db/DatabaseIbm_db2.php
includes/db/DatabaseMssql.php
includes/db/DatabaseMysql.php
includes/db/DatabaseOracle.php
includes/db/DatabasePostgres.php
includes/db/DatabaseSqlite.php
includes/db/DatabaseUtility.php
includes/db/LoadBalancer.php
includes/db/LoadMonitor.php