-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
support return partial result in get of kv interfaces #1840
Conversation
src/kvstore/KVStore.h
Outdated
@@ -83,6 84,13 @@ class KVStore { | |||
const std::vector<std::string>& keys, | |||
std::vector<std::string>* values) = 0; | |||
|
|||
// Read multiple keys, if key[i] does not exist, the i-th value in return value | |||
// would be Status::KeyNotFound | |||
virtual ErrorOr<ResultCode, std::vector<Status>> tryGet(GraphSpaceID spaceId, |
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 not reuse multiGet directly?
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.
Because we need to return the Status, so we can judge whether the key exists. If we reuse multiGet
, the value of key_not_exist would be empty, it is hard to tell whether the value is really empty or the key doesn't exist.
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 modify the multiGet interface directly...
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.
ok
src/kvstore/NebulaStore.cpp
Outdated
PartitionID partId, | ||
const std::vector<std::string>& keys, | ||
std::vector<std::string>* values, | ||
bool returnPartly) { |
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.
Do we really need the param here?
If only partial results returned, we could return ResultCode::PARTIAL_RESULTS;
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 we'd better keep it, if we return ResultCode::PARTIAL_RESULTS
we can't tell the difference between key not exists
and value is empty
,
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. Well done.
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.
Well done!
Hold on a little, I will update ut. |
4dbf05c
Ready to merge |
* Add a return_partly in get, when it is set to true, we can get the keys which exist, and ignore those keys which are not existed. * To implement this, add a tryGet method in KVStore, which return each status of key. * Remove async thread in GetProcessor
* Add a return_partly in get, when it is set to true, we can get the keys which exist, and ignore those keys which are not existed. * To implement this, add a tryGet method in KVStore, which return each status of key. * Remove async thread in GetProcessor
tryGet
method in KVStore, which return each status of key.GetProcessor