normandy icon indicating copy to clipboard operation
normandy copied to clipboard

Remove RecipeRevision.[countries|locales|channels] manytomany fields

Open peterbe opened this issue 7 years ago • 8 comments

These have been migrated to filter_object_json where appropriate.

peterbe avatar Sep 10 '18 17:09 peterbe

Whoaaa! This led me deep into a rabbit hole of hacking that just started tasting worse per edit.

The countries, locales, and channels is deeply integrated in the code. There are lots of complex tests that depend on it being a ManyToManyField. For example, the test_models.py depends on doing things like this: https://github.com/mozilla/normandy/blob/d17dbe00ca32df582a732ac0cf121dc7f72313bb/normandy/recipes/tests/test_models.py#L470-L486

There's also the deeply complex migrations and their unit test code that tests migrating from these ManyToManyFields to filter_objects.

Until all of these things have been refactored, carefully, then can we worry about removing the many-to-many tables.

peterbe avatar Sep 10 '18 20:09 peterbe

Would it make sense to remove the fields from the API, so we don't get any new recipes with these fields set?

mythmon avatar Sep 10 '18 20:09 mythmon

Rough guestimate of work...

  • [x] Remove unit tests that mess with revising the countries, locales and channels.
  • [ ] Don't make it possible to filter the API (all 3 versions, sigh) by locales, countries or channels. (@mythmon is that ok?)
  • [x] Remove unit tests that test filtering (and serializing?) around these three fields.
  • [ ] MOre aggressive stuff.

If this is sane, let's do it gently with one thing at a time.

peterbe avatar Sep 10 '18 20:09 peterbe

Would it make sense to remove the fields from the API, so we don't get any new recipes with these fields set?

Uh? So there are still some that come in an populate the database for the many-to-many tables? I.e. stuff that goes against that big data migration when filter_object_json was launched.

peterbe avatar Sep 10 '18 20:09 peterbe

Uh? So there are still some that come in an populate the database for the many-to-many tables? I.e. stuff that goes against that big data migration when filter_object_json was launched.

In practice, no. There shouldn't be any new data, since none of the tools that write to the API expose these fields. Sorry if I gave you false alarm. In theory it is possible though, since those fields exist.

mythmon avatar Sep 10 '18 20:09 mythmon

I think I need to remind myself that we shall not undo the Channels, Locales and Countries models. Maybe we do at some point but it's out of context for this issue.

peterbe avatar Sep 11 '18 15:09 peterbe

slow many-to-many db fields that never ended up getting used that are slow. so should just delete them

shell1 avatar Jul 12 '19 17:07 shell1

I took a stab at this in #1943, and I've decided it is not actually a good-first-bug.

mythmon avatar Aug 20 '19 20:08 mythmon