Page MenuHomePhabricator

Create growthexperiments_mentor_mentee database table on extension1 for wikis in growthexperiments.dblist
Closed, ResolvedPublic

Description

Background

The Growth team is moving the mentor/mentee relationship to a database table in extension1, called growthexperiments_mentor_mentee.

Information about table size

Answers questions from https://wikitech.wikimedia.org/wiki/Creating_new_tables.

  • Should this table be replicated to wiki replicas (does it contain private data)?: No, it should be private
  • Size of the table/Table growth: the table should never be bigger than the number of rows in user (if T227876 gets prioritized, the number of rows there will be doubled)
  • Expected amount of queries, both writes and reads: new account creation causes a write; reads are frequent (this information is cached in memcached, and it might be needed on all pageviews by an user with the features enabled)
  • Examples of queries that will be using the table:
    • SELECT gemm_mentor_id FROM growthexperiments_mentor_mentee WHERE gemm_mentee_id=XXX
    • SELECT gemm_mentee_id FROM growthexperiments_mentor_mentee WHERE gemm_mentor_id=XXX
  • Release plan
Table creation

Table should be created for all wikis in growthexperiments.dblist. The table should not be replicated.

Checklist

Event Timeline

Change 675185 had a related patch set uploaded (by Urbanecm; author: Urbanecm):
[operations/puppet@production] add growthexperiments_mentor_mentee to $private_tables

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

Is there a typo on the task description?

Table creation
Database should be created for all wikis in growthexperiments.dblist. The table should not be replicated.

I assume it should be table should be created?

Change 675185 merged by Marostegui:

[operations/puppet@production] add growthexperiments_mentor_mentee to $private_tables

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

Mentioned in SAL (#wikimedia-operations) [2021-04-05T05:12:02Z] <marostegui> Restart all sanitarium hosts to pick up new filters T278573

All sanitarium hosts have been restarted to pick up the filter.

Marostegui moved this task from In progress to Done on the DBA board.
DannyS712 updated the task description. (Show Details)

Is there a typo on the task description?

Table creation
Database should be created for all wikis in growthexperiments.dblist. The table should not be replicated.

I assume it should be table should be created?

Of course, thanks for catching that. I'm apparently so used to creating databases rather than tables :-).

@Marostegui I'd appreciate it if you could have a look on the schema proposed and give a +1 (probably here, as the implementation side of the patch is likely to be changed as code review comes) as mentioned by https://wikitech.wikimedia.org/wiki/Creating_new_tables#Deployment.

CREATE TABLE /*_*/growthexperiments_mentor_mentee (
  gemm_mentee_id INT UNSIGNED NOT NULL,
  gemm_mentor_role VARCHAR(255) NOT NULL,
  gemm_mentor_id INT UNSIGNED NOT NULL,
  INDEX gemm_mentor_mentee (gemm_mentor_id),
  PRIMARY KEY(
    gemm_mentee_id, gemm_mentor_role
  )
);

@Urbanecm let's change VARCHAR with VARBINARY if that's ok.

Change 677921 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@master] Create growthexperiments_mentor_mentee to store mentor/mentee relationship

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

@Urbanecm_WMF let's change VARCHAR with VARBINARY if that's ok.

Sure, done. New schema:

CREATE TABLE /*_*/growthexperiments_mentor_mentee (
  gemm_mentee_id INT UNSIGNED NOT NULL,
  gemm_mentor_role VARBINARY(255) NOT NULL,
  gemm_mentor_id INT UNSIGNED NOT NULL,
  INDEX gemm_mentor_mentee (gemm_mentor_id),
  PRIMARY KEY(
    gemm_mentee_id, gemm_mentor_role
  )
) /*$wgDBTableOptions*/;

heh, it took me a while to realize that the INDEX was different from the PK first column, so many similar column names :-)
That looks good to me.

Change 677921 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Create growthexperiments_mentor_mentee to store mentor/mentee relationship

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

Mentioned in SAL (#wikimedia-operations) [2021-04-13T22:04:07Z] <Urbanecm> [urbanecm@mwmaint1002 /srv/mediawiki]$ foreachwikiindblist growthexperiments sql.php php-1.37.0-wmf.1/extensions/GrowthExperiments/maintenance/schemas/mysql/growthexperiments_mentor_mentee.sql # T278573

Urbanecm_WMF claimed this task.

Table created :)

Mentioned in SAL (#wikimedia-operations) [2021-04-13T22:04:07Z] <Urbanecm> [urbanecm@mwmaint1002 /srv/mediawiki]$ foreachwikiindblist growthexperiments sql.php php-1.37.0-wmf.1/extensions/GrowthExperiments/maintenance/schemas/mysql/growthexperiments_mentor_mentee.sql # T278573

(and at the right database cluster, realized seconds before submitting in prod)

Confirmed - table isn't on wiki replicas:

root@clouddb1021:/srv# find . | grep -i growthexperiments_mentor_mentee
root@clouddb1021:/srv#