Skip to content

Add CompareAndSet for RawClient and make Get returns Optional#192

Merged
andylokandy merged 14 commits intotikv:masterfrom
andylokandy:master
Jun 18, 2021
Merged

Add CompareAndSet for RawClient and make Get returns Optional#192
andylokandy merged 14 commits intotikv:masterfrom
andylokandy:master

Conversation

@andylokandy
Copy link
Copy Markdown
Contributor

What is changed and how it works?

  • Removed putIfAbsent
  • Added CompareAndSet
  • Make Get returns Optional

Check List

Tests

  • Unit test
  • Integration test

Code changes

  • Has exported function/method change

Related changes

  • Need to update the documentation
  • Need to be included in the release note

Signed-off-by: Andy Lok <andylokandy@hotmail.com>
Copy link
Copy Markdown
Collaborator

@marsishandsome marsishandsome left a comment

Choose a reason for hiding this comment

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

@birdstorm @Little-Wallace this PR changes the public API. I'm wondering whether the compatibility problem will affect users?

@iosmanthus
Copy link
Copy Markdown
Member

@andylokandy I don't think removing putIfAbsent is a good idea. What if the semantic of "key does not exist" changes?

andylokandy and others added 2 commits June 11, 2021 18:17
Signed-off-by: Andy Lok <andylokandy@hotmail.com>

Co-authored-by: Liangliang Gu <marsishandsome@gmail.com>
Signed-off-by: Andy Lok <andylokandy@hotmail.com>
@marsishandsome
Copy link
Copy Markdown
Collaborator

/run-all-tests

Signed-off-by: Andy Lok <andylokandy@hotmail.com>
Signed-off-by: Andy Lok <andylokandy@hotmail.com>
@andylokandy
Copy link
Copy Markdown
Contributor Author

@birdstorm @marsishandsome PTAL

Copy link
Copy Markdown
Collaborator

@marsishandsome marsishandsome left a comment

Choose a reason for hiding this comment

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

other LGTM

Signed-off-by: Andy Lok <andylokandy@hotmail.com>
Signed-off-by: Andy Lok <andylokandy@hotmail.com>
Signed-off-by: Andy Lok <andylokandy@hotmail.com>
Copy link
Copy Markdown
Collaborator

@marsishandsome marsishandsome left a comment

Choose a reason for hiding this comment

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

LGTM

@marsishandsome
Copy link
Copy Markdown
Collaborator

@birdstorm PTAL

Copy link
Copy Markdown
Collaborator

@birdstorm birdstorm left a comment

Choose a reason for hiding this comment

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

LGTM

@marsishandsome
Copy link
Copy Markdown
Collaborator

/merge

@ti-srebot
Copy link
Copy Markdown
Collaborator

/run-all-tests

@ti-srebot
Copy link
Copy Markdown
Collaborator

@andylokandy merge failed.

@marsishandsome
Copy link
Copy Markdown
Collaborator

@andylokandy test failed

[2021-06-17T02:31:49.545Z] [ERROR] /home/jenkins/agent/git/client-java/src/test/java/org/tikv/raw/RawKVClientTest.java:[123,41] incompatible types: java.util.Optional<com.google.protobuf.ByteString> cannot be converted to com.google.protobuf.ByteString

[2021-06-17T02:31:49.545Z] [ERROR] /home/jenkins/agent/git/client-java/src/test/java/org/tikv/raw/RawKVClientTest.java:[125,41] incompatible types: java.util.Optional<com.google.protobuf.ByteString> cannot be converted to com.google.protobuf.ByteString

[2021-06-17T02:31:49.545Z] [ERROR] /home/jenkins/agent/git/client-java/src/test/java/org/tikv/raw/RawKVClientTest.java:[132,41] incompatible types: java.util.Optional<com.google.protobuf.ByteString> cannot be converted to com.google.protobuf.ByteString

@marsishandsome
Copy link
Copy Markdown
Collaborator

@andylokandy why use the funciton name compareAndSet instead of compareAndSwap like the rust client does?

Signed-off-by: Andy Lok <andylokandy@hotmail.com>
@tisonkun
Copy link
Copy Markdown
Contributor

/run-all-tests

Copy link
Copy Markdown
Contributor

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

Thanks for your updates @andylokandy ! I left an inline comment on testing part. PTAL.

Signed-off-by: Andy Lok <andylokandy@hotmail.com>
Signed-off-by: Andy Lok <andylokandy@hotmail.com>
@andylokandy
Copy link
Copy Markdown
Contributor Author

@birdstorm @tisonkun @marsishandsome PTAL

@tisonkun
Copy link
Copy Markdown
Contributor

/run-all-tests

Copy link
Copy Markdown
Contributor

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

Generally LGTM. Thanks for your effort!

You may miss the comment https://github.com/tikv/client-java/pull/192/files#r653291717 .

@ti-srebot
Copy link
Copy Markdown
Collaborator

@tisonkun, Thanks for your review. The bot only counts LGTMs from Reviewers and higher roles, but you're still welcome to leave your comments. You are not a reviewer or committer or co-leader or leader.

@tisonkun
Copy link
Copy Markdown
Contributor

@marsishandsome
Copy link
Copy Markdown
Collaborator

https://ci.pingcap.net/blue/organizations/jenkins/tikv-client-java_ghpr_integration_test/detail/tikv-client-java_ghpr_integration_test/41/pipeline

@andylokandy @marsishandsome test failed. Is it due to the test infra settings not upgrade?

cas is supported in v5.0, but current test uses v4.0.
please rebase this pr #202

Signed-off-by: Andy Lok <andylokandy@hotmail.com>
@andylokandy andylokandy merged commit 8308d79 into tikv:master Jun 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants