Closed Bug 1182455 Opened 9 years ago Closed 9 years ago

Remove support for different DB hosts per datasource

Categories

(Tree Management :: Treeherder, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: emorley)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

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)
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
Attachment #8632084 - Flags: review?(cdawson)
Blocks: 1182465
Attachment #8632084 - Flags: review?(cdawson) → review+
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().
Blocks: 1182779
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Blocks: 1178641
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: