Page MenuHomePhabricator

Remove obsolete recentchanges.rc_new database field
Open, Stalled, LowPublic

Description

The databasefield recentchanges.rc_new is marked as obsolete in RecentChanges.php

Please drop this field to clean up the table.

The problem is, that this field is used at many places in core. You can remove it with a check of the field "rc_source" against the const RecentChange::SRC_NEW.

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:09 AM
bzimport set Reference to bz34320.
bzimport added a subscriber: Unknown Object (MLST).

changed some rc_new with gerrit 17622, but the field is part of an index, that makes it not easy to remove.

Can we please keep such fields for a while, it makes very difficult to test older MediaWiki versions with the same database as the one for master.

(In reply to comment #2)

Can we please keep such fields for a while, it makes very difficult to test
older MediaWiki versions with the same database as the one for master.

Yes, that sounds good. Keeping the field at least one release after the last usage was removed. Than it is possible to rollback a upgrade without errors.

Maybe adding @deprecated in tables.sql as a comment near the field can make that clearer, because some fields left over in the past.

This comment was removed by Kizule.
Krinkle renamed this task from remove obsolete database field rc_new to Remove obsolete recentchanges.rc_new database field.Jul 18 2019, 9:51 PM
Krinkle edited projects, added MediaWiki-Recent-changes; removed MediaWiki-libs-Rdbms.
Krinkle removed a subscriber: wikibugs-l-list.
JTannerWMF subscribed.

It appears this task doesn't have much movement on it so we are de-prioritizing it at this time.

Change 567531 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/BlockAndNuke@master] Replace use of rc_new field with rc_source

https://gerrit.wikimedia.org/r/567531

Change 567532 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/BlueSpiceSmartList@master] Replace use of rc_new field with rc_source

https://gerrit.wikimedia.org/r/567532

Change 567536 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/CentralNotice@master] Replace use of rc_new field with rc_source

https://gerrit.wikimedia.org/r/567536

Change 567537 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/LiquidThreads@master] Replace use of rc_new field with rc_source

https://gerrit.wikimedia.org/r/567537

Change 567539 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/MobileFrontend@master] Replace use of rc_new field with rc_source

https://gerrit.wikimedia.org/r/567539

Change 567540 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/PageTriage@master] Replace use of rc_new field with rc_source

https://gerrit.wikimedia.org/r/567540

Change 567541 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/SiteScout@master] Replace use of rc_new field with rc_source

https://gerrit.wikimedia.org/r/567541

Change 567542 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/SocialProfile@master] Replace use of rc_new field with rc_source

https://gerrit.wikimedia.org/r/567542

Change 567532 merged by jenkins-bot:
[mediawiki/extensions/BlueSpiceSmartList@master] Replace use of rc_new field with rc_source

https://gerrit.wikimedia.org/r/567532

Change 567542 merged by Jack Phoenix:
[mediawiki/extensions/SocialProfile@master] Replace use of rc_new field with rc_source

https://gerrit.wikimedia.org/r/567542

Change 567541 merged by Jack Phoenix:
[mediawiki/extensions/SiteScout@master] Replace use of rc_new field with rc_source

https://gerrit.wikimedia.org/r/567541

Change 568080 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[translatewiki@master] Replace use of rc_new field with rc_source

https://gerrit.wikimedia.org/r/568080

Change 568080 merged by jenkins-bot:
[translatewiki@master] Replace use of rc_new field with rc_source

https://gerrit.wikimedia.org/r/568080

Change 567539 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Replace use of rc_new field with rc_source

https://gerrit.wikimedia.org/r/567539

Change 569282 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] Replace use of rc_new field with rc_source (part 1)

https://gerrit.wikimedia.org/r/569282

Change 567536 merged by jenkins-bot:
[mediawiki/extensions/CentralNotice@master] Replace use of rc_new field with rc_source

https://gerrit.wikimedia.org/r/567536

