If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Remove the unused result_set_classification table

RESOLVED FIXED

Status

Tree Management
Treeherder
P3
normal
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: emorley, Assigned: emorley)

Tracking

(Blocks: 1 bug)

Details

Attachments

(1 attachment)

(Assignee)

Description

2 years ago
We're not currently using this table - let's just remove it until an actual use-case makes itself clear. (And most of the use cases can likely be solved by dymanically querying the jobs linked to a result set - without the need to permanently store the resultant state such as "contains broken commits").
(Assignee)

Updated

2 years ago
Blocks: 1178227
(Assignee)

Comment 1

2 years ago
Created attachment 8627418 [details] [review]
Remove the result_set_classification table
Attachment #8627418 - Flags: review?(cdawson)
(Assignee)

Updated

2 years ago
Status: NEW → ASSIGNED
(Assignee)

Comment 2

2 years ago
Comment on attachment 8627418 [details] [review]
Remove the result_set_classification table

Switching review to Mauro, to balance them out a bit :-)

Once this lands & is deployed, I'll do a:

manage.py run_sql -s "ALTER TABLE result_set DROP COLUMN result_set_classification_id;"

(according to http://dev.mysql.com/doc/refman/5.1/en/alter-table.html , the index will be automatically removed when I remove the field)

...on stage/prod.

We'll also need to "DROP TABLE IF EXISTS treeherder.result_set_classification;" (I don't know why this table isn't in migrations/0001_initial.py, otherwise I'd say use migrations to do this part?)
Attachment #8627418 - Flags: review?(cdawson) → review?(mdoglio)
Attachment #8627418 - Flags: review?(mdoglio) → review+

Comment 3

2 years ago
Commit pushed to master at https://github.com/mozilla/treeherder

https://github.com/mozilla/treeherder/commit/aa438551206cce3c15206d07992257b638590a43
Bug 1178225 - Remove the unused result_set_classification table
(Assignee)

Comment 4

2 years ago
[emorley@treeherder-rabbitmq1.stage.private.scl3 treeherder-service]$ time ../venv/bin/python ./manage.py run_sql -s "ALTER TABLE result_set DROP COLUMN result_set_classification_id;"
SQL command: ALTER TABLE result_set DROP COLUMN result_set_classification_id;
66 datasource found
--------------------------
Sql code executed on addon-sdk - jobs:
--------------------------
Sql code executed on alder - jobs:
<snip>

real    0m8.281s
user    0m1.106s
sys     0m0.155s

[emorley@treeherder-rabbitmq1.stage.private.scl3 treeherder-service]$ ../venv/bin/python ./manage.py run_sql -s "SHOW INDEX FROM result_set" --datasources mozilla-inbound,try
SQL command: SHOW INDEX FROM result_set
2 datasource found
--------------------------
Sql code executed on mozilla-inbound - jobs:
  ('result_set', 0L, 'PRIMARY', 1L, 'id', 'A', 1780L, None, None, '', 'BTREE', '', '')
  ('result_set', 0L, 'idx_revision_hash', 1L, 'revision_hash', 'A', 1780L, None, None, '', 'BTREE', '', '')
  ('result_set', 1L, 'idx_aggregate_id', 1L, 'aggregate_id', 'A', 2L, None, None, 'YES', 'BTREE', '', '')
  ('result_set', 1L, 'idx_author', 1L, 'author', 'A', 356L, None, None, '', 'BTREE', '', '')
  ('result_set', 1L, 'idx_type', 1L, 'type', 'A', 2L, None, None, 'YES', 'BTREE', '', '')
  ('result_set', 1L, 'idx_push_timestamp', 1L, 'push_timestamp', 'A', 1780L, None, None, '', 'BTREE', '', '')
  ('result_set', 1L, 'idx_active_status', 1L, 'active_status', 'A', 2L, None, None, 'YES', 'BTREE', '', '')
--------------------------
Sql code executed on try - jobs:
  ('result_set', 0L, 'PRIMARY', 1L, 'id', 'A', 6702L, None, None, '', 'BTREE', '', '')
  ('result_set', 0L, 'idx_revision_hash', 1L, 'revision_hash', 'A', 6702L, None, None, '', 'BTREE', '', '')
  ('result_set', 1L, 'idx_aggregate_id', 1L, 'aggregate_id', 'A', 2L, None, None, 'YES', 'BTREE', '', '')
  ('result_set', 1L, 'idx_author', 1L, 'author', 'A', 744L, None, None, '', 'BTREE', '', '')
  ('result_set', 1L, 'idx_type', 1L, 'type', 'A', 2L, None, None, 'YES', 'BTREE', '', '')
  ('result_set', 1L, 'idx_push_timestamp', 1L, 'push_timestamp', 'A', 6702L, None, None, '', 'BTREE', '', '')
  ('result_set', 1L, 'idx_active_status', 1L, 'active_status', 'A', 4L, None, None, 'YES', 'BTREE', '', '')

[emorley@treeherder-rabbitmq1.stage.private.scl3 treeherder-service]$ ../venv/bin/python ./manage.py dbshell

mysql> SELECT table_schema, table_name FROM information_schema.tables WHERE table_name = 'result_set_classification';
+------------------+---------------------------+
| table_schema     | table_name                |
+------------------+---------------------------+
| treeherder_stage | result_set_classification |
+------------------+---------------------------+
1 row in set (0.16 sec)

mysql> DROP TABLE treeherder_stage.result_set_classification;
Query OK, 0 rows affected (0.04 sec)

mysql> SELECT table_schema, table_name FROM information_schema.tables WHERE table_name = 'result_set_classification';
Empty set (0.00 sec)
(Assignee)

Comment 5

2 years ago
And prod...

[emorley@treeherder-rabbitmq1.private.scl3 treeherder-service]$ time ../venv/bin/python ./manage.py run_sql -s "ALTER TABLE result_set DROP COLUMN result_set_classification_id;"
SQL command: ALTER TABLE result_set DROP COLUMN result_set_classification_id;
72 datasource found
--------------------------
Sql code executed on accessibility - jobs:
<snip>

real    0m14.433s
user    0m0.931s
sys     0m0.154s

[emorley@treeherder-rabbitmq1.private.scl3 treeherder-service]$ ../venv/bin/python ./manage.py dbshell

mysql> DROP TABLE treeherder.result_set_classification;
Query OK, 0 rows affected (0.05 sec)

mysql> SELECT table_schema, table_name FROM information_schema.tables WHERE table_name = 'result_set_classification';
Empty set (0.07 sec)
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
(Assignee)

Comment 6

2 years ago
Run on Heroku:

[~/src/treeherder]$ heroku run './manage.py run_sql -s "ALTER TABLE result_set DROP COLUMN result_set_classification_id ;"'
Running `./manage.py run_sql -s "ALTER TABLE result_set DROP COLUMN result_set_classification_id;"` attached to terminal... up, run.6753
SQL command: ALTER TABLE result_set DROP COLUMN result_set_classification_id;
44 datasource found
--------------------------
Sql code executed on mozilla-central - jobs:
--------------------------
Sql code executed on mozilla-inbound - jobs:
--------------------------
Sql code executed on b2g-inbound - jobs:

...

And:

DROP TABLE treeherder.result_set_classification;
You need to log in before you can comment on or make changes to this bug.