-
Notifications
You must be signed in to change notification settings - Fork 17
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
filterx: perf improvement and fix race condition in readonly FilterXJson::to_json_literal() #258
Conversation
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.
Nice catch, sorry for introducing this problem.
What would you think about making make_readonly()
virtual and implementing the json specific parts there, so we don't need separate json_make_readonly()
functions?
Much better, thanks. |
The problem with this is that So either we say we only let objects be marked |
I think we could replace the make_readonly calls with an assert, and make sure to take care of it in the json and otel filterx object implementations. Maybe the assert could be in the list and dict interface getters. The json object caches all the values, so we can do a deep traversal and make everything readonly when the root object becomes readonly, otel does not cache, it creates a new object, so we can must it readonly instantly. Let's talk about this IRL. Thanks for the investigation! |
937fbf9
to
9165f96
Compare
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.
One minor suggestion, but it is completely okay for me to merge this as is. Let me know if you don't want to change the code based on my suggestion, and I will merge the PR.
Thanks!
json_object_to_json_string_ext() writes/caches into the given JSON object, so it's not thread safe. Signed-off-by: László Várady <[email protected]>
Signed-off-by: László Várady <[email protected]>
9165f96
to
49623ff
Compare
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.
Awesome, this turned out really nice :)
json_object_to_json_string_ext() writes/cached into the given JSON object, so it's not thread safe.