Page MenuHomePhabricator

Suggested Investigations: Add an integer field to cusi_user to store bit flags about the user
Closed, ResolvedPublic

Description

Summary

We want to persist information about a given user relating to the case and the signals in the cusi_user table, so that changes to this information elsewhere do not lead to a change in Suggested Investigations unless intended

Background

  • We need a way to store information relating to each user in a CheckUser-SuggestedInvestigations case
    • This information may be different for each user
    • This information will have fixed allowable values
  • We can represent this data using an integer field which we treat as a BIT field, using each bit as a bit flag which is parsed in PHP
    • This means that we can store information about the user efficiently as long as the information is representable using fixed values
      • For our use cases, we only for now need to store information about a state as opposed to the raw value
      • We don't expect the need to store raw data for other use cases, and a bit field should be acceptable for other use cases
  • See T411118 (private task) for more detail on the need for this column

Proposed schema change

Addition of a siu_info field to cusi_user. This field will not need to be indexed or added to the primary key. On WMF wikis this table is on the extension1 cluster

describe cusi_user;
+-------------+------------------+------+-----+---------+-------+
| Field       | Type             | Null | Key | Default | Extra |
+-------------+------------------+------+-----+---------+-------+
| siu_user_id | int(10) unsigned | NO   | PRI | NULL    |       |
| siu_sic_id  | int(10) unsigned | NO   | PRI | NULL    |       |
| siu_info    | int(10) unsigned | NO   |     | 0       |       |
+-------------+------------------+------+-----+---------+-------+

Acceptance criteria

  • An unsigned integer field is added to cusi_user which is treated as field storing bit flags
  • A Schema-change-in-production ticket is filed to apply this change to all wikis in checkuser-suggested-investigations.dblist - T417386

Details

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Dreamy_Jazz moved this task from Unsorted to Add / Create on the Schema-change board.
Dreamy_Jazz updated the task description. (Show Details)
Dreamy_Jazz updated the task description. (Show Details)

I probably lack the context but:

Addition of a siu_info field to cusi_user. This field will not need to be indexed or added to the primary key. On WMF wikis this table is on the extension1 cluster

But then the table structure lists it as PK, is that expected?

Dreamy_Jazz updated the task description. (Show Details)

I probably lack the context but:

Addition of a siu_info field to cusi_user. This field will not need to be indexed or added to the primary key. On WMF wikis this table is on the extension1 cluster

But then the table structure lists it as PK, is that expected?

Yeah, that was a mistake on my part. I've fixed it in the ticket description. Thanks for spotting it

Change #1239109 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/CheckUser@master] [WIP] Add siu_info to cusi_user

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

Change #1239109 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Add siu_info to cusi_user

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