Closed Bug 1213899 Opened 9 years ago Closed 9 years ago

Drop the device table, reference_data_signatures.device_name and job.device_id

Categories

(Tree Management :: Treeherder: Infrastructure, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: emorley)

References

Details

Once bug 1211715 is in production, we can drop: * the per-project device table * treeherder.reference_data_signatures.device_name * treeherder.job.device_id
Will dropping the device_name column (https://github.com/mozilla/treeherder/commit/4196822599461e73bb3dd481a644c44cffe1cdae#diff-8fb6f09f253240c1fed214aec80c1896L69) cause the reference_data_signatures to change? Will that only affect new signatures (in which case I guess it doesn't matter), or old ones too? (And thus cause dupes / things to become unhidden etc). Or if that was going to happen, would it already have happened when bug 1211715 first landed? It just occurred to me maybe this isn't as trivial a change as it looks at first glance.
Flags: needinfo?(cdawson)
I've been trying to sort this out. Sorry for taking so long to reply... The signature is created only on the first time the job is encountered. So existing jobs that are already hidden shouldn't be affected. For new jobs, as you said, the signature hash won't include the device_name, and that's fine. When searching the signature table to find the right signature hash for a job that's come in, it just won't compare as many fields, so it will still find the right signature. As long as there's only one record like that. The one issue to check is: Does the signature table have records that are dupes when you remove that field? Some records are "vm" and others are "unknown" so that possibility exists. If that doesn't produce any dupes, then I think this is all safe. Barring that, I think you're in the clear
Flags: needinfo?(cdawson)
(In reply to Ed Morley [:emorley] from comment #0) > Once bug 1211715 is in production, we can drop: > * the per-project device table > * treeherder.reference_data_signatures.device_name > * treeherder.job.device_id Correction: * drop the per-project job table's device_id column * drop the treeherder.device table * drop the treeherder.reference_data_signatures table's device_name column Heroku: ALTER TABLE treeherder.reference_data_signatures DROP COLUMN device_name; 13:36:15 ALTER TABLE treeherder.reference_data_signatures DROP COLUMN device_name 0 row(s) affected Records: 0 Duplicates: 0 Warnings: 0 3.062 sec [~/src/treeherder]$ heroku run -- ./manage.py run_sql -s 'ALTER TABLE job DROP COLUMN device_id;' Running ./manage.py run_sql -s "ALTER TABLE job DROP COLUMN device_id;" on treeherder-heroku... up, run.3925 SQL command: ALTER TABLE job DROP COLUMN device_id; 54 datasource found -------------------------- Sql code executed on mozilla-central: -------------------------- Sql code executed on mozilla-inbound: -------------------------- Sql code executed on b2g-inbound: -------------------------- Sql code executed on try: -------------------------- Sql code executed on mozilla-aurora: -------------------------- Sql code executed on mozilla-beta: -------------------------- ... The jobs table DROP COLUMN took ~30 mins to run on Heroku, so we'll probably want to do prod at a quiet time. DROP TABLE treeherder.device; 14:17:34 DROP TABLE treeherder.device 0 row(s) affected 0.125 sec
Stage: [emorley@treeherder-rabbitmq1.stage.private.scl3 treeherder-service]$ ../venv/bin/python ./manage.py dbshell ... mysql> ALTER TABLE treeherder_stage.reference_data_signatures DROP COLUMN device_name; Query OK, 0 rows affected (6.17 sec) Records: 0 Duplicates: 0 Warnings: 0 [emorley@treeherder-rabbitmq1.stage.private.scl3 treeherder-service]$ time ../venv/bin/python ./manage.py run_sql -s "A LTER TABLE job DROP COLUMN device_id;" SQL command: ALTER TABLE job DROP COLUMN device_id; 68 datasource found -------------------------- Sql code executed on addon-sdk: -------------------------- Sql code executed on alder: -------------------------- Sql code executed on ash: -------------------------- ... -------------------------- Sql code executed on mozilla-b2g37_v2_2r: -------------------------- !!! Sql code execution failed on mozilla-b2g44_v2_5 !!! (1091, "Can't DROP 'device_id'; check that column/key exists") real 16m25.585s user 0m1.498s sys 0m0.159s [emorley@treeherder-rabbitmq1.stage.private.scl3 treeherder-service]$ ../venv/bin/python ./manage.py dbshell ... mysql> DROP TABLE treeherder_stage.device; Query OK, 0 rows affected (0.09 sec)
Prod: [emorley@treeherder-rabbitmq1.private.scl3 treeherder-service]$ ../venv/bin/python ./manage.py dbshell ... mysql> ALTER TABLE treeherder.reference_data_signatures DROP COLUMN device_name; Query OK, 0 rows affected (5.48 sec) Records: 0 Duplicates: 0 Warnings: 0 [emorley@treeherder-rabbitmq1.private.scl3 treeherder-service]$ time ../venv/bin/python ./manage.py run_sql -s "ALTER TABLE job DROP COLUMN device_id;" SQL command: ALTER TABLE job DROP COLUMN device_id; 74 datasource found -------------------------- Sql code executed on accessibility: -------------------------- Sql code executed on addon-sdk: -------------------------- ... Sql code executed on bugzilla-4_2: -------------------------- Sql code executed on bmo-development: -------------------------- Sql code executed on mozilla-b2g37_v2_2r: -------------------------- !!! Sql code execution failed on mozilla-b2g44_v2_5 !!! (1091, "Can't DROP 'device_id'; check that column/key exists") real 25m25.094s user 0m1.175s sys 0m0.182s [emorley@treeherder-rabbitmq1.private.scl3 treeherder-service]$ ../venv/bin/python ./manage.py dbshell ... mysql> DROP TABLE treeherder.device; Query OK, 0 rows affected (0.10 sec)
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.