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

refactor: use rocksdb_wrapper::get to reimplement check_and_set #654

Merged
merged 3 commits into from
Dec 14, 2020

Conversation

levy5307
Copy link
Contributor

@levy5307 levy5307 commented Dec 10, 2020

What problem does this PR solve?

use rocksdb_wrapper::get to reimplement check_and_set.

Check List

Tests

There are a lot of function tests in test_check_and_test.cpp.

  • Manual test (add detailed scripts or steps below)
>>> use temp
OK
>>> check_and_set a -c b -t exist -s b1 -v c1 -r
hash_key: "a"
check_sort_key: "b"
check_type: exist
set_sort_key: "b1"
set_value: "c1"
set_value_ttl_seconds: 0
return_check_value: true

Set failed, because check not passed.

Check value not exist.

app_id          : 2
partition_index : 4
decree          : 16
server          : 10.232.55.210:34802
>>> set a b c
OK

app_id          : 2
partition_index : 4
decree          : 17
server          : 10.232.55.210:34802
>>> get a b
"c"

app_id          : 2
partition_index : 4
server          : 10.232.55.210:34802
>>> check_and_set a -c b -t exist -s b1 -v c1 -r
hash_key: "a"
check_sort_key: "b"
check_type: exist
set_sort_key: "b1"
set_value: "c1"
set_value_ttl_seconds: 0
return_check_value: true

Set succeed.

Check value: "c"

app_id          : 2
partition_index : 4
decree          : 18
server          : 10.232.55.210:34802
>>> get a b1
"c1"

app_id          : 2
partition_index : 4
server          : 10.232.55.210:34802
>>> set a b c 1
OK

app_id          : 2
partition_index : 4
decree          : 26
server          : 10.232.55.210:34802
>>> check_and_set a -c b -t exist -s b2 -v c2 -r
hash_key: "a"
check_sort_key: "b"
check_type: exist
set_sort_key: "b2"
set_value: "c2"
set_value_ttl_seconds: 0
return_check_value: true

Set failed, because check not passed.

Check value not exist.

app_id          : 2
partition_index : 4
decree          : 27
server          : 10.232.55.210:34802
>>> get a b2
Not found

app_id          : 2
partition_index : 4
server          : 10.232.55.210:34802
>>> check_and_set a -c b -t not_exist -s b2 -v c2 -r
hash_key: "a"
check_sort_key: "b"
check_type: not_exist
set_sort_key: "b2"
set_value: "c2"
set_value_ttl_seconds: 0
return_check_value: true

Set succeed.

Check value not exist.

app_id          : 2
partition_index : 4
decree          : 41
server          : 10.232.55.210:34802
>>> get a b2
"c2"

app_id          : 2
partition_index : 4
server          : 10.232.55.210:34802

@hycdong hycdong merged commit 8bd9ce9 into apache:master Dec 14, 2020
@neverchanje neverchanje mentioned this pull request Mar 1, 2021
@levy5307 levy5307 deleted the check-and-set branch March 18, 2021 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants