-
Notifications
You must be signed in to change notification settings - Fork 990
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
chore: update jsoncons version to 0.178 #4368
Conversation
d711ad0
to
3e90099
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.
LGTM
src/server/json_family.cc
Outdated
@@ -1280,6 +1280,7 @@ auto OpResp(const OpArgs& op_args, string_view key, const WrappedJsonPath& json_ | |||
OpResult<bool> OpSet(const OpArgs& op_args, string_view key, string_view path, | |||
const WrappedJsonPath& json_path, std::string_view json_str, | |||
bool is_nx_condition, bool is_xx_condition) { | |||
JsonMemTracker mem_tracker; |
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.
Since this is not really used below I would rather have it local to the scope of the if statement below
but IMO it doesn't really matter.
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.
It is used. mem_tracker
tracks used memory and ShardJsonFromString
allocates from it
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.
I mean, that mem_tracker
is local
to the branch below
and it's only
used there and not in other places within this function.
See line 1311 mem_tracker.SetJsonSize(st->it->second, st->is_new);
and after it we return.
Pardon me, I wasn't very clear 😄
src/server/json_family.cc
Outdated
// is to use absl::Cleanup and dispatch another Find() but that's too complicated because then | ||
// you need to take into account the order of destructors. | ||
OpResult<DbSlice::AddOrFindResult> st = SetJson(op_args, key, parsed_json.value()); | ||
OpResult<DbSlice::AddOrFindResult> st = SetJson(op_args, key, std::move(*parsed_json)); |
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.
This is fine, because:
- We pass a lambda now
parse_json
. See changes introduced by Stefan in fb8234c#diff-0799c8810dbf8758f9da40162075f38bb51639f806be28a06d9f669a6ebb0f76R1288
(The only redundancy here is the move on the lambda since it has no capture -- but I know you like calling move() anyways so it's fine).
- Moving the JsonMemTracker above is also fine. We no longer parse the json in this function but rather inside the lambda so when we construct the tracker we have no extra calculated allocations and when we call
mem_tracker.SetJsonSize(st->it->second, st->is_new);
below we already destructed the temporaries created withinSetJson()
from the lambdaparse_json
so the tracking deltas shall becorrect
18be08c
|
Signed-off-by: Roman Gershman <[email protected]>
I removed the lambda |
VLOG(1) << "got invalid JSON string '" << json_str << "' cannot be saved"; | ||
return OpStatus::SYNTAX_ERR; | ||
} | ||
return parsed_json.value(); |
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.
this does not move, this copies.
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.
I'd like to suggest running sanitizers on this branch
Upd.: Still fails |
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.
lgtm
jsoncons 0.178 has some pmr related fixes that should contribute to better stability in our codebase.