r45891 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45890‎ | r45891 | r45892 >
Date:13:56, 19 January 2009
Author:catrope
Status:ok
Tags:
Comment:
Revert r45821, r45830, r45831 and r45835 all in order to revert r45819, per discussions on CR. Will redo part of r45819 momentarily.
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryDeletedrevs.php (modified) (history)
  • /trunk/phase3/includes/db/Database.php (modified) (history)
  • /trunk/phase3/includes/db/DatabasePostgres.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseSqlite.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialDeletedContributions.php (modified) (history)
  • /trunk/phase3/maintenance/archives/patch-index-renames.sql (deleted) (history)
  • /trunk/phase3/maintenance/archives/patch-pl-tl-il-unique.sql (deleted) (history)
  • /trunk/phase3/maintenance/tables.sql (modified) (history)
  • /trunk/phase3/maintenance/updaters.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/archives/patch-index-renames.sql
@@ -1,11 +0,0 @@
2 -
3 -DROP INDEX user_id ON /*_*/user_newtalk;
4 -DROP INDEX user_ip ON /*_*/user_newtalk;
5 -DROP INDEX usertext_timestamp ON /*_*/archive;
6 -CREATE INDEX un_user_id ON /*_*/user_newtalk (user_id);
7 -CREATE INDEX un_user_ip ON /*_*/user_newtalk (user_ip);
8 -CREATE INDEX ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp);
\ No newline at end of file
Index: trunk/phase3/maintenance/archives/patch-pl-tl-il-unique.sql
@@ -1,11 +0,0 @@
2 -
3 -DROP INDEX pl_namespace ON /*_*/pagelinks;
4 -CREATE UNIQUE INDEX pl_namespace ON /*_*/pagelinks (pl_namespace, pl_title, pl_from);
5 -DROP INDEX tl_namespace ON /*_*/templatelinks;
6 -CREATE UNIQUE INDEX tl_namespace ON /*_*/templatelinks (tl_namespace, tl_title, tl_from);
7 -DROP INDEX il_to ON /*_*/imagelinks;
8 -CREATE UNIQUE INDEX il_to ON /*_*/imagelinks (il_to, il_from);
Index: trunk/phase3/maintenance/updaters.inc
@@ -149,8 +149,6 @@
150150 array( 'add_field', 'site_stats', 'ss_active_users', 'patch-ss_active_users.sql' ),
151151 array( 'do_active_users_init' ),
152152 array( 'add_field', 'ipblocks', 'ipb_allow_usertalk', 'patch-ipb_allow_usertalk.sql' ),
153 - array( 'add_index', 'user_newtalk', 'un_user_id', 'patch-index-renames.sql' ),
154 - array( 'do_unique_pl_tl_il' ),
155153 ),
156154
157155 'sqlite' => array(
@@ -1267,17 +1265,6 @@
12681266 echo "done\n";
12691267 }
12701268
1271 -function do_unique_pl_tl_il() {
1272 - global $wgDatabase;
1273 - $info = $wgDatabase->indexInfo( 'pagelinks', 'pl_namespace' );
1274 - if( !$info->Non_unique ) {
1275 - echo "...pl_namespace, tl_namespace, il_to indices are already UNIQUE.\n";
1276 - } else {
1277 - echo "Making pl_namespace, tl_namespace and il_to indices UNIQUE... ";
1278 - dbsource( archive( 'patch-pl-tl-il-unique.sql' ), $wgDatabase );
1279 - echo "ok\n";
1280 - }
1281 -}
12821269
12831270 /***********************************************************************
12841271 * Start PG crap
Index: trunk/phase3/maintenance/tables.sql
@@ -129,8 +129,8 @@
130130 user_editcount int
131131 ) /*$wgDBTableOptions*/;
132132
133 -CREATE UNIQUE INDEX user_name ON /*_*/user (user_name);
134 -CREATE INDEX user_email_token ON /*_*/user (user_email_token);
 133+CREATE UNIQUE INDEX /*i*/user_name ON /*_*/user (user_name);
 134+CREATE INDEX /*i*/user_email_token ON /*_*/user (user_email_token);
135135
136136
137137 --
@@ -156,8 +156,8 @@
157157 ug_group varbinary(16) NOT NULL default ''
158158 ) /*$wgDBTableOptions*/;
159159
160 -CREATE UNIQUE INDEX ug_user_group ON /*_*/user_groups (ug_user,ug_group);
161 -CREATE INDEX ug_group ON /*_*/user_groups (ug_group);
 160+CREATE UNIQUE INDEX /*i*/ug_user_group ON /*_*/user_groups (ug_user,ug_group);
 161+CREATE INDEX /*i*/ug_group ON /*_*/user_groups (ug_group);
