Page MenuHomePhabricator

uploadstash has columns that are never read
Open, Needs TriagePublic

Description

The uploadstash table has multiple fields that appears to be never used, only written to in UploadStash::stashFile (https://gerrit.wikimedia.org/g/mediawiki/core/+/d02602c59cc31bb36f668acae64f6ba3f0201deb/includes/upload/UploadStash.php#297)

us_orig_path - codesearch: https://codesearch.wmcloud.org/search/?q=us_orig_path&i=nope&files=&repos=
us_sha1 - codesearch: https://codesearch.wmcloud.org/search/?q=us_sha1&i=nope&files=&repos=

Can the columns be removed?

Event Timeline

Restricted Application added projects: Commons, User-DannyS712. · View Herald TranscriptSep 19 2020, 12:03 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
DannyS712 moved this task from Unsorted to Delete / Drop / Remove on the Schema-change board.
DannyS712 moved this task from Unsorted to Reports on the User-DannyS712 board.
DannyS712 renamed this task from uploadstash.us_orig_path is not read to uploadstash has column that are never read.Sep 19 2020, 12:06 AM
DannyS712 updated the task description. (Show Details)
Marostegui edited projects, added UploadWizard; removed DBA.Sep 21 2020, 4:47 AM
Marostegui added subscribers: LSobanski, Reedy, Krinkle and 2 others.

Removing the DBA tag for now as there are no action point for us.
Once if it is found if the columns can be dropped, please feel a Blocked-on-schema-change ticket (https://wikitech.wikimedia.org/wiki/Schema_changes#Workflow_of_a_schema_change)
Not sure which team own uploadstash table definition.

matmarex removed a subscriber: matmarex.Sep 21 2020, 4:22 PM
Dinoguy1000 renamed this task from uploadstash has column that are never read to uploadstash has columns that are never read.Sun, Oct 18, 8:43 AM
Tgr added a subscriber: Tgr.Mon, Oct 19, 5:24 AM

They are both loaded into UploadStash::$fileMetadata. Before touching the database, that should be removed first (probably with a deprecation process as they are part of a public method's return value) and if that doesn't break anything they can be dropped.

They certainly don't seem useful - us_orig_path is just the path to the tempfile that got copied into the stash, and the sha1 is already part of us_props and that's where the upload code reads it from, and having a sha1 DB field for the stash doesn't seem terribly useful, as the stash is per-user so there is little point in checking for duplicates.