-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Serialize MediaType as an integer to avoid string parsing #16073
Conversation
❌ Gradle check result for 412c076: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Signed-off-by: Andrew Ross <[email protected]>
412c076
to
ff72418
Compare
❌ Gradle check result for ff72418: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #16073 +/- ##
============================================
- Coverage 72.01% 71.90% -0.12%
+ Complexity 64425 64378 -47
============================================
Files 5281 5281
Lines 301004 300972 -32
Branches 43482 43461 -21
============================================
- Hits 216779 216416 -363
- Misses 66423 66840 +417
+ Partials 17802 17716 -86 ☔ View full report in Codecov by Sentry. |
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.
Help me understand where these uniqueId
's come from? For XContentType
I see it uses index
? Do those change? What happens when a new media type is inserted into the list of possible media types in a minor version?
Adding to @dblock concerns, the media type has variable part. Fe "application/json; charset=UTF-8" or "application/json; charset=UTF-16", all of those are "application/json" but have May be what we could do, in order to simplify things, is to cache media types on each node? Fe using hash or something? How would it work (in the nutshell):
|
@reta @dblock This is a fair point, but the code that exists today can only model the variable part of the media type as a I think there may be a disconnect in the object modelling in that the MediaType interface is quite generic, but in practice the only implementation is as the XContentType enum. This interface was only relatively recently introduced to decouple the specific XContentType enum out of the One alternative, which I mentioned in the issue, is to simply add in a short-circuit optimization in the |
I did some debugging and you are very right, the whatever the content type request had is narrowed down to the respective XContent's media type.
This is actually an important point - the media type at least designed to be extensible.
I think that would be a best option, that we could generalize in |
Closing in favor of #16358 |
Related Issues
Resolves #15979
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.