Skip to content
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

Merged
merged 9 commits into from
Mar 3, 2020

Conversation

critical27
Copy link
Contributor

  1. 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.
  2. To implement this, add a tryGet method in KVStore, which return each status of key.
  3. Remove async thread in GetProcessor

@@ -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,
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

PartitionID partId,
const std::vector<std::string>& keys,
std::vector<std::string>* values,
bool returnPartly) {
Copy link
Contributor

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;

Copy link
Contributor Author

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,

dangleptr
dangleptr previously approved these changes Mar 3, 2020
Copy link
Contributor

@dangleptr dangleptr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Well done.

Copy link
Contributor

@bright-starry-sky bright-starry-sky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done!

@critical27
Copy link
Contributor Author

Hold on a little, I will update ut.

@critical27
Copy link
Contributor Author

Ready to merge

@dangleptr dangleptr merged commit 7d57e16 into vesoft-inc:master Mar 3, 2020
@critical27 critical27 deleted the kv branch March 3, 2020 11:24
jude-zhu pushed a commit to jude-zhu/nebula that referenced this pull request Mar 4, 2020
 * 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
tong-hao pushed a commit to tong-hao/nebula that referenced this pull request Jun 1, 2021
 * 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-testing PR: ready for the CI test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants