You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "renatoh (via GitHub)" <gi...@apache.org> on 2026/04/27 09:58:17 UTC
[PR] Use own object mapper in caching json message body reader [solr]
renatoh opened a new pull request, #4370:
URL: https://github.com/apache/solr/pull/4370
Looking into https://issues.apache.org/jira/browse/SOLR-18191 I released our V2API not using SolrJacksonMapper.getObjectMapper(). This feels wrong to me.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Use ObjectMapper from SolrJacksonMapper in CachingJsonMessageBodyReader [solr]
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #4370:
URL: https://github.com/apache/solr/pull/4370#issuecomment-4410055780
Lastly, I added `no-changelog` label ;-)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Use ObjectMapper from SolrJacksonMapper in CachingJsonMessageBodyReader [solr]
Posted by "renatoh (via GitHub)" <gi...@apache.org>.
renatoh commented on PR #4370:
URL: https://github.com/apache/solr/pull/4370#issuecomment-4475605432
@epugh I think this issue is not more pronounced since most of the API call still do not use JAX-RS, adding a new collection is one of the few using it.
Potentially the priority in JerseyApplications is also no ideal, but would be good to get @gerlowskija take on the changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Use ObjectMapper from SolrJacksonMapper in CachingJsonMessageBodyReader [solr]
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #4370:
URL: https://github.com/apache/solr/pull/4370#discussion_r3408059817
##########
solr/core/src/test/org/apache/solr/jersey/PostRequestLoggingFilterTest.java:
##########
@@ -96,6 +103,45 @@ public void testBuildQueryParameterString_ExcludesFilteredParameters() {
assertEquals("paramName1=paramValue1¶mName2=paramValue2", queryParamStr);
}
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testCachingJsonMessageBodyReaderDelegateUsesConfiguredObjectMapper()
+ throws Exception {
+ final var delegate = new MessageBodyReaders.CachingJsonMessageBodyReader().getDelegate();
+
+ // Mapper SolrJacksonMapper.createObjectMapper creates a mapper wit FAIL_ON_UNKNOWN_PROPERTIES
Review Comment:
```suggestion
// Mapper SolrJacksonMapper.createObjectMapper creates a mapper with FAIL_ON_UNKNOWN_PROPERTIES
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Use ObjectMapper from SolrJacksonMapper in CachingJsonMessageBodyReader [solr]
Posted by "renatoh (via GitHub)" <gi...@apache.org>.
renatoh commented on code in PR #4370:
URL: https://github.com/apache/solr/pull/4370#discussion_r3391228718
##########
solr/core/src/test/org/apache/solr/jersey/PostRequestLoggingFilterTest.java:
##########
@@ -96,6 +103,45 @@ public void testBuildQueryParameterString_ExcludesFilteredParameters() {
assertEquals("paramName1=paramValue1¶mName2=paramValue2", queryParamStr);
}
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testCachingJsonMessageBodyReaderDelegateUsesConfiguredObjectMapper()
+ throws Exception {
+ final var delegate = new MessageBodyReaders.CachingJsonMessageBodyReader().getDelegate();
+
+ // Mapper SolrJacksonMapper.createObjectMapper creates a mapper wit FAIL_ON_UNKNOWN_PROPERTIES
Review Comment:
@gerlowskija Something like this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Use ObjectMapper from SolrJacksonMapper in CachingJsonMessageBodyReader [solr]
Posted by "renatoh (via GitHub)" <gi...@apache.org>.
renatoh commented on code in PR #4370:
URL: https://github.com/apache/solr/pull/4370#discussion_r3209951119
##########
changelog/unreleased/PR#4370-use-own-object-mapper-for-v2api.yml:
##########
Review Comment:
No, I've not seen this text. I added a change log since I have be told to add one on previous PRs, which were also minor.
But good to know, I think the important point is the one about the audience, I was not aware the audience are not the committers, thanks for pointing it out.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Use ObjectMapper from SolrJacksonMapper in CachingJsonMessageBodyReader [solr]
Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on code in PR #4370:
URL: https://github.com/apache/solr/pull/4370#discussion_r3206257431
##########
changelog/unreleased/PR#4370-use-own-object-mapper-for-v2api.yml:
##########
Review Comment:
Wether there's a JIRA or not doesn't matter, although it tends to be correlated as something not changelog worthy isn't JIRA-worthy either... although we sometimes create JIRAs to remember to do something which is quite alright.
The way I think of a writing a changelog entry is, I think, rather simple. Step back from the nitty gritty details of the PR and imagine telling a a stranger who uses Solr about what you did in a way that hopefully might interest them. The changelog speaks to the user -- it's a summary that many users read each release. _How is this change making Solr better?_ If it's too much of a stretch to write something of interest then don't bother wasting both your time and more importantly all potential readers of it.
The "Other" section can be an exception to this as it's more open up to Solr hackers to record more significant changes that won't interest users. Changes significant enough that us Solr hackers (Solr plugin authors & Solr contributors) may want to remember that a notable thing happened in this Solr version, like a significant (not insignificant) refactoring.
And no-changelog doesn't mean a PR isn't appreciated!
> What you think of the fix itself, is this a fix or improvement in your opinion?
All I could discern of interest is the support for comments. I'm unsure if this was possible before? Seems too minor to mention IMO.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Use ObjectMapper from SolrJacksonMapper in CachingJsonMessageBodyReader [solr]
Posted by "renatoh (via GitHub)" <gi...@apache.org>.
renatoh commented on PR #4370:
URL: https://github.com/apache/solr/pull/4370#issuecomment-4412280803
> I looked at the unit tests, and yes, if you revert the change, the unit test fails..... I am a bit surprised that this bug hasn't been seen before? Can you share a bit on how you stumbled across this? Is this something that can actually happen in a running Solr, or does it only happen in the way you set it up.
>
> Also, I have seen recently in another project that apparently ObjectMapper's are expensive to create and threadsafe so they SHOULD be reused?
Yes, they are thread-safe and should be reused, that is also stated on the java-doc:
https://fasterxml.github.io/jackson-databind/javadoc/2.6/com/fasterxml/jackson/databind/ObjectMapper.html
And indeed, the ObjectMapper has not been reused before, I have added a test to ensure it is reused now, and this test is failing with the MessageBodyReaders prior my change.
Are we potentially creating an own ObjectMapper instance for eveyr API-call?
I came across working on this ticket:
https://issues.apache.org/jira/browse/SOLR-18191
I realized change org.apache.solr.jersey.SolrJacksonMapper had no effect on how the API-calls where de-serialized, Investigating why, I discovered the SolrJacksonMapper is not used at all for an API-call such as creating a new collection.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Use ObjectMapper from SolrJacksonMapper in CachingJsonMessageBodyReader [solr]
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #4370:
URL: https://github.com/apache/solr/pull/4370#issuecomment-4410053001
I looked at the unit tests, and yes, if you revert the change, the unit test fails..... I am a bit surprised that this bug hasn't been seen before? Can you share a bit on how you stumbled across this? Is this something that can actually happen in a running Solr, or does it only happen in the way you set it up.
Also, I have seen recently in another project that apparently ObjectMapper's are expensive to create and threadsafe so they SHOULD be reused?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Use ObjectMapper from SolrJacksonMapper in CachingJsonMessageBodyReader [solr]
Posted by "gerlowskija (via GitHub)" <gi...@apache.org>.
gerlowskija commented on code in PR #4370:
URL: https://github.com/apache/solr/pull/4370#discussion_r3390864291
##########
solr/core/src/test/org/apache/solr/jersey/PostRequestLoggingFilterTest.java:
##########
@@ -96,6 +103,42 @@ public void testBuildQueryParameterString_ExcludesFilteredParameters() {
assertEquals("paramName1=paramValue1¶mName2=paramValue2", queryParamStr);
}
+ @Test
+ @SuppressWarnings("unchecked")
+ public void testCachingJsonMessageBodyReaderDelegateUsesConfiguredObjectMapper()
Review Comment:
[0] It'd be great to have a code comment at the top of this test that clarifies how it proves that the expected mapper is used. IMO it'll be hard for anyone stumbling on this outside the context of this PR to get what's going on.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Use ObjectMapper from SolrJacksonMapper in CachingJsonMessageBodyReader [solr]
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #4370:
URL: https://github.com/apache/solr/pull/4370#issuecomment-4432176195
I am inclined to merge this, but would love @gerlowskija to weigh in...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Use ObjectMapper from SolrJacksonMapper in CachingJsonMessageBodyReader [solr]
Posted by "renatoh (via GitHub)" <gi...@apache.org>.
renatoh commented on code in PR #4370:
URL: https://github.com/apache/solr/pull/4370#discussion_r3204114802
##########
changelog/unreleased/PR#4370-use-own-object-mapper-for-v2api.yml:
##########
Review Comment:
> This isn't changelog worthy, at least not as-written. No user of Solr will care.
I am a bit confused what does need a changelog and what not. Small changes without a associate Jira do not need a change log?
What you think of the fix itself, is this a fix or improvement in your opinion?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Use ObjectMapper from SolrJacksonMapper in CachingJsonMessageBodyReader [solr]
Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on code in PR #4370:
URL: https://github.com/apache/solr/pull/4370#discussion_r3209224761
##########
changelog/unreleased/PR#4370-use-own-object-mapper-for-v2api.yml:
##########
Review Comment:
I assume you saw [this text ](https://github.com/apache/solr/blob/232690c9dd8c9a03bd552923c69d3fafbeade0f8/gradle/changelog.gradle#L61-L68 )in the process of producing the changelog? I seek any feedback you may have to improve it in light of what I said above.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Use ObjectMapper from SolrJacksonMapper in CachingJsonMessageBodyReader [solr]
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #4370:
URL: https://github.com/apache/solr/pull/4370#issuecomment-4412605379
Yeah, you may be discovering an issue in us not reusing the ObjectMapper? Do you think you need to dig a bit more and see if there is a larger change that should be made? Or is THIS that fix? Looking at the `SolrJacksonMapper.getObjectMapper` taht to me says that is where we reuse ObjectMapper instead of creating a new one?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Use ObjectMapper from SolrJacksonMapper in CachingJsonMessageBodyReader [solr]
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #4370:
URL: https://github.com/apache/solr/pull/4370#issuecomment-4326600645
While this makes sense to me, I don't know the ramifications of this change.. I'm tagging @gerlowskija as well. I did trigger the tests to run!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Use ObjectMapper from SolrJacksonMapper in CachingJsonMessageBodyReader [solr]
Posted by "renatoh (via GitHub)" <gi...@apache.org>.
renatoh commented on PR #4370:
URL: https://github.com/apache/solr/pull/4370#issuecomment-4394794108
@dsmiley would be greattto get your take on that change, thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Use ObjectMapper from SolrJacksonMapper in CachingJsonMessageBodyReader [solr]
Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on code in PR #4370:
URL: https://github.com/apache/solr/pull/4370#discussion_r3201567642
##########
changelog/unreleased/PR#4370-use-own-object-mapper-for-v2api.yml:
##########
Review Comment:
This isn't changelog worthy, at least not as-written. No user of Solr will care.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Use ObjectMapper from SolrJacksonMapper in CachingJsonMessageBodyReader [solr]
Posted by "renatoh (via GitHub)" <gi...@apache.org>.
renatoh commented on PR #4370:
URL: https://github.com/apache/solr/pull/4370#issuecomment-4412824808
At the moment I do not understand the scope of the issue since the only endpoint I found invoking org.apache.solr.jersey.MessageBodyReaders.CachingJsonMessageBodyReader#getDelegate is the one to create a collection on /api/collections
All other calls to /api/... do not seem to call it, at least the once I've tried.
I thing the reason why it is not use consistently might be caused by the priorities in:
org.apache.solr.jersey.JerseyApplications
So why wouldn't we want to use CachingJsonMessageBodyReader consistently is the question I do not understand.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] Use ObjectMapper from SolrJacksonMapper in CachingJsonMessageBodyReader [solr]
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh merged PR #4370:
URL: https://github.com/apache/solr/pull/4370
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org