162162
163163
164164 -- Stores notifications of user talk page changes, for the display
@@ -174,8 +174,8 @@
175175 ) /*$wgDBTableOptions*/;
176176
177177 -- Indexes renamed for SQLite in 1.14
178 -CREATE INDEX un_user_id ON /*_*/user_newtalk (user_id);
179 -CREATE INDEX un_user_ip ON /*_*/user_newtalk (user_ip);
 178+CREATE INDEX /*i*/un_user_id ON /*_*/user_newtalk (user_id);
 179+CREATE INDEX /*i*/un_user_ip ON /*_*/user_newtalk (user_ip);
180180
181181
182182 --
@@ -229,9 +229,9 @@
230230 page_len int unsigned NOT NULL
231231 ) /*$wgDBTableOptions*/;
232232
233 -CREATE UNIQUE INDEX name_title ON /*_*/page (page_namespace,page_title);
234 -CREATE INDEX page_random ON /*_*/page (page_random);
235 -CREATE INDEX page_len ON /*_*/page (page_len);
 233+CREATE UNIQUE INDEX /*i*/name_title ON /*_*/page (page_namespace,page_title);
 234+CREATE INDEX /*i*/page_random ON /*_*/page (page_random);
 235+CREATE INDEX /*i*/page_len ON /*_*/page (page_len);
236236
237237
238238 --
@@ -283,11 +283,11 @@
284284 ) /*$wgDBTableOptions*/ MAX_ROWS=10000000 AVG_ROW_LENGTH=1024;
285285 -- In case tables are created as MyISAM, use row hints for MySQL <5.0 to avoid 4GB limit
286286
287 -CREATE UNIQUE INDEX rev_page_id ON /*_*/revision (rev_page, rev_id);
288 -CREATE INDEX rev_timestamp ON /*_*/revision (rev_timestamp);
289 -CREATE INDEX page_timestamp ON /*_*/revision (rev_page,rev_timestamp);
290 -CREATE INDEX user_timestamp ON /*_*/revision (rev_user,rev_timestamp);
291 -CREATE INDEX usertext_timestamp ON /*_*/revision (rev_user_text,rev_timestamp);
 287+CREATE UNIQUE INDEX /*i*/rev_page_id ON /*_*/revision (rev_page, rev_id);
 288+CREATE INDEX /*i*/rev_timestamp ON /*_*/revision (rev_timestamp);
 289+CREATE INDEX /*i*/page_timestamp ON /*_*/revision (rev_page,rev_timestamp);
 290+CREATE INDEX /*i*/user_timestamp ON /*_*/revision (rev_user,rev_timestamp);
 291+CREATE INDEX /*i*/usertext_timestamp ON /*_*/revision (rev_user_text,rev_timestamp);
292292
293293 --
294294 -- Holds text of individual page revisions.
@@ -388,8 +388,8 @@
389389 ar_parent_id int unsigned default NULL
390390 ) /*$wgDBTableOptions*/;
391391
392 -CREATE INDEX name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp);
393 -CREATE INDEX ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp);
 392+CREATE INDEX /*i*/name_title_timestamp ON /*_*/archive (ar_namespace,ar_title,ar_timestamp);
 393+CREATE INDEX /*i*/ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timestamp);
394394
395395
396396 --
@@ -407,8 +407,8 @@
408408 pl_title varchar(255) binary NOT NULL default ''
409409 ) /*$wgDBTableOptions*/;
410410
411 -CREATE UNIQUE INDEX pl_from ON /*_*/pagelinks (pl_from,pl_namespace,pl_title);
412 -CREATE UNIQUE INDEX pl_namespace ON /*_*/pagelinks (pl_namespace,pl_title,pl_from);
 411+CREATE UNIQUE INDEX /*i*/pl_from ON /*_*/pagelinks (pl_from,pl_namespace,pl_title);
 412+CREATE INDEX /*i*/pl_namespace_title ON /*_*/pagelinks (pl_namespace,pl_title,pl_from);
413413
414414
415415 --
@@ -426,8 +426,8 @@
427427 tl_title varchar(255) binary NOT NULL default ''
428428 ) /*$wgDBTableOptions*/;
429429
430 -CREATE UNIQUE INDEX tl_from ON /*_*/templatelinks (tl_from,tl_namespace,tl_title);
431 -CREATE UNIQUE INDEX tl_namespace ON /*_*/templatelinks (tl_namespace,tl_title,tl_from);
 430+CREATE UNIQUE INDEX /*i*/tl_from ON /*_*/templatelinks (tl_from,tl_namespace,tl_title);
 431+CREATE INDEX /*i*/tl_namespace_title ON /*_*/templatelinks (tl_namespace,tl_title,tl_from);
432432
433433
434434 --
@@ -445,8 +445,8 @@
446446 il_to varchar(255) binary NOT NULL default ''
447447 ) /*$wgDBTableOptions*/;
448448
449 -CREATE UNIQUE INDEX il_from ON /*_*/imagelinks (il_from,il_to);
450 -CREATE UNIQUE INDEX il_to ON /*_*/imagelinks (il_to,il_from);
 449+CREATE UNIQUE INDEX /*i*/il_from ON /*_*/imagelinks (il_from,il_to);
 450+CREATE INDEX /*i*/il_to ON /*_*/imagelinks (il_to,il_from);
451451
452452
453453 --
@@ -477,13 +477,13 @@
478478 cl_timestamp timestamp NOT NULL
479479 ) /*$wgDBTableOptions*/;
480480
481 -CREATE UNIQUE INDEX cl_from ON /*_*/categorylinks (cl_from,cl_to);
 481+CREATE UNIQUE INDEX /*i*/cl_from ON /*_*/categorylinks (cl_from,cl_to);
482482
483483 -- We always sort within a given category...
484 -CREATE INDEX cl_sortkey ON /*_*/categorylinks (cl_to,cl_sortkey,cl_from);
 484+CREATE INDEX /*i*/cl_sortkey ON /*_*/categorylinks (cl_to,cl_sortkey,cl_from);
485485
486486 -- Not really used?
487 -CREATE INDEX cl_timestamp ON /*_*/categorylinks (cl_to,cl_timestamp);
 487+CREATE INDEX /*i*/cl_timestamp ON /*_*/categorylinks (cl_to,cl_timestamp);
488488
489489
490490 --
@@ -513,10 +513,10 @@
514514 cat_hidden tinyint unsigned NOT NULL default 0
515515 ) /*$wgDBTableOptions*/;
516516
517 -CREATE UNIQUE INDEX cat_title ON /*_*/category (cat_title);
 517+CREATE UNIQUE INDEX /*i*/cat_title ON /*_*/category (cat_title);
518518
519519 -- For Special:Mostlinkedcategories
520 -CREATE INDEX cat_pages ON /*_*/category (cat_pages);
 520+CREATE INDEX /*i*/cat_pages ON /*_*/category (cat_pages);
521521
522522
523523 --
@@ -543,9 +543,9 @@
544544 el_index blob NOT NULL
545545 ) /*$wgDBTableOptions*/;
546546
547 -CREATE INDEX el_from ON /*_*/externallinks (el_from, el_to(40));
548 -CREATE INDEX el_to ON /*_*/externallinks (el_to(60), el_from);
549 -CREATE INDEX el_index ON /*_*/externallinks (el_index(60));
 547+CREATE INDEX /*i*/el_from ON /*_*/externallinks (el_from, el_to(40));
 548+CREATE INDEX /*i*/el_to ON /*_*/externallinks (el_to(60), el_from);
 549+CREATE INDEX /*i*/el_index ON /*_*/externallinks (el_index(60));
550550
551551
552552 --
@@ -562,8 +562,8 @@
563563 ll_title varchar(255) binary NOT NULL default ''
564564 ) /*$wgDBTableOptions*/;
565565
566 -CREATE UNIQUE INDEX ll_from ON /*_*/langlinks (ll_from, ll_lang);
567 -CREATE INDEX ll_lang_title ON /*_*/langlinks (ll_lang, ll_title);
 566+CREATE UNIQUE INDEX /*i*/ll_from ON /*_*/langlinks (ll_from, ll_lang);
 567+CREATE INDEX /*i*/ll_lang_title ON /*_*/langlinks (ll_lang, ll_title);
568568
569569
570570 --
@@ -604,7 +604,7 @@
605605 ) /*$wgDBTableOptions*/;
606606
607607 -- Pointless index to assuage developer superstitions
608 -CREATE UNIQUE INDEX ss_row_id ON /*_*/site_stats (ss_row_id);
 608+CREATE UNIQUE INDEX /*i*/ss_row_id ON /*_*/site_stats (ss_row_id);
609609
610610
611611 --
@@ -682,12 +682,12 @@
683683
684684 -- Unique index to support "user already blocked" messages
685685 -- Any new options which prevent collisions should be included
686 -CREATE UNIQUE INDEX ipb_address ON /*_*/ipblocks (ipb_address(255), ipb_user, ipb_auto, ipb_anon_only);
 686+CREATE UNIQUE INDEX /*i*/ipb_address ON /*_*/ipblocks (ipb_address(255), ipb_user, ipb_auto, ipb_anon_only);
687687
688 -CREATE INDEX ipb_user ON /*_*/ipblocks (ipb_user);
689 -CREATE INDEX ipb_range ON /*_*/ipblocks (ipb_range_start(8), ipb_range_end(8));
690 -CREATE INDEX ipb_timestamp ON /*_*/ipblocks (ipb_timestamp);
691 -CREATE INDEX ipb_expiry ON /*_*/ipblocks (ipb_expiry);
 688+CREATE INDEX /*i*/ipb_user ON /*_*/ipblocks (ipb_user);
 689+CREATE INDEX /*i*/ipb_range ON /*_*/ipblocks (ipb_range_start(8), ipb_range_end(8));
 690+CREATE INDEX /*i*/ipb_timestamp ON /*_*/ipblocks (ipb_timestamp);
 691+CREATE INDEX /*i*/ipb_expiry ON /*_*/ipblocks (ipb_expiry);
692692
693693
694694 --
@@ -740,13 +740,13 @@
741741 img_sha1 varbinary(32) NOT NULL default ''
742742 ) /*$wgDBTableOptions*/;
743743
744 -CREATE INDEX img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp);
 744+CREATE INDEX /*i*/img_usertext_timestamp ON /*_*/image (img_user_text,img_timestamp);
745745 -- Used by Special:Imagelist for sort-by-size
746 -CREATE INDEX img_size ON /*_*/image (img_size);
 746+CREATE INDEX /*i*/img_size ON /*_*/image (img_size);
747747 -- Used by Special:Newimages and Special:Imagelist
748 -CREATE INDEX img_timestamp ON /*_*/image (img_timestamp);
 748+CREATE INDEX /*i*/img_timestamp ON /*_*/image (img_timestamp);
749749 -- Used in API and duplicate search
750 -CREATE INDEX img_sha1 ON /*_*/image (img_sha1);
 750+CREATE INDEX /*i*/img_sha1 ON /*_*/image (img_sha1);
751751
752752
753753 --
@@ -780,11 +780,11 @@
781781 oi_sha1 varbinary(32) NOT NULL default ''
782782 ) /*$wgDBTableOptions*/;
783783
784 -CREATE INDEX oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp);
785 -CREATE INDEX oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp);
 784+CREATE INDEX /*i*/oi_usertext_timestamp ON /*_*/oldimage (oi_user_text,oi_timestamp);
 785+CREATE INDEX /*i*/oi_name_timestamp ON /*_*/oldimage (oi_name,oi_timestamp);
786786 -- oi_archive_name truncated to 14 to avoid key length overflow
787 -CREATE INDEX oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name(14));
788 -CREATE INDEX oi_sha1 ON /*_*/oldimage (oi_sha1);
 787+CREATE INDEX /*i*/oi_name_archive_name ON /*_*/oldimage (oi_name,oi_archive_name(14));
 788+CREATE INDEX /*i*/oi_sha1 ON /*_*/oldimage (oi_sha1);
789789
790790
791791 --
@@ -836,13 +836,13 @@
837837 ) /*$wgDBTableOptions*/;
838838
839839 -- pick out by image name
840 -CREATE INDEX fa_name ON /*_*/filearchive (fa_name, fa_timestamp);
 840+CREATE INDEX /*i*/fa_name ON /*_*/filearchive (fa_name, fa_timestamp);
841841 -- pick out dupe files
842 -CREATE INDEX fa_storage_group ON /*_*/filearchive (fa_storage_group, fa_storage_key);
 842+CREATE INDEX /*i*/fa_group_key ON /*_*/filearchive (fa_storage_group, fa_storage_key);
843843 -- sort by deletion time
844 -CREATE INDEX fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp);
 844+CREATE INDEX /*i*/fa_deleted_timestamp ON /*_*/filearchive (fa_deleted_timestamp);
845845 -- sort by uploader
846 -CREATE INDEX fa_user_timestamp ON /*_*/filearchive (fa_user_text,fa_timestamp);
 846+CREATE INDEX /*i*/fa_user_timestamp ON /*_*/filearchive (fa_user_text,fa_timestamp);
