-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[discuss] Event field value mutability #7812
Comments
@colinsurprenant do you have the issue in which the undefined behavior was decided upon to link here for reference (or whatever paper trail exists of that decision) for me to read up on? |
I think #5035 #5140 #5141 should cover this. Otherwise @guyboertje @jordansissel @ph @suyograo were also part of these discussions and should be able to explain context/history. We also know we lack a good Event API public documentation. |
We have pretty extensive Event API docs here: https://www.elastic.co/guide/en/logstash/current/event-api.html |
Here are my thoughts: Long term: We should make Short term: Perhaps document that this behavior is undefined and strongly discourage inplace mutation of strings, lists, or map types? Research: Determine if mutation of |
@suyograo I stand corrected but wouldn't call it extensive either. I will propose changes to improve. |
I agree that having an undefined behaviour, even if documented, is not ideal. I guess the question is if we want/need to protect the |
Maybe in logstash 7.x we can just move toward using For the most part java strings act like ruby strings in jruby, same with the map / list types. Where they don't it would only require relatively small patches to plugins to fix any issues. |
We would still have to convert from ruby -> java, but we wouldn't ever have cause to do the reverse in this setup. |
Personally I think we should:
I think that this is very practical and will not break or change anything in the short term and has impact to only plugins developers which can rely on the API documentation for this. |
You make some good points @colinsurprenant . I'm +1 on your proposal. |
I am +1 with your proposal @colinsurprenant (and also on the original proposal of using setters) |
I just became aware of issues #7662 and #7663.
In #7662 it was demonstrated that mutating a String field value extracted from the event using
Event.get
did not have a consistent behaviour on both the Ruby and Java sides when re-reading the same field value but without updating it usingEvent.set
after the mutation.When we introduced the new
Event
getter and setter, it was in part to emphasize on the undefined behaviour of in-place mutating anEvent
field value.Currently the only way to make sure the
Event
has a consistent field value is to set it back in theEvent
. So for me #7662 does not look like a bug but maybe more a lack of documentation?The spec in #7662 should be instead:
The undefined behaviour of in-place mutation of a field value has been discussed and agreed upon some time ago. I would like us to make sure we are in sync on this before potentially engaging in more work in that area.
@original-brownbear @guyboertje @jsvd @jordansissel
The text was updated successfully, but these errors were encountered: