-
Notifications
You must be signed in to change notification settings - Fork 1k
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
fix(server): fix JSON.MGET implementation (#849) #876
Conversation
a2358bd
to
897ace1
Compare
src/server/json_family.cc
Outdated
OpResult<JsonType*> result = GetJson(op_args, it); | ||
if (!result) { | ||
vec.emplace_back(); | ||
vector<OptString> OpMGet(JsonExpression& expression, const Transaction* t, EngineShard* shard) { |
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.
why expression
is passed by mutable reference, @iko1 ?
the reason I am asking is if it's been mutated then there is a potential data-race since OpMGet
is called in parallel from multiple threads.
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.
so either lets change it to const ref or pass it by value
src/server/json_family.cc
Outdated
if (!it) { | ||
(*cntx)->SendNull(); | ||
} else { | ||
(*cntx)->SendSimpleString(*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 think it's better to use SendBulkString here
1f59af3
to
4063db1
Compare
src/server/json_family.cc
Outdated
OpResult<JsonType*> result = GetJson(op_args, it); | ||
if (!result) { | ||
vec.emplace_back(); | ||
vector<OptString> OpMGet(JsonExpression&& expression, const Transaction* t, EngineShard* shard) { |
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 do not see a good reason to pass JsonExpression&&
over JsonExpression
src/server/json_family.cc
Outdated
vector<OptString> OpMGet(JsonExpression&& expression, const Transaction* t, EngineShard* shard) { | ||
auto args = t->GetShardArgs(shard->shard_id()); | ||
DCHECK(!args.empty()); | ||
vector<OptString> respone(args.size()); |
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.
respone -> responce
aaddf96
to
387ec7a
Compare
Signed-off-by: iko1 <[email protected]>
Thanks, @iko1 ! |
Fixes #849