levy5307 opened a new pull request #656:
URL: https://github.com/apache/incubator-pegasus/pull/656


   ### What problem does this PR solve? <!--add issue link with summary if 
exists-->
   use rocksdb_wrapper::write_batch_put to reimplement check_and_set
   
   
   ### Check List <!--REMOVE the items that are not applicable-->
   
   Tests <!-- At least one of them must be included. -->
   
   - Unit test
   - 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
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to