Bug 201561 - results.webkit.org: Configurations should be branch specific
Summary: results.webkit.org: Configurations should be branch specific
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jonathan Bedard
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-09-06 14:31 PDT by Jonathan Bedard
Modified: 2019-09-16 15:41 PDT (History)
6 users (show)

See Also:


Attachments
Patch (25.29 KB, patch)
2019-09-06 14:58 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (23.66 KB, patch)
2019-09-09 14:16 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (23.62 KB, patch)
2019-09-09 15:59 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (23.53 KB, patch)
2019-09-16 10:37 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Bedard 2019-09-06 14:31:49 PDT
The fact that configurations are global, rather than being applied per branch, has lead to a number of idiosyncrasies, most notably, the user being provided with more configurations to filter by than are actually available. To fix this, we need to bucket configurations by branch.

Note that this will require a small database migration (only a handful of very small tables).
Comment 1 Jonathan Bedard 2019-09-06 14:58:54 PDT
Created attachment 378240 [details]
Patch
Comment 2 Jonathan Bedard 2019-09-06 15:00:01 PDT
I'd like a sanity check on this before I push it to the dev instance, since even on the dev instance, it makes some database schema changes.
Comment 3 Jonathan Bedard 2019-09-09 14:16:45 PDT
Created attachment 378409 [details]
Patch
Comment 4 Jonathan Bedard 2019-09-09 15:59:03 PDT
Created attachment 378414 [details]
Patch
Comment 5 Jonathan Bedard 2019-09-12 08:39:23 PDT
I talked to Kocsen about this earlier in the week.

We determined that using branch as a partitioning key made our life more difficult, so instead, I switched it to just a primary key. We still need to create new tables, but the code for extracting the configurations into the Redis cache is much smaller.
Comment 6 dewei_zhu 2019-09-16 09:18:33 PDT
Comment on attachment 378414 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=378414&action=review

> Tools/resultsdbpy/resultsdbpy/controller/upload_controller.py:170
> +                branch=branch[0] if branch else None,

Is there some mechanism to ensure branch is aways a list of string rather than just a string?

> Tools/resultsdbpy/resultsdbpy/model/configuration_context.py:215
> +    def search_for_recent_configuration(self, configuration=Configuration(), branch=None):

Just want to point out that the default argument `configuration` will only be initialized once at the function def time. All invocations to this function will ref to a single configuration object if default value is used.

> Tools/resultsdbpy/resultsdbpy/model/configuration_context_unittest.py:79
> +                self.database.register_configuration(configuration, None, old)

Personally, I would prefer to use `timestamp=old` over passing a None argument.

> Tools/resultsdbpy/resultsdbpy/view/static/js/drawer.js:120
> +let configurationsDefinedCallbacks = [];

Where is this variable updated?

> Tools/resultsdbpy/resultsdbpy/view/static/js/drawer.js:134
> +            configurations = [];
> +            json.forEach(pair => {
> +                const config = new Configuration(pair[0]);
> +                configurations.push(config);
> +            });

How about `configurations = json.map(pair => new Configuration(pair[0])`?

> Tools/resultsdbpy/resultsdbpy/view/static/js/drawer.js:135
> +            configurationsDefinedCallbacks.forEach(callback => {callback();});

I think `configurationsDefinedCallbacks.forEach(callback => callback());` would work.
Comment 7 dewei_zhu 2019-09-16 09:18:50 PDT
r=me with comment.
Comment 8 Jonathan Bedard 2019-09-16 09:40:40 PDT
Comment on attachment 378414 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=378414&action=review

>> Tools/resultsdbpy/resultsdbpy/controller/upload_controller.py:170
>> +                branch=branch[0] if branch else None,
> 
> Is there some mechanism to ensure branch is aways a list of string rather than just a string?

Yes, @query_as_kwargs() turns the request's query into a kwarg dictionary, and always passes arguments as a list.

>> Tools/resultsdbpy/resultsdbpy/model/configuration_context.py:215
>> +    def search_for_recent_configuration(self, configuration=Configuration(), branch=None):
> 
> Just want to point out that the default argument `configuration` will only be initialized once at the function def time. All invocations to this function will ref to a single configuration object if default value is used.

That's totally fine, we convert the configuration to a string in self.redis.scan_iter(...) and don't make any edits to it.

Sometimes I wish Python had a 'const' keyword....

>> Tools/resultsdbpy/resultsdbpy/view/static/js/drawer.js:120
>> +let configurationsDefinedCallbacks = [];
> 
> Where is this variable updated?

It's updated in ConfigurationSelectors(...), it was originally a local variable within that function, we're just making it local to the whole file.
Comment 9 Jonathan Bedard 2019-09-16 10:37:35 PDT
Created attachment 378871 [details]
Patch
Comment 10 WebKit Commit Bot 2019-09-16 15:40:56 PDT
Comment on attachment 378871 [details]
Patch

Clearing flags on attachment: 378871

Committed r249924: <https://trac.webkit.org/changeset/249924>
Comment 11 WebKit Commit Bot 2019-09-16 15:40:57 PDT
All reviewed patches have been landed.  Closing bug.
Comment 12 Radar WebKit Bug Importer 2019-09-16 15:41:31 PDT
<rdar://problem/55417843>