-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use searchcache results if summary file is old format #2920
Conversation
Thanks for taking a look James! I was hoping to view the changes deployed to a staging environment to see how they interact with a functional searchcache component. I usually add useful commenting and context for review when things feel more finalized, so I hope this wasn't too much of a mess to understand. 🙂 |
api/query/query.go
Outdated
@@ -145,7 +167,7 @@ func (qh queryHandler) loadSummary(testRun shared.TestRun) ([]byte, error) { | |||
} | |||
|
|||
func getRedisKey(testRun shared.TestRun) string { | |||
return "RESULTS_SUMMARY-" + strconv.FormatInt(testRun.ID, 10) | |||
return "RESULTS_SUMMARY-v2-" + strconv.FormatInt(testRun.ID, 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick question: For all the old redis keys, do we add an expiration to them or will we need to do a one time cleanup of the old keys? Just thinking that we don't want to leave all the old info that won't be retrieved anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We definitely will need to flush the cache prior to landing this change. I'm not sure of the protocol we have set up currently for cache data expiration, but this will certainly invalidate all of these old keys.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! Just a few thoughts:
Overall it would be great if you could break down changes based on different services - one for searchcache and one for processor. (I understand the change to processor is rather minimal in this case). It easier to test/deploy/revert one service at a time.
On the design side, it seems to me that we have to validate new summary files for both webapp and searchcache? Does it mean that we have to direct all the traffic to searchcache first? or we only check it for some pages, like interop202x tests?
Alternatively, we can pack the changes in api/query/search.go to an API endpoint, e.g. /has-summary-file that checks if a file exist. The reason being that webapp can scale and handle traffic much better than searchcache and MUCH less resource intensive. Also by doing that, we can pretty much keep the searchcache logic intact, rather than change the isSimpleQ
logic
Thanks for taking a look @jcscottiii and @KyleJu 😊
I did a bit of this
The summary files are not validated on webapp, but the summary URL is sliced and used to determine the URL for getting single test data results, because the single test data is prefaced with the same name as the summary (I've updated the method in When determining |
429533b
to
b34c614
Compare
@jcscottiii @KyleJu This PR is ready for review once again. I've tried to thoroughly explain the changes file-by-file in the description above. Hopefully that makes it a bit easier to understand the approach. Let me know if there's anything I can do to make this easier! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added comments about the custom error part. I forgot to mention the ability to wrap errors and assert for errors earlier. Sorry about that.
Wrapping errors allows you to take an error and add more information to it. Then with errors.Is
, it can unwrap the error and do the type assertion for you on your custom error.
More details about it:
- https://go.dev/blog/go1.13-errors
- Working with Error Wrapping slides
I have also created a go playground for you to test out if you want. https://go.dev/play/p/SYd3AUfKX1H
Thanks for the error handling help @jcscottiii 😊 maybe looks better now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! LGTM
Thanks for all the help @jcscottiii @KyleJu 😊 |
Over changes:
_v2
name suffix in their bucket URL).Note: The summary files in staging and production are currently being generated in the new summary file format and the
_v2
name suffix, so this change will have less impact needing to compute search results without summary files.Decision process for handling queries:
Major change explanations by file
api/query/query.go
:validateSummaryVersions
which checks each summary file URL associated with a test run and ensures it ends with the-summary_v2.json.gz
suffix.SummaryResult
to no longer hold an old format and new format for summary files, since we will no longer be using old format summary files.getRedisKey
function togetSummaryFileRedisKey
to be more specific, as well as changing the existing redis key format.api/query/search.go
:shared/util.go
_v2
suffix rather than allowing_v2
as optional for summary files.Testing file changes
api/query/query_test.go
api/query/search_test.go
shared/models_test.go
shared/test_run_query_medium_test.go
shared/util_test.go
webapp/components/test/fixtures/interop.json
util/populate_dev_data.go
webapp/components/test/fixtures/passrates.json
webapp/components/test/test-file-results.html
webapp/components/test/util/helpers.js
A number of summary files exist in the repo to test against. These were previously in the old format and have been replaced with the new format.
webapp/static/24278ab617/chrome[experimental]-summary_v2.json.gz
webapp/static/24278ab617/chrome[experimental].json
webapp/static/24278ab617/chrome[stable]-summary_v2.json.gz
webapp/static/24278ab617/chrome[stable].json
webapp/static/24278ab617/edge[experimental]-summary_v2.json.gz
webapp/static/24278ab617/edge[experimental].json
webapp/static/24278ab617/edge[stable]-summary_v2.json.gz
webapp/static/24278ab617/edge[stable].json
webapp/static/24278ab617/firefox[experimental]-summary_v2.json.gz
webapp/static/24278ab617/firefox[stable]-summary_v2.json.gz
webapp/static/24278ab617/firefox[stable]-summary_v2.json.gz
webapp/static/24278ab617/firefox[stable].json
webapp/static/24278ab617/safari[experimental]-summary_v2.json.gz
webapp/static/24278ab617/safari[experimental].json
webapp/static/24278ab617/safari[stable]-summary_v2.json.gz
webapp/static/24278ab617/safari[stable].json
Docs file changes
api/README.md
docs/gcs.md
_v2
to summary file URL examples.webapp/components/test-file-results.js
resultsURL
method.