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
Update dynamic fields in mapping on master even if parsing fails for the rest of the doc #9874
Conversation
@@ -494,7 +494,7 @@ public ParsedDocument parse(SourceToParse source, @Nullable ParseListener listen | |||
} catch (Throwable e) { | |||
// if its already a mapper parsing exception, no need to wrap it... | |||
if (e instanceof MapperParsingException) { | |||
throw (MapperParsingException) e; | |||
throw ((MapperParsingException) e).setMappingsModified(context.mappingsModified()); |
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.
Could we do it in such a way that we do not need to modify the incoming exception in-place?
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.
Not sure what you mean. I added it now in the constructor of the MapperParsingException. Is this what you meant?
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.
Yes! I like it much better!
LGTM |
@brwe Since this change looks quite significant, I don't think it should be pushed to 1.4.5. |
… fails for the rest of doc The local DocumentMapper is updated while parsing and dynamic fields are added before parsing has finished. If parsing fails after a dynamic field has been added already then the field was not added to the cluster state but was present in the local mapper of this node. New documents with the same field would not necessarily cause an update either and after restarting the node the mapping for these fields were lost. Instead the new fields should always be updated. closes #9851 closes #9874
That was not a good idea - the change of MapperParsingException seemes to have screwed up bwc for Exception serialization, see for example http://build-us-00.elasticsearch.org/job/es_bwc_1x/8385/ |
… fails for the rest of doc The local DocumentMapper is updated while parsing and dynamic fields are added before parsing has finished. If parsing fails after a dynamic field has been added already then the field was not added to the cluster state but was present in the local mapper of this node. New documents with the same field would not necessarily cause an update either and after restarting the node the mapping for these fields were lost. Instead the new fields should always be updated. closes elastic#9851 closes elastic#9874
bfb8224
to
732583b
Compare
Ok, new plan. Instead of changing the mapper parsing exception we actually can just get the context from the document mapper and ask if the mapping was changed - much easier and I cannot see any downside to it. @jpountz would you mind taking another look? |
I'm not too happy with getting back to the cache to check whether mappings have been modified, I liked the previous solution better. But on ther other hand, I don't have a better idea. Can we maybe just use this approach on 1.x and keep the previous approach on master? |
Ok, I'll do that. |
… fails for the rest of doc The local DocumentMapper is updated while parsing and dynamic fields are added before parsing has finished. If parsing fails after a dynamic field has been added already then the field was not added to the cluster state but was present in the local mapper of this node. New documents with the same field would not necessarily cause an update either and after restarting the node the mapping for these fields were lost. Instead the new fields should always be updated. closes #9851 closes #9874
...ils for the rest of doc
The local DocumentMapper is updated while parsing and dynamic fields are added before
parsing has finished. If parsing fails after a dynamic field has been added already
then the field was not added to the cluster state but was present in the local mapper of this
node. New documents with the same field would not necessarily cause an update either and
after restarting the node the mapping for these fields were lost. Instead the new fields
should always be updated.
closes #9851