847847
848848
849849 --
@@ -918,13 +918,13 @@
919919 rc_params blob NULL
920920 ) /*$wgDBTableOptions*/;
921921
922 -CREATE INDEX rc_timestamp ON /*_*/recentchanges (rc_timestamp);
923 -CREATE INDEX rc_namespace_title ON /*_*/recentchanges (rc_namespace, rc_title);
924 -CREATE INDEX rc_cur_id ON /*_*/recentchanges (rc_cur_id);
925 -CREATE INDEX new_name_timestamp ON /*_*/recentchanges (rc_new,rc_namespace,rc_timestamp);
926 -CREATE INDEX rc_ip ON /*_*/recentchanges (rc_ip);
927 -CREATE INDEX rc_ns_usertext ON /*_*/recentchanges (rc_namespace, rc_user_text);
928 -CREATE INDEX rc_user_text ON /*_*/recentchanges (rc_user_text, rc_timestamp);
 922+CREATE INDEX /*i*/rc_timestamp ON /*_*/recentchanges (rc_timestamp);
 923+CREATE INDEX /*i*/rc_namespace_title ON /*_*/recentchanges (rc_namespace, rc_title);
 924+CREATE INDEX /*i*/rc_cur_id ON /*_*/recentchanges (rc_cur_id);
 925+CREATE INDEX /*i*/new_name_timestamp ON /*_*/recentchanges (rc_new,rc_namespace,rc_timestamp);
 926+CREATE INDEX /*i*/rc_ip ON /*_*/recentchanges (rc_ip);
 927+CREATE INDEX /*i*/rc_ns_usertext ON /*_*/recentchanges (rc_namespace, rc_user_text);
 928+CREATE INDEX /*i*/rc_user_text ON /*_*/recentchanges (rc_user_text, rc_timestamp);
929929
930930
931931 CREATE TABLE /*_*/watchlist (
@@ -943,8 +943,8 @@
944944
945945 ) /*$wgDBTableOptions*/;
946946
947 -CREATE UNIQUE INDEX wl_user ON /*_*/watchlist (wl_user, wl_namespace, wl_title);
948 -CREATE INDEX namespace_title ON /*_*/watchlist (wl_namespace, wl_title);
 947+CREATE UNIQUE INDEX /*i*/wl_user_namespace_title ON /*_*/watchlist (wl_user, wl_namespace, wl_title);
 948+CREATE INDEX /*i*/namespace_title ON /*_*/watchlist (wl_namespace, wl_title);
949949
950950
951951 --
@@ -969,7 +969,7 @@
970970 math_mathml text
971971 ) /*$wgDBTableOptions*/;
972972
973 -CREATE UNIQUE INDEX math_inputhash ON /*_*/math (math_inputhash);
 973+CREATE UNIQUE INDEX /*i*/math_inputhash ON /*_*/math (math_inputhash);
974974
975975
976976 --
@@ -991,9 +991,9 @@
992992 si_text mediumtext NOT NULL
993993 ) ENGINE=MyISAM;
994994
995 -CREATE UNIQUE INDEX si_page ON /*_*/searchindex (si_page);
996 -CREATE FULLTEXT INDEX si_title ON /*_*/searchindex (si_title);
997 -CREATE FULLTEXT INDEX si_text ON /*_*/searchindex (si_text);
 995+CREATE UNIQUE INDEX /*i*/si_page ON /*_*/searchindex (si_page);
 996+CREATE FULLTEXT INDEX /*i*/si_title ON /*_*/searchindex (si_title);
 997+CREATE FULLTEXT INDEX /*i*/si_text ON /*_*/searchindex (si_text);
998998
999999
10001000 --
@@ -1016,7 +1016,7 @@
10171017 iw_trans tinyint NOT NULL default 0
10181018 ) /*$wgDBTableOptions*/;
10191019
1020 -CREATE UNIQUE INDEX iw_prefix ON /*_*/interwiki (iw_prefix);
 1020+CREATE UNIQUE INDEX /*i*/iw_prefix ON /*_*/interwiki (iw_prefix);
10211021
10221022
10231023 --
@@ -1034,7 +1034,7 @@
10351035 qc_title varchar(255) binary NOT NULL default ''
10361036 ) /*$wgDBTableOptions*/;
10371037
1038 -CREATE INDEX qc_type ON /*_*/querycache (qc_type,qc_value);
 1038+CREATE INDEX /*i*/qc_type_value ON /*_*/querycache (qc_type,qc_value);
10391039
10401040
10411041 --
@@ -1045,7 +1045,7 @@
10461046 value mediumblob,
10471047 exptime datetime
10481048 ) /*$wgDBTableOptions*/;
1049 -CREATE INDEX exptime ON /*_*/objectcache (exptime);
 1049+CREATE INDEX /*i*/oc_exptime ON /*_*/objectcache (exptime);
10501050
10511051
10521052 --
@@ -1057,7 +1057,7 @@
10581058 tc_time int NOT NULL
10591059 ) /*$wgDBTableOptions*/;
10601060
1061 -CREATE UNIQUE INDEX tc_url_idx ON /*_*/transcache (tc_url);
 1061+CREATE UNIQUE INDEX /*i*/tc_url_idx ON /*_*/transcache (tc_url);
10621062
10631063
10641064 CREATE TABLE /*_*/logging (
@@ -1091,10 +1091,10 @@
10921092 log_deleted tinyint unsigned NOT NULL default 0
10931093 ) /*$wgDBTableOptions*/;
10941094
1095 -CREATE INDEX type_time ON /*_*/logging (log_type, log_timestamp);
1096 -CREATE INDEX user_time ON /*_*/logging (log_user, log_timestamp);
1097 -CREATE INDEX page_time ON /*_*/logging (log_namespace, log_title, log_timestamp);
1098 -CREATE INDEX times ON /*_*/logging (log_timestamp);
 1095+CREATE INDEX /*i*/type_time ON /*_*/logging (log_type, log_timestamp);
 1096+CREATE INDEX /*i*/user_time ON /*_*/logging (log_user, log_timestamp);
 1097+CREATE INDEX /*i*/page_time ON /*_*/logging (log_namespace, log_title, log_timestamp);
 1098+CREATE INDEX /*i*/times ON /*_*/logging (log_timestamp);
10991099
11001100
11011101 CREATE TABLE /*_*/trackbacks (
@@ -1105,7 +1105,7 @@
11061106 tb_ex text,
11071107 tb_name varchar(255)
11081108 ) /*$wgDBTableOptions*/;
1109 -CREATE INDEX tb_page ON /*_*/trackbacks (tb_page);
 1109+CREATE INDEX /*i*/tb_page ON /*_*/trackbacks (tb_page);
11101110
11111111
11121112 -- Jobs performed by parallel apache threads or a command-line daemon
@@ -1126,7 +1126,7 @@
11271127 job_params blob NOT NULL
11281128 ) /*$wgDBTableOptions*/;
11291129
1130 -CREATE INDEX job_cmd ON /*_*/job (job_cmd, job_namespace, job_title);
 1130+CREATE INDEX /*i*/job_cmd_namespace_title ON /*_*/job (job_cmd, job_namespace, job_title);
11311131
11321132
11331133 -- Details of updates to cached special pages
@@ -1139,7 +1139,7 @@
11401140 qci_timestamp binary(14) NOT NULL default '19700101000000'
11411141 ) /*$wgDBTableOptions*/;
11421142
1143 -CREATE UNIQUE INDEX qci_type ON /*_*/querycache_info (qci_type);
 1143+CREATE UNIQUE INDEX /*i*/qci_type ON /*_*/querycache_info (qci_type);
11441144
11451145
11461146 -- For each redirect, this table contains exactly one row defining its target
@@ -1155,7 +1155,7 @@
11561156 rd_title varchar(255) binary NOT NULL default ''
11571157 ) /*$wgDBTableOptions*/;
11581158
1159 -CREATE INDEX rd_ns_title ON /*_*/redirect (rd_namespace,rd_title,rd_from);
 1159+CREATE INDEX /*i*/rd_ns_title ON /*_*/redirect (rd_namespace,rd_title,rd_from);
11601160
11611161
11621162 -- Used for caching expensive grouped queries that need two links (for example double-redirects)
@@ -1175,9 +1175,9 @@
11761176 qcc_titletwo varchar(255) binary NOT NULL default ''
11771177 ) /*$wgDBTableOptions*/;
11781178
1179 -CREATE INDEX qcc_type ON /*_*/querycachetwo (qcc_type,qcc_value);
1180 -CREATE INDEX qcc_title ON /*_*/querycachetwo (qcc_type,qcc_namespace,qcc_title);
1181 -CREATE INDEX qcc_titletwo ON /*_*/querycachetwo (qcc_type,qcc_namespacetwo,qcc_titletwo);
 1179+CREATE INDEX /*i*/qcc_type ON /*_*/querycachetwo (qcc_type,qcc_value);
 1180+CREATE INDEX /*i*/qcc_title ON /*_*/querycachetwo (qcc_type,qcc_namespace,qcc_title);
 1181+CREATE INDEX /*i*/qcc_titletwo ON /*_*/querycachetwo (qcc_type,qcc_namespacetwo,qcc_titletwo);
11821182
11831183
11841184 -- Used for storing page restrictions (i.e. protection levels)
@@ -1198,10 +1198,10 @@
11991199 pr_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT
12001200 ) /*$wgDBTableOptions*/;
12011201
1202 -CREATE UNIQUE INDEX pr_pagetype ON /*_*/page_restrictions (pr_page,pr_type);
1203 -CREATE UNIQUE INDEX pr_typelevel ON /*_*/page_restrictions (pr_type,pr_level);
1204 -CREATE UNIQUE INDEX pr_level ON /*_*/page_restrictions (pr_level);
1205 -CREATE UNIQUE INDEX pr_cascade ON /*_*/page_restrictions (pr_cascade);
 1202+CREATE UNIQUE INDEX /*i*/pr_pagetype ON /*_*/page_restrictions (pr_page,pr_type);
 1203+CREATE UNIQUE INDEX /*i*/pr_typelevel ON /*_*/page_restrictions (pr_type,pr_level);
 1204+CREATE UNIQUE INDEX /*i*/pr_level ON /*_*/page_restrictions (pr_level);
 1205+CREATE UNIQUE INDEX /*i*/pr_cascade ON /*_*/page_restrictions (pr_cascade);
12061206
12071207
12081208 -- Protected titles - nonexistent pages that have been protected
@@ -1215,8 +1215,8 @@
12161216 pt_create_perm varbinary(60) NOT NULL
12171217 ) /*$wgDBTableOptions*/;
12181218
1219 -CREATE UNIQUE INDEX pt_namespace ON /*_*/protected_titles (pt_namespace,pt_title);
1220 -CREATE INDEX pt_timestamp ON /*_*/protected_titles (pt_timestamp);
 1219+CREATE UNIQUE INDEX /*i*/pt_namespace_title ON /*_*/protected_titles (pt_namespace,pt_title);
 1220+CREATE INDEX /*i*/pt_timestamp ON /*_*/protected_titles (pt_timestamp);
12211221
12221222
12231223 -- Name/value pairs indexed by page_id
@@ -1226,7 +1226,7 @@
12271227 pp_value blob NOT NULL
12281228 ) /*$wgDBTableOptions*/;
12291229
1230 -CREATE UNIQUE INDEX pp_page ON /*_*/page_props (pp_page,pp_propname);
 1230+CREATE UNIQUE INDEX /*i*/pp_page_propname ON /*_*/page_props (pp_page,pp_propname);
12311231
12321232
12331233 -- A table to log updates, one text key row per update.
Index: trunk/phase3/includes/db/DatabasePostgres.php
@@ -698,7 +698,7 @@
699699 return NULL;
700700 }
701701 while ( $row = $this->fetchObject( $res ) ) {
702 - if ( $row->indexname == $index ) {
 702+ if ( $row->indexname == $this->indexName( $index ) ) {
703703 return $row;
704704 }
705705 }
@@ -708,7 +708,7 @@
709709 function indexUnique ($table, $index, $fname = 'Database::indexUnique' ) {
710710 $sql = "SELECT indexname FROM pg_indexes WHERE tablename='{$table}'".
711711 " AND indexdef LIKE 'CREATE UNIQUE%(" .
712 - $this->strencode( $index ) .
 712+ $this->strencode( $this->indexName( $index ) ) .
713713 ")'";
714714 $res = $this->query( $sql, $fname );
715715 if ( !$res )
Index: trunk/phase3/includes/db/Database.php
@@ -1191,6 +1191,7 @@
11921192 # SHOW INDEX should work for 3.x and up:
11931193 # http://dev.mysql.com/doc/mysql/en/SHOW_INDEX.html
11941194 $table = $this->tableName( $table );
 1195+ $index = $this->indexName( $index );
11951196 $sql = 'SHOW INDEX FROM '.$table;
11961197 $res = $this->query( $sql, $fname );
11971198 if ( !$res ) {
@@ -1574,6 +1575,18 @@
15751576 }
15761577
15771578 /**
 1579+ * Get the name of an index in a given table
 1580+ */
 1581+ function indexName( $index ) {
 1582+ // Backwards-compatibility hack
 1583+ if ( $index == 'ar_usertext_timestamp' ) {
 1584+ return 'usertext_timestamp';
 1585+ } else {
 1586+ return $index;
 1587+ }
 1588+ }
 1589+
 1590+ /**
15781591 * Wrapper for addslashes()
15791592 * @param $s String: to be slashed.
15801593 * @return String: slashed string.
@@ -1621,7 +1634,7 @@
16221635 * PostgreSQL doesn't have them and returns ""
16231636 */
16241637 function useIndexClause( $index ) {
1625 - return "FORCE INDEX (" . $index . ")";
 1638+ return "FORCE INDEX (" . $this->indexName( $index ) . ")";
16261639 }
16271640
16281641 /**
@@ -2261,6 +2274,9 @@
22622275 $ins = preg_replace_callback( '!/\*(?:\$wgDBprefix|_)\*/([a-zA-Z_0-9]*)!',
22632276 array( $this, 'tableNameCallback' ), $ins );
22642277
 2278+ // Index names
 2279+ $ins = preg_replace_callback( '!/\*i\*/([a-zA-Z_0-9]*)!',
 2280+ array( $this, 'indexNameCallback' ), $ins );
22652281 return $ins;
22662282 }
22672283
@@ -2272,6 +2288,13 @@
22732289 return $this->tableName( $matches[1] );
22742290 }
22752291
 2292+ /**
 2293+ * Index name callback
 2294+ */
 2295+ protected function indexNameCallback( $matches ) {
 2296+ return $this->indexName( $matches[1] );
 2297+ }
 2298+
22762299 /*
22772300 * Build a concatenation list to feed into a SQL query
22782301 */
Index: trunk/phase3/includes/db/DatabaseSqlite.php
@@ -157,6 +157,13 @@
158158 }
159159
160160 /**
 161+ * Index names have DB scope
 162+ */
 163+ function indexName( $index ) {
 164+ return $index;
 165+ }
 166+
 167+ /**
161168 * This must be called after nextSequenceVal
162169 */
163170 function insertId() {
@@ -194,7 +201,7 @@
195202 * - if errors are explicitly ignored, returns NULL on failure
196203 */
197204 function indexInfo($table, $index, $fname = 'Database::indexExists') {
198 - $sql = 'PRAGMA index_info(' . $this->addQuotes( $index ) . ')';
 205+ $sql = 'PRAGMA index_info(' . $this->addQuotes( $this->indexName( $index ) ) . ')';
199206 $res = $this->query( $sql, $fname );
200207 if ( !$res ) {
201208 return null;
@@ -213,7 +220,7 @@
214221 $row = $this->selectRow( 'sqlite_master', '*',
215222 array(
216223 'type' => 'index',
217 - 'name' => $index,
 224+ 'name' => $this->indexName( $index ),
218225 ), $fname );
219226 if ( !$row || !isset( $row->sql ) ) {
220227 return null;
Index: trunk/phase3/includes/api/ApiQueryDeletedrevs.php
@@ -151,7 +151,7 @@
152152 }
153153
154154 $this->addOption('LIMIT', $limit + 1);
155 - $this->addOption('USE INDEX', array('archive' => ($mode == 'user' ? 'ar_usertext_timestamp' : 'name_title_timestamp')));
 155+ $this->addOption('USE INDEX', array('archive' => ($mode == 'user' ? 'usertext_timestamp' : 'name_title_timestamp')));
156156 if($mode == 'all')
157157 {
158158 if($params['unique'])
Index: trunk/phase3/includes/specials/SpecialDeletedContributions.php
@@ -44,7 +44,7 @@
4545 $condition = array();
4646
4747 $condition['ar_user_text'] = $this->target;
48 - $index = 'ar_usertext_timestamp';
 48+ $index = 'usertext_timestamp';
4949
5050 return array( $index, $condition );
5151 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r45819Attempt at cleaning up r45764, r45769 (renamed indices for SQLite compat):...catrope23:02, 16 January 2009
r45821(bug 16645) Making the pl_namespace, tl_namespace and il_to indices UNIQUE, j...catrope23:15, 16 January 2009
r45830Fix up r45819 per CR comments: removing calls to removed function Database::i...catrope09:56, 17 January 2009
r45831Another followup to r45819: update references to the renamed archive.usertext...catrope10:11, 17 January 2009
r45835svn:eol-style nativeialex15:47, 17 January 2009

Status & tagging log