Remove support for different DB hosts per datasource

RESOLVED FIXED

Status

P3
normal
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: emorley, Assigned: emorley)

Tracking

(Blocks: 1 bug)

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
The datasource table currently stores the RW and RO host name for each project+{jobs,objectstore} combo.

This was added to support the use case of having say mozilla-inbound on a different DB host to the others.

However this is not something we're really ever going to do - since if anything we're moving towards a model where all repos are in the same DB - and at the very least on the same DB host.

As such, let's just remove this complexity - and assume only one RW host and one RO host - and use the values from DATABASES[{'default', 'read_only'}] directly.

We can also remove these columns, since I don't think they are adding any value either:
* creation_date
* type (the DB type, eg mysql)
(Assignee)

Comment 1

3 years ago
Current values on prod...

Execute:
> SELECT id, host, read_only_host, name, type FROM treeherder.datasource LIMIT 5

+ ------- + --------- + ------------------- + --------- + --------- +
| id      | host      | read_only_host      | name      | type      |
+ ------- + --------- + ------------------- + --------- + --------- +
| 1       | treeherder-rw-vip.metrics.scl3.mozilla.com | treeherder-ro-vip.metrics.scl3.mozilla.com | accessibility_jobs_1 | mysql     |
| 2       | treeherder-rw-vip.metrics.scl3.mozilla.com | treeherder-ro-vip.metrics.scl3.mozilla.com | accessibility_objectstore_1 | mysql     |
| 3       | treeherder-rw-vip.metrics.scl3.mozilla.com | treeherder-ro-vip.metrics.scl3.mozilla.com | addon_sdk_jobs_1 | mysql     |
| 4       | treeherder-rw-vip.metrics.scl3.mozilla.com | treeherder-ro-vip.metrics.scl3.mozilla.com | addon_sdk_objectstore_1 | mysql     |
| 5       | treeherder-rw-vip.metrics.scl3.mozilla.com | treeherder-ro-vip.metrics.scl3.mozilla.com | alder_jobs_1 | mysql     |
| NULL    | NULL      | NULL                | NULL      | NULL      |
+ ------- + --------- + ------------------- + --------- + --------- +
6 rows

Confirmation that all rows have a type of "mysql":

Execute:
> SELECT id, name, type FROM treeherder.datasource WHERE type != "mysql"

+ ------- + --------- + --------- +
| id      | name      | type      |
+ ------- + --------- + --------- +
| NULL    | NULL      | NULL      |
+ ------- + --------- + --------- +
1 rows
(Assignee)

Comment 2

3 years ago
Created attachment 8632084 [details] [review]
Remove support for different DB hosts per datasource
Attachment #8632084 - Flags: review?(cdawson)
(Assignee)

Updated

3 years ago
Blocks: 1182465

Updated

3 years ago
Attachment #8632084 - Flags: review?(cdawson) → review+

Comment 3

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

https://github.com/mozilla/treeherder/commit/2d087edaeab07b1fe680d211413a37090792f309
Bug 1182455 - Remove support for different DB hosts per datasource

Having the ability to use different DB hosts for each project sounded
like a good idea, but in reality, we have no need for it.

This switches us to using the global read-write and read-only database
host names rather than the fields on the datasource table. As such, the
'host', 'read_only_host' and 'type' (eg 'mysql') fields can be removed.
The Django model had a unique_together on host+name, so we now need to
make 'name' (ie database name) a unique key on it's own.

In addition, this removes the 'creation_date' field, since we don't use
it anywhere, and we can just look at the commit history to see when a
repo was created. (I imagine it may have had more use if we actually had
started partitioning the databases uses the old 'dataset' count field).

In a future bug, I'll remove the redundant substitution of 'engine' for
'InnoDB' in the template schema, given that engine is now always InnoDB
in create_db().
(Assignee)

Updated

3 years ago
Blocks: 1182779
(Assignee)

Updated

3 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
(Assignee)

Updated

3 years ago
Blocks: 1178641
You need to log in before you can comment on or make changes to this bug.