r65542 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65541‎ | r65542 | r65543 >
Date:13:46, 26 April 2010
Author:demon
Status:ok (Comments)
Tags:
Comment:
Kill last vestiges of mediawiki_version. Nobody actually uses it anymore, it just gets silently updated (and only for Postgres at that)
Modified paths:
  • /trunk/phase3/includes/db/DatabaseIbm_db2.php (modified) (history)
  • /trunk/phase3/includes/db/DatabasePostgres.php (modified) (history)
  • /trunk/phase3/maintenance/ibm_db2/tables.sql (modified) (history)
  • /trunk/phase3/maintenance/postgres/archives/patch-mediawiki_version.sql (deleted) (history)
  • /trunk/phase3/maintenance/postgres/compare_schemas.pl (modified) (history)
  • /trunk/phase3/maintenance/postgres/mediawiki_mysql2postgres.pl (modified) (history)
  • /trunk/phase3/maintenance/postgres/tables.sql (modified) (history)
  • /trunk/phase3/maintenance/updaters.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/postgres/compare_schemas.pl
@@ -574,5 +574,4 @@
575575 OLD: searchindex ## We use tsearch2 directly on the page table instead
576576 RENAME: user mwuser ## Reserved word causing lots of problems
577577 RENAME: text pagecontent ## Reserved word
578 -NEW: mediawiki_version ## Just us, for now
579578 XFILE: ../archives/patch-profiling.sql
Index: trunk/phase3/maintenance/postgres/archives/patch-mediawiki_version.sql
@@ -1,18 +0,0 @@
2 -CREATE TABLE mediawiki_version (
3 - type TEXT NOT NULL,
4 - mw_version TEXT NOT NULL,
5 - notes TEXT NULL,
6 -
7 - pg_version TEXT NULL,
8 - pg_dbname TEXT NULL,
9 - pg_user TEXT NULL,
10 - pg_port TEXT NULL,
11 - mw_schema TEXT NULL,
12 - ts2_schema TEXT NULL,
13 - ctype TEXT NULL,
14 -
15 - sql_version TEXT NULL,
16 - sql_date TEXT NULL,
17 - cdate TIMESTAMPTZ NOT NULL DEFAULT now()
18 -);
19 -
Index: trunk/phase3/maintenance/postgres/tables.sql
@@ -609,27 +609,6 @@
610610 CREATE UNIQUE INDEX user_properties_user_property ON user_properties (up_user,up_property);
611611 CREATE INDEX user_properties_property ON user_properties (up_property);
612612
613 -CREATE TABLE mediawiki_version (
614 - type TEXT NOT NULL,
615 - mw_version TEXT NOT NULL,
616 - notes TEXT NULL,
617 -
618 - pg_version TEXT NULL,
619 - pg_dbname TEXT NULL,
620 - pg_user TEXT NULL,
621 - pg_port TEXT NULL,
622 - mw_schema TEXT NULL,
623 - ts2_schema TEXT NULL,
624 - ctype TEXT NULL,
625 -
626 - sql_version TEXT NULL,
627 - sql_date TEXT NULL,
628 - cdate TIMESTAMPTZ NOT NULL DEFAULT now()
629 -);
630 -
631 -INSERT INTO mediawiki_version (type,mw_version,sql_version,sql_date)
632 - VALUES ('Creation','??','$LastChangedRevision$','$LastChangedDate$');
633 -
634613 CREATE TABLE l10n_cache (
635614 lc_lang TEXT NOT NULL,
636615 lc_key TEXT NOT NULL,
Index: trunk/phase3/maintenance/postgres/mediawiki_mysql2postgres.pl
@@ -421,12 +421,6 @@
422422 SELECT setval('user_user_id_seq', 1+coalesce(max(user_id),0),false) FROM mwuser;
423423 };
424424
425 -## Finally, make a record in the mediawiki_version table about this import
426 -print qq{
427 -INSERT INTO mediawiki_version (type,mw_version,notes) VALUES ('MySQL import','??',
428 -'Imported from file created on $now. Old version: $current_version');
429 -};
430 -
431425 print "COMMIT;\n\\o\n\n-- End of dump\n\n";
432426 select $oldselect;
433427 close $mdump or die qq{Could not close "$MYSQLDUMPFILE": $!\n};
@@ -438,7 +432,6 @@
439433 ## or leave blank if it should be skipped
440434 pagecontent text
441435 mwuser user
442 -mediawiki_version
443436 archive2
444437 profiling
445438 objectcache
Index: trunk/phase3/maintenance/updaters.inc
@@ -1580,7 +1580,6 @@
15811581
15821582 $newtables = array(
15831583 array("category", "patch-category.sql"),
1584 - array("mediawiki_version", "patch-mediawiki_version.sql"),
15851584 array("mwuser", "patch-mwuser.sql"),
15861585 array("pagecontent", "patch-pagecontent.sql"),
15871586 array("querycachetwo", "patch-querycachetwo.sql"),
@@ -2032,16 +2031,5 @@
20332032 ## in case they have the old 'default' versions
20342033 if ( $numver >= 8.3 )
20352034 $wgDatabase->sourceFile(archive('patch-tsearch2funcs.sql'));
2036 -
2037 - ## Put a new row in the mediawiki_version table
2038 - $wgDatabase->insert( 'mediawiki_version',
2039 - array(
2040 - 'type' => 'Update',
2041 - 'ctype' => 'U',
2042 - 'mw_version' => $wgVersion,
2043 - 'pg_version' => $version,
2044 - 'sql_version' => '$LastChangedRevision$',
2045 - 'sql_date' => '$LastChangedDate$',
2046 - ) );
20472035 return;
20482036 }
Index: trunk/phase3/maintenance/ibm_db2/tables.sql
@@ -721,27 +721,6 @@
722722 CREATE UNIQUE INDEX ls_field_val ON log_search (ls_field,ls_value,ls_log_id);
723723 CREATE INDEX ls_log_id ON log_search (ls_log_id);
724724
725 -CREATE TABLE mediawiki_version (
726 - type VARCHAR(1024) NOT NULL,
727 - mw_version VARCHAR(1024) NOT NULL,
728 - notes VARCHAR(1024) ,
729 -
730 - pg_version VARCHAR(1024) ,
731 - pg_dbname VARCHAR(1024) ,
732 - pg_user VARCHAR(1024) ,
733 - pg_port VARCHAR(1024) ,
734 - mw_schema VARCHAR(1024) ,
735 - ts2_schema VARCHAR(1024) ,
736 - ctype VARCHAR(1024) ,
737 -
738 - sql_version VARCHAR(1024) ,
739 - sql_date VARCHAR(1024) ,
740 - cdate TIMESTAMP(3) NOT NULL DEFAULT CURRENT TIMESTAMP
741 -);
742 -
743 -INSERT INTO mediawiki_version (type,mw_version,sql_version,sql_date)
744 - VALUES ('Creation','??','$LastChangedRevision: 34049 $','$LastChangedDate: 2008-04-30 10:20:36 -0400 (Wed, 30 Apr 2008) $');
745 -
746725 -- Table for storing localisation data
747726 CREATE TABLE l10n_cache (
748727 -- Language code
Index: trunk/phase3/includes/db/DatabasePostgres.php
@@ -1346,12 +1346,6 @@
13471347 $dbn = $this->addQuotes($this->mDBname);
13481348 $ctype = $this->addQuotes( pg_fetch_result($this->doQuery("SHOW lc_ctype"),0,0) );
13491349
1350 - $SQL = "UPDATE mediawiki_version SET mw_version=$mwv, pg_version=$pgv, pg_user=$pgu, ".
1351 - "mw_schema = $mws, ts2_schema = $tss, pg_port=$pgp, pg_dbname=$dbn, ".
1352 - "ctype = $ctype ".
1353 - "WHERE type = 'Creation'";
1354 - $this->query($SQL);
1355 -
13561350 ## Avoid the non-standard "REPLACE INTO" syntax
13571351 $f = fopen( "../maintenance/interwiki.sql", 'r' );
13581352 if ($f == false ) {
Index: trunk/phase3/includes/db/DatabaseIbm_db2.php
@@ -747,8 +747,6 @@
748748
749749 $res = $this->sourceFile( "../maintenance/ibm_db2/tables.sql" );
750750 $res = null;
751 -
752 - // TODO: update mediawiki_version table
753751
754752 // TODO: populate interwiki links
755753

Follow-up revisions

RevisionCommit summaryAuthorDate
r73059Followup r65542, rm some unused varsdemon07:41, 15 September 2010

Comments

#Comment by Turnstep (talk | contribs)   15:13, 31 October 2010

Er...why was this ripped out? This is a useful table, and is used for debugging to see the exact state and audit trail for a schema. With Postgres being not as supported as MySQL, this can be a very helpful ability.

#Comment by 😂 (talk | contribs)   15:18, 31 October 2010

I'm not opposed to tracking this kind of information, I just don't think a single-purpose table only used by 1 (of 6) of the DBMSs we support was the way to do it.

The updatelog would be good for this :)

#Comment by Turnstep (talk | contribs)   17:02, 31 October 2010

Well, 1) the other DBMSs are free to implement something themselves :) 2) it's not harming anything, so why remove it? 3) the updatelog table (with it's single column) is a poor replacement for this table, although I suppose we could just cram a whole lot of unstructured information into that one column.

Also, I don't think updatelog is used at creation time, which is nice because then you can tell the MW version just from a schema dump (unless we store the version somewhere else in the database I do not know about).

#Comment by 😂 (talk | contribs)   17:10, 31 October 2010
  1. I don't the DBMSs should be introducing their own tables, unless necessary for normal operation
  2. Consistency is nice. If we support this sort of tracking, it should be generic and shared by all DBMSs, not buried deep in implementation-specific code.
  3. It has two columns now ;-) But I'm open to other suggestions here

updatelog can/could be used at install time, it's just not right now.

#Comment by Turnstep (talk | contribs)   17:16, 31 October 2010

Fair enough, it was a stopgap as there was no other table when it was written. Should we expand updatelog, or start a new table? The goal of mediawiki_version was a way to see the exact state of things when the schema was first created, and an audit of all relevant changes on each upgrade.

Status & tagging log