Change 567531 merged by jenkins-bot:
[mediawiki/extensions/BlockAndNuke@master] Replace use of rc_new field with rc_source

https://gerrit.wikimedia.org/r/567531

Change 567537 merged by jenkins-bot:
[mediawiki/extensions/LiquidThreads@master] Replace use of rc_new field with rc_source

https://gerrit.wikimedia.org/r/567537

Change 577735 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/Nuke@master] Replace use of rc_new with rc_source, clean up query

https://gerrit.wikimedia.org/r/577735

DannyS712 changed the task status from Open to Stalled.Apr 24 2020, 1:57 AM

Stalled pending addition of new index in T244080: Add index to recentchanges.rc_source

It may be a good idea to do this and T74157 together.

DannyS712 subscribed.

Change 567540 abandoned by Kosta Harlan:

[mediawiki/extensions/PageTriage@master] Replace use of `rc_new` field with `rc_source`

Reason:

Cleaning up the code review queue; if you'd like to keep working on this, please restore it!

https://gerrit.wikimedia.org/r/567540

There are several places in Wikimedia deployed code where rc_new is still used in queries:

  • core:
    • includes/specials/SpecialRecentChanges.php - all queries use this "hack"
	// rc_new is not an ENUM, but adding a redundant rc_new IN (0,1) gives mysql enough
	// knowledge to use an index merge if it wants (it may use some other index though).
	$conds += [ 'rc_new' => [ 0, 1 ] ];
    • includes/specials/pagers/NewPagesPager.php - probably the most prominent usage; all queries include rc_new = 1
    • maintenance/categoryChangesAsRdf.php - plenty of usages, not sure where that interface is used
    • (There was one more usage in core's includes/page/Article.php, but we found a better query to use there (change 545256).)
  • MediaWiki-extensions-Nuke
    • includes/SpecialNuke.php
      • the query for created pages always includes rc_new = 1 OR (rc_log_type = 'upload' AND rc_log_action = 'upload')
  • PageTriage
    • includes/PageTriage.php
      • query like SELECT * FROM recentchanges WHERE rc_cur_id = # AND rc_new = 1

They are hard to deal with because queries with rc_new might already use the existing rc_new_name_timestamp index, but there is no index on rc_source (T244080). There is an index on rc_type, though, but it's a bit different:

INDEX rc_new_name_timestamp (
  rc_new, rc_namespace, rc_timestamp
),
INDEX rc_name_type_patrolled_timestamp (
  rc_namespace, rc_type, rc_patrolled, rc_timestamp
)

If we still want to do this, maybe we should change the direction a bit and look into finding ways to replace them with rc_type = RC_NEW first. We may need to fiddle with the indices, though.

Change #1027138 had a related patch set uploaded (by Scardenasmolinar; author: Scardenasmolinar):

[mediawiki/extensions/Nuke@master] Replace rc_new for rc_type in DB query

https://gerrit.wikimedia.org/r/1027138

Change #1027147 had a related patch set uploaded (by Samwalton9; author: Samwalton9):

[mediawiki/core@master] Update documentation for rc_new

https://gerrit.wikimedia.org/r/1027147

Change #577735 abandoned by Scardenasmolinar:

[mediawiki/extensions/Nuke@master] Replace use of rc_new with rc_source, clean up query

Reason:

Abandoning in favor of 1027138

https://gerrit.wikimedia.org/r/577735

Change #1027147 had a related patch set uploaded (by Samwalton9; author: Samwalton9):

[mediawiki/core@master] Update documentation for rc_new

https://gerrit.wikimedia.org/r/1027147

Woo! First core patch!
Macro fox_dance:

Change #1027147 merged by jenkins-bot:

[mediawiki/core@master] Update documentation for rc_new

https://gerrit.wikimedia.org/r/1027147

Change #1027138 merged by jenkins-bot:

[mediawiki/extensions/Nuke@master] Replace rc_new for rc_source in DB query

https://gerrit.wikimedia.org/r/